[virt-tools-list] [PATCH 1/3] virt-viewer-window: Store the monitor locally
Hans de Goede
hdegoede at redhat.com
Thu Mar 21 12:36:59 UTC 2013
With commit 81ed9d13 "virt_viewer_window_enter_fullscreen: Pass in monitor for
fullscreen window" we need a monitor number to determine where to move
the window when going fullscreen.
Since the VirtViewerDisplay needs to know the fullscreen monitor number too,
to determine the fullscreen size it was being stored there. But we don't
always have a display, leading to errors like:
(remote-viewer:7996): remote-viewer-CRITICAL **:
virt_viewer_display_get_monitor: assertion `VIRT_VIEWER_IS_DISPLAY(self)'
failed
And to the monitor number not always being stored. This patchset fixes this
by storing the monitor number inside VirtViewerWindow, and passing it to
VirtViewerDisplay only when we've a display.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/virt-viewer-window.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index f8958a1..80ba322 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -100,6 +100,7 @@ struct _VirtViewerWindowPrivate {
gboolean grabbed;
gboolean before_saved;
GdkRectangle before_fullscreen;
+ gint fullscreen_monitor;
gboolean desktop_resize_pending;
gint zoomlevel;
@@ -472,9 +473,8 @@ virt_viewer_window_move_to_monitor(VirtViewerWindow *self)
{
VirtViewerWindowPrivate *priv = self->priv;
GdkRectangle mon;
- gint n;
+ gint n = priv->fullscreen_monitor;
- n = virt_viewer_display_get_monitor(priv->display);
if (n == -1 || !priv->fullscreen)
return;
@@ -494,7 +494,9 @@ virt_viewer_window_leave_fullscreen(VirtViewerWindow *self)
gtk_check_menu_item_set_active(check, FALSE);
priv->fullscreen = FALSE;
- virt_viewer_display_set_monitor(priv->display, -1);
+ priv->fullscreen_monitor = -1;
+ if (priv->display)
+ virt_viewer_display_set_monitor(priv->display, -1);
ViewAutoDrawer_SetActive(VIEW_AUTODRAWER(priv->layout), FALSE);
gtk_widget_show(menu);
gtk_widget_hide(priv->toolbar);
@@ -541,7 +543,9 @@ virt_viewer_window_enter_fullscreen(VirtViewerWindow *self, gint monitor)
ViewAutoDrawer_SetActive(VIEW_AUTODRAWER(priv->layout), TRUE);
ViewAutoDrawer_Close(VIEW_AUTODRAWER(priv->layout));
- virt_viewer_display_set_monitor(priv->display, monitor);
+ priv->fullscreen_monitor = monitor;
+ if (priv->display)
+ virt_viewer_display_set_monitor(priv->display, monitor);
virt_viewer_window_move_to_monitor(self);
gtk_window_fullscreen(GTK_WINDOW(priv->window));
@@ -1118,6 +1122,7 @@ virt_viewer_window_set_display(VirtViewerWindow *self, VirtViewerDisplay *displa
virt_viewer_display_set_zoom_level(VIRT_VIEWER_DISPLAY(priv->display), priv->zoomlevel);
virt_viewer_display_set_auto_resize(VIRT_VIEWER_DISPLAY(priv->display), priv->auto_resize);
+ virt_viewer_display_set_monitor(VIRT_VIEWER_DISPLAY(priv->display), priv->fullscreen_monitor);
gtk_widget_show_all(GTK_WIDGET(display));
gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), GTK_WIDGET(display), NULL);
--
1.8.1.4
More information about the virt-tools-list
mailing list