diff options
Diffstat (limited to 'src/core/screen.c')
-rw-r--r-- | src/core/screen.c | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/src/core/screen.c b/src/core/screen.c index 8e1448ec..c03530c2 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1224,8 +1224,7 @@ get_window_pixbuf (MetaWindow *window, MetaDisplay *display; cairo_surface_t *surface; GdkPixbuf *pixbuf, *scaled; - GdkMonitor *monitor; - GdkRectangle rect; + const MetaXineramaScreenInfo *current; double ratio; display = window->display; @@ -1248,28 +1247,19 @@ get_window_pixbuf (MetaWindow *window, *width = gdk_pixbuf_get_width (pixbuf); *height = gdk_pixbuf_get_height (pixbuf); - monitor = meta_screen_get_current_monitor (); - if (monitor != NULL) - { - gdk_monitor_get_geometry (monitor, &rect); - } - else - { - rect.width = window->screen->rect.width; - rect.height = window->screen->rect.height; - } + current = meta_screen_get_current_xinerama (window->screen); /* Scale pixbuf to max dimension based on monitor size */ if (*width > *height) { - int max_preview_width = rect.width / MAX_PREVIEW_SCALE; + int max_preview_width = current->rect.width / MAX_PREVIEW_SCALE; ratio = ((double) *width) / max_preview_width; *width = (int) max_preview_width; *height = (int) (((double) *height) / ratio); } else { - int max_preview_height = rect.height / MAX_PREVIEW_SCALE; + int max_preview_height = current->rect.height / MAX_PREVIEW_SCALE; ratio = ((double) *height) / max_preview_height; *height = (int) max_preview_height; *width = (int) (((double) *width) / ratio); @@ -1812,29 +1802,6 @@ meta_screen_get_current_xinerama (MetaScreen *screen) return &screen->xinerama_infos[screen->last_xinerama_index]; } -GdkMonitor * -meta_screen_get_current_monitor () -{ - GdkDisplay *display; - GdkSeat *seat; - GdkDevice *device; - GdkMonitor *current; - gint x, y; - - display = gdk_display_get_default (); - seat = gdk_display_get_default_seat (display); - device = gdk_seat_get_pointer (seat); - - gdk_device_get_position (device, NULL, &x, &y); - current = gdk_display_get_monitor_at_point (display, x, y); - - if (current != NULL) { - return current; - } - - return gdk_display_get_primary_monitor (display); -} - #define _NET_WM_ORIENTATION_HORZ 0 #define _NET_WM_ORIENTATION_VERT 1 |