[virt-tools-list] [PATCH v2 06/16] display: ignore display that do not have toplevel window
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Wed Sep 26 15:26:29 UTC 2018
From: Marc-André Lureau <marcandre.lureau at redhat.com>
virt_viewer_display_get_preferred_monitor_geometry() may be called
during application initialization (when the VTE console is being
shown, virt_viewer_session_update_displays_geometry() is called when
the visibility menu item is toggled). But the other displays may not
yet be associated with a window, ignore them.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/virt-viewer-display.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index b3cc095..a1fcb82 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -687,7 +687,9 @@ void virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
g_return_if_fail(preferred != NULL);
- if (!virt_viewer_display_get_enabled(self)) {
+ top = gtk_widget_get_toplevel(GTK_WIDGET(self));
+ if (!virt_viewer_display_get_enabled(self) ||
+ !GTK_IS_WINDOW(top)) {
preferred->width = 0;
preferred->height = 0;
preferred->x = 0;
@@ -695,7 +697,6 @@ void virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
return;
}
- top = gtk_widget_get_toplevel(GTK_WIDGET(self));
gtk_window_get_position(GTK_WINDOW(top), &topx, &topy);
topx = MAX(topx, 0);
topy = MAX(topy, 0);
--
2.19.0.271.gfe8321ec05
More information about the virt-tools-list
mailing list