[metacity] display: remove meta_display_screen_for_xwindow



commit b9cfaa8803fa019b3a1502b067802f2434b6e737
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Jun 19 21:43:46 2017 +0300

    display: remove meta_display_screen_for_xwindow

 src/core/bell.c            |   15 ++-------------
 src/core/core.c            |   10 +++-------
 src/core/display-private.h |    3 +--
 src/core/display.c         |   40 +---------------------------------------
 src/core/keybindings.c     |    5 -----
 5 files changed, 7 insertions(+), 66 deletions(-)
---
diff --git a/src/core/bell.c b/src/core/bell.c
index 5db805c..4b28708 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -150,20 +150,9 @@ static void
 bell_flash_fullscreen (MetaDisplay *display,
                            XkbAnyEvent *xkb_ev)
 {
-  XkbBellNotifyEvent *xkb_bell_ev = (XkbBellNotifyEvent *) xkb_ev;
-  MetaScreen *screen;
-
   g_assert (xkb_ev->xkb_type == XkbBellNotify);
-  if (xkb_bell_ev->window != None)
-    {
-      screen = meta_display_screen_for_xwindow (display, xkb_bell_ev->window);
-      if (screen)
-        bell_flash_screen (display, screen);
-    }
-  else
-    {
-      bell_flash_screen (display, display->screen);
-    }
+
+  bell_flash_screen (display, display->screen);
 }
 
 /**
diff --git a/src/core/core.c b/src/core/core.c
index 0bfcc71..18ff0ed 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -261,12 +261,10 @@ meta_core_lower_beneath_focus_window (Display *xdisplay,
 {
   XWindowChanges changes;
   MetaDisplay *display;
-  MetaScreen *screen;
   MetaWindow *focus_window;
 
   display = meta_display_for_x_display (xdisplay);
-  screen = meta_display_screen_for_xwindow (display, xwindow);
-  focus_window = meta_stack_get_top (screen->stack);
+  focus_window = meta_stack_get_top (display->screen->stack);
 
   if (focus_window == NULL)
     return;
@@ -636,14 +634,12 @@ meta_core_begin_grab_op (Display    *xdisplay,
 {
   MetaWindow *window = get_window (xdisplay, frame_xwindow);
   MetaDisplay *display;
-  MetaScreen *screen;
 
   display = meta_display_for_x_display (xdisplay);
-  screen = meta_display_screen_for_xwindow (display, frame_xwindow);
 
-  g_assert (screen != NULL);
+  g_assert (display->screen != NULL);
 
-  return meta_display_begin_grab_op (display, screen, window,
+  return meta_display_begin_grab_op (display, display->screen, window,
                                      op, pointer_already_grabbed,
                                      frame_action,
                                      button, modmask,
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 8cb66a8..d257426 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -303,8 +303,7 @@ struct _MetaDisplay
 gboolean      meta_display_open                (void);
 void          meta_display_close               (MetaDisplay *display,
                                                 guint32      timestamp);
-MetaScreen*   meta_display_screen_for_xwindow  (MetaDisplay *display,
-                                                Window       xindow);
+
 void          meta_display_grab                (MetaDisplay *display);
 void          meta_display_ungrab              (MetaDisplay *display);
 
diff --git a/src/core/display.c b/src/core/display.c
index c00cf0d..d7f2975 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -886,31 +886,6 @@ meta_display_screen_for_root (MetaDisplay *display,
   return NULL;
 }
 
-MetaScreen*
-meta_display_screen_for_xwindow (MetaDisplay *display,
-                                 Window       xwindow)
-{
-  XWindowAttributes attr;
-  int result;
-
-  meta_error_trap_push (display);
-  attr.screen = NULL;
-  result = XGetWindowAttributes (display->xdisplay, xwindow, &attr);
-  meta_error_trap_pop (display);
-
-  /* Note, XGetWindowAttributes is on all kinds of crack
-   * and returns 1 on success 0 on failure, rather than Success
-   * on success.
-   */
-  if (result == 0 || attr.screen == NULL)
-    return NULL;
-
-  if (display->screen->xscreen != attr.screen)
-    return NULL;
-
-  return display->screen;
-}
-
 /* Grab/ungrab routines taken from fvwm */
 void
 meta_display_grab (MetaDisplay *display)
@@ -4415,22 +4390,9 @@ process_request_frame_extents (MetaDisplay    *display,
   if ((hints_set && hints->decorations) || !hints_set)
     {
       MetaFrameBorders borders;
-      MetaScreen *screen;
-
-      screen = meta_display_screen_for_xwindow (display,
-                                                event->xclient.window);
-      if (screen == NULL)
-        {
-          g_warning ("Received request to set _NET_FRAME_EXTENTS "
-                     "on 0x%lx which is on a screen we are not managing",
-                     event->xclient.window);
-
-          meta_XFree (hints);
-          return;
-        }
 
       /* Return estimated frame extents for a normal window. */
-      meta_ui_theme_get_frame_borders (screen->ui,
+      meta_ui_theme_get_frame_borders (display->screen->ui,
                                        META_FRAME_TYPE_NORMAL,
                                        0,
                                        &borders);
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 2c18875..50e70e5 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1265,11 +1265,6 @@ meta_display_process_key_event (MetaDisplay *display,
   /* if key event was on root window, we have a shortcut */
   screen = meta_display_screen_for_root (display, event->xkey.window);
 
-  /* else round-trip to server */
-  if (screen == NULL)
-    screen = meta_display_screen_for_xwindow (display,
-                                              event->xany.window);
-
   if (screen == NULL)
     return; /* event window is destroyed */
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]