diff options
Diffstat (limited to 'core/modules')
| -rw-r--r-- | core/modules/virt-viewer/module.conf | 2 | ||||
| -rw-r--r-- | core/modules/virt-viewer/patches/fix-window-placement-kiosk.patch | 74 | ||||
| -rw-r--r-- | core/modules/virt-viewer/patches/smarter-num-screeens.patch | 29 |
3 files changed, 104 insertions, 1 deletions
diff --git a/core/modules/virt-viewer/module.conf b/core/modules/virt-viewer/module.conf index 525562d3..7f63e343 100644 --- a/core/modules/virt-viewer/module.conf +++ b/core/modules/virt-viewer/module.conf @@ -6,7 +6,7 @@ REQUIRED_MODULES=" " REQUIRED_GIT=" - https://gitlab.com/virt-viewer/virt-viewer.git||${CONFIG_VIRTVIEWER_VERSION:-0a6155ca} + https://gitlab.com/virt-viewer/virt-viewer.git||${CONFIG_VIRTVIEWER_VERSION:-107f60c1} " # copy everything since there is a clean installation done by 'ninja install' diff --git a/core/modules/virt-viewer/patches/fix-window-placement-kiosk.patch b/core/modules/virt-viewer/patches/fix-window-placement-kiosk.patch new file mode 100644 index 00000000..2efd32e0 --- /dev/null +++ b/core/modules/virt-viewer/patches/fix-window-placement-kiosk.patch @@ -0,0 +1,74 @@ +From f536966df6253dc625a69803734bc250f3c01cda Mon Sep 17 00:00:00 2001 +From: Proteek <pro_roy7@yahoo.co.uk> +Date: Fri, 7 Mar 2025 05:50:33 +0000 +Subject: [PATCH] Fix window placement in kiosk mode + +virt_viewer_window_move_to_monitor() did not consider display mappings (in kiosk mode it seems). +Both a window and display need to be instructed which monitor to be placed on (I think). +This fix focuses on placing the window correctly by using the configured mapping. +--- + src/virt-viewer-window.c | 43 ++++++++++++++++++++++++++++++++++++---- + 1 file changed, 39 insertions(+), 4 deletions(-) + +diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c +index 29ec4bd7..7fb5860c 100644 +--- a/src/virt-viewer-window.c ++++ b/src/virt-viewer-window.c +@@ -674,15 +674,50 @@ virt_viewer_window_move_to_monitor(VirtViewerWindow *self) + GdkRectangle mon; + gint n = self->fullscreen_monitor; + ++ /* ++ The window should be placed on the monitor for it's ++ contained display. The monitor can be found in the ++ initial_display_mapping and is retrieved with ++ virt_viewer_app_get_initial_monitor_for_display(). ++ ++ virt_viewer_display_get_monitor() does not update ++ properly (in kiosk mode) and is not derived from ++ the "monitor-mapping"/initial_display_mapping. ++ */ ++ ++ if (self->display) { ++ gint nthd = virt_viewer_display_get_nth(self->display); ++ g_debug(" Display %d - assigned monitor %d", nthd, virt_viewer_display_get_monitor(self->display)); ++ g_debug(" Display %d - window %s assigned monitor %d", nthd, self->subtitle, n); ++ if (self->app) { ++ n = virt_viewer_app_get_initial_monitor_for_display(self->app, nthd); ++ g_debug(" Both should be on monitor %d", n); ++ } ++ } else { ++ g_debug("No display for this window, nothing to do"); ++ //return; ++ } ++ + if (n == -1) + return; + ++ gint width, height, x, y; ++ gtk_window_get_size(GTK_WINDOW(self->window), &width, &height); ++ gtk_window_get_position(GTK_WINDOW(self->window), &x, &y); + gdk_screen_get_monitor_geometry(gdk_screen_get_default(), n, &mon); +- gtk_window_move(GTK_WINDOW(self->window), mon.x, mon.y); + +- gtk_widget_set_size_request(self->window, +- mon.width, +- mon.height); ++ g_debug(" window geom %dx%d+%d+%d", width, height, x, y); ++ g_debug(" monitor geom %dx%d+%d+%d", mon.width, mon.height, mon.x, mon.y); ++ ++ if(width != mon.width || height != mon.height) { ++ g_debug(" Window has incorrect size. Resizing to %dx%d", mon.width, mon.height); ++ gtk_widget_set_size_request(self->window, mon.width, mon.height); ++ } ++ ++ if(x != mon.x || y != mon.y) { ++ g_debug(" Window has incorrect position. Moving to (%d, %d)", mon.x, mon.y); ++ gtk_window_move(GTK_WINDOW(self->window), mon.x, mon.y); ++ } + } + + static gboolean +-- +GitLab + diff --git a/core/modules/virt-viewer/patches/smarter-num-screeens.patch b/core/modules/virt-viewer/patches/smarter-num-screeens.patch new file mode 100644 index 00000000..554a0b26 --- /dev/null +++ b/core/modules/virt-viewer/patches/smarter-num-screeens.patch @@ -0,0 +1,29 @@ +diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c +index 5a1204b..1b09cc7 100644 +--- a/src/virt-viewer-app.c ++++ b/src/virt-viewer-app.c +@@ -348,7 +348,23 @@ virt_viewer_app_quit(VirtViewerApp *self) + static gint + get_n_client_monitors(void) + { +- return gdk_screen_get_n_monitors(gdk_screen_get_default()); ++ GdkScreen *screen = gdk_screen_get_default(); ++ gint num = gdk_screen_get_n_monitors(screen); ++ gint ret = 0; ++ GdkRectangle outer, inner; ++ for (gint o = 0; o < num; ++o) { ++ gboolean ok = TRUE; ++ gdk_screen_get_monitor_geometry(screen, o, &outer); ++ for (gint i = 0; i < o; ++i) { ++ gdk_screen_get_monitor_geometry(screen, i, &inner); ++ if (outer.x == inner.x && outer.y == inner.y) { ++ ok = FALSE; ++ break; ++ } ++ } ++ if (ok) ret++; ++ } ++ return ret; + } + + GList* virt_viewer_app_get_initial_displays(VirtViewerApp* self) |
