You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Set Configuration.screenLayout depending on monitor geometry
With this configuration, NewPipe enables tablet mode on larger screens.
This commit is contained in:
@@ -554,6 +554,15 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h
|
|||||||
if (GDK_IS_WAYLAND_TOPLEVEL(toplevel)) {
|
if (GDK_IS_WAYLAND_TOPLEVEL(toplevel)) {
|
||||||
gdk_wayland_toplevel_set_application_id(GDK_WAYLAND_TOPLEVEL(toplevel), package_name);
|
gdk_wayland_toplevel_set_application_id(GDK_WAYLAND_TOPLEVEL(toplevel), package_name);
|
||||||
}
|
}
|
||||||
|
GdkMonitor *monitor = gdk_display_get_monitor_at_surface(gdk_display_get_default(), GDK_SURFACE(toplevel));
|
||||||
|
GdkRectangle monitor_geometry;
|
||||||
|
gdk_monitor_get_geometry(monitor, &monitor_geometry);
|
||||||
|
jobject resources = _GET_STATIC_OBJ_FIELD(handle_cache.context.class, "r", "Landroid/content/res/Resources;");
|
||||||
|
jobject configuration = _GET_OBJ_FIELD(resources, "mConfiguration", "Landroid/content/res/Configuration;");
|
||||||
|
if (monitor_geometry.width >= 800 && monitor_geometry.height >= 800)
|
||||||
|
_SET_INT_FIELD(configuration, "screenLayout", /*SCREENLAYOUT_SIZE_LARGE*/ 0x03);
|
||||||
|
else
|
||||||
|
_SET_INT_FIELD(configuration, "screenLayout", /*SCREENLAYOUT_SIZE_NORMAL*/ 0x02);
|
||||||
|
|
||||||
if (app_icon_path) {
|
if (app_icon_path) {
|
||||||
char *app_icon_path_full = malloc(strlen(app_data_dir) + 1 + strlen(app_icon_path) + 1); // +1 for /, +1 for NULL
|
char *app_icon_path_full = malloc(strlen(app_data_dir) + 1 + strlen(app_icon_path) + 1); // +1 for /, +1 for NULL
|
||||||
|
|||||||
Reference in New Issue
Block a user