virt-viewer-display-spice: Use display monitor property for fullscreen size

When a display is pinned to a certain monitor for fullscreen, it will be moved
there when going fullscreen. Currently we use gdk_screen_get_monitor_at_window
to determine which monitor we are on and get the size from that monitor.

But this is racy, sometimes the size_allocate function runs before the move
has finished and we get the size from the wrong monitor:
https://bugzilla.redhat.com/show_bug.cgi?id=918570

Since if the display is pinned to a certain monitor, the display will always
end up on that monitor we can avoid the race by simply using that monitors
size.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Hans de Goede 2013-03-20 12:26:39 +01:00
parent 81ed9d13a8
commit 0f737b4e9d

View File

@ -201,7 +201,9 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
if (self->priv->auto_resize == AUTO_RESIZE_FULLSCREEN) {
GdkRectangle monitor;
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(self));
int n = gdk_screen_get_monitor_at_window(screen,
int n = virt_viewer_display_get_monitor(VIRT_VIEWER_DISPLAY(self));
if (n == -1)
n = gdk_screen_get_monitor_at_window(screen,
gtk_widget_get_window(GTK_WIDGET(self)));
gdk_screen_get_monitor_geometry(screen, n, &monitor);
disable_display_position = FALSE;