diff options
| -rw-r--r-- | src/core/screen-private.h | 3 | ||||
| -rw-r--r-- | src/core/screen.c | 41 | ||||
| -rw-r--r-- | src/core/window.c | 4 | ||||
| -rw-r--r-- | src/ui/tabpopup.c | 18 | 
4 files changed, 10 insertions, 56 deletions
| diff --git a/src/core/screen-private.h b/src/core/screen-private.h index 6cd720d7..c1552ab0 100644 --- a/src/core/screen-private.h +++ b/src/core/screen-private.h @@ -36,7 +36,6 @@  #include "display-private.h"  #include "screen.h"  #include <X11/Xutil.h> -#include <gdk/gdk.h>  #include "ui.h"  typedef struct _MetaXineramaScreenInfo MetaXineramaScreenInfo; @@ -194,8 +193,6 @@ void          meta_screen_update_workspace_layout (MetaScreen             *scree  void          meta_screen_update_workspace_names  (MetaScreen             *screen);  void          meta_screen_queue_workarea_recalc   (MetaScreen             *screen); -GdkMonitor* meta_screen_get_current_monitor (void); -  Window meta_create_offscreen_window (Display *xdisplay,                                       Window   parent,                                       long     valuemask); 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 diff --git a/src/core/window.c b/src/core/window.c index df8da1d3..485afbc1 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7197,8 +7197,8 @@ update_move (MetaWindow  *window,         * inside edge, because we don't want to force users to maximize         * windows they are placing near the top of their screens.         * -       * The "current" idea of meta_window_get_work_area_current_monitor() and -       * meta_screen_get_current_monitor() is slightly different: the former +       * The "current" idea of meta_window_get_work_area_for_xinerama() and +       * meta_screen_get_current_xinerama() is slightly different: the former         * refers to the monitor which contains the largest part of the window,         * the latter to the one where the pointer is located.         */ diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c index 49524d80..37231a5b 100644 --- a/src/ui/tabpopup.c +++ b/src/ui/tabpopup.c @@ -760,34 +760,24 @@ static GtkWidget*  selectable_workspace_new (MetaWorkspace *workspace, int entry_count)  {    GtkWidget *widget; -  GdkMonitor *monitor; -  GdkRectangle rect; +  const MetaXineramaScreenInfo *current;    int mini_workspace_width, mini_workspace_height;    double mini_workspace_ratio;    widget = g_object_new (meta_select_workspace_get_type (), NULL); -  monitor = meta_screen_get_current_monitor (); -  if (monitor != NULL) -  { -    gdk_monitor_get_geometry (monitor, &rect); -  } -  else -  { -    rect.width = workspace->screen->rect.width; -    rect.height = workspace->screen->rect.height; -  } +  current = meta_screen_get_current_xinerama (workspace->screen);    if (workspace->screen->rect.width < workspace->screen->rect.height)    {      mini_workspace_ratio = (double) workspace->screen->rect.width / (double) workspace->screen->rect.height; -    mini_workspace_height = (int) ((double) rect.height / entry_count - SELECT_OUTLINE_WIDTH * 2); +    mini_workspace_height = (int) ((double) current->rect.height / entry_count - SELECT_OUTLINE_WIDTH * 2);      mini_workspace_width = (int) ((double) mini_workspace_height * mini_workspace_ratio);    }    else    {      mini_workspace_ratio = (double) workspace->screen->rect.height / (double) workspace->screen->rect.width; -    mini_workspace_width = (int) ((double) rect.width / entry_count - SELECT_OUTLINE_WIDTH * 2); +    mini_workspace_width = (int) ((double) current->rect.width / entry_count - SELECT_OUTLINE_WIDTH * 2);      mini_workspace_height = (int) ((double) mini_workspace_width * mini_workspace_ratio);    } | 
