summaryrefslogtreecommitdiff
path: root/src/core/screen.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-01-31 07:16:34 -0500
committerlukefromdc <[email protected]>2019-01-31 20:00:19 +0000
commitfad23c9979d3ba04f377eb0704b6d78b9ebf43c4 (patch)
treeab1099b7ca988bbc42906ea6ab0095574240ac93 /src/core/screen.c
parent8abba9a150e4004004609ff7a1c72a188f170d5f (diff)
downloadmarco-fad23c9979d3ba04f377eb0704b6d78b9ebf43c4.tar.bz2
marco-fad23c9979d3ba04f377eb0704b6d78b9ebf43c4.tar.xz
screen: Remove get_current_monitor in favor of get_current_xinerama
Since xinerama already contains information on the monitor and its rectangle, there is no need to go through Gdk to get this information again.
Diffstat (limited to 'src/core/screen.c')
-rw-r--r--src/core/screen.c41
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