[mutter/wip/carlosg/frames-client: 1/5] x11: Do not fake frame extents if unmanaged window asks for _NET_FRAME_EXTENTS




commit 7efd53116b284531524039ef4ba931aa3b88d1f6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 20 14:07:59 2021 +0200

    x11: Do not fake frame extents if unmanaged window asks for _NET_FRAME_EXTENTS
    
    If the window is not managed, it's weird that it asks for _NET_FRAME_EXTENTS,
    it's even weirder that mutter replies with a frame border that would only
    apply if the window were managed. Stop doing the latter, and drop the
    MetaUI call that calculates borders from the theme settings.

 src/ui/ui.c      | 41 -----------------------------------------
 src/ui/ui.h      |  5 -----
 src/x11/events.c | 32 ++------------------------------
 3 files changed, 2 insertions(+), 76 deletions(-)
---
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 2fbaad993e..dd52a0c576 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -211,47 +211,6 @@ meta_ui_window_should_not_cause_focus (Display *xdisplay,
     return FALSE;
 }
 
-void
-meta_ui_theme_get_frame_borders (MetaUI *ui,
-                                 MetaFrameType      type,
-                                 MetaFrameFlags     flags,
-                                 MetaFrameBorders  *borders)
-{
-  GdkDisplay *display;
-  GdkScreen *screen;
-  int text_height;
-  MetaStyleInfo *style_info = NULL;
-  PangoContext *context;
-  const PangoFontDescription *font_desc;
-  PangoFontDescription *free_font_desc = NULL;
-
-  display = gdk_x11_lookup_xdisplay (ui->xdisplay);
-  screen = gdk_display_get_default_screen (display);
-
-  style_info = meta_theme_create_style_info (screen, NULL);
-
-  context = gtk_widget_get_pango_context (GTK_WIDGET (ui->frames));
-  font_desc = meta_prefs_get_titlebar_font ();
-
-  if (!font_desc)
-    {
-      free_font_desc = meta_style_info_create_font_desc (style_info);
-      font_desc = (const PangoFontDescription *) free_font_desc;
-    }
-
-  text_height = meta_pango_font_desc_get_text_height (font_desc, context);
-
-  meta_theme_get_frame_borders (meta_theme_get_default (),
-                                style_info, type, text_height, flags,
-                                borders);
-
-  if (free_font_desc)
-    pango_font_description_free (free_font_desc);
-
-  if (style_info != NULL)
-    meta_style_info_unref (style_info);
-}
-
 gboolean
 meta_ui_window_is_widget (MetaUI *ui,
                           Window  xwindow)
diff --git a/src/ui/ui.h b/src/ui/ui.h
index e7a00e4e69..eb5cc97797 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -39,11 +39,6 @@ typedef gboolean (* MetaEventFunc) (XEvent *xevent, gpointer data);
 MetaUI *meta_ui_new  (MetaX11Display *x11_display);
 void    meta_ui_free (MetaUI *ui);
 
-void meta_ui_theme_get_frame_borders (MetaUI *ui,
-                                      MetaFrameType      type,
-                                      MetaFrameFlags     flags,
-                                      MetaFrameBorders *borders);
-
 MetaUIFrame * meta_ui_create_frame (MetaUI *ui,
                                     Display *xdisplay,
                                     MetaWindow *meta_window,
diff --git a/src/x11/events.c b/src/x11/events.c
index 8882baac4e..75472e786e 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -1047,35 +1047,9 @@ process_request_frame_extents (MetaX11Display *x11_display,
   Window xwindow = event->xclient.window;
   unsigned long data[4] = { 0, 0, 0, 0 };
 
-  MotifWmHints *hints = NULL;
-  gboolean hints_set = FALSE;
-
-  meta_verbose ("Setting frame extents for 0x%lx", xwindow);
-
-  /* See if the window is decorated. */
-  hints_set = meta_prop_get_motif_hints (x11_display,
-                                         xwindow,
-                                         x11_display->atom__MOTIF_WM_HINTS,
-                                         &hints);
-  if ((hints_set && hints->decorations) || !hints_set)
-    {
-      MetaFrameBorders borders;
-
-      /* Return estimated frame extents for a normal window. */
-      meta_ui_theme_get_frame_borders (x11_display->ui,
-                                       META_FRAME_TYPE_NORMAL,
-                                       0,
-                                       &borders);
-      data[0] = borders.visible.left;
-      data[1] = borders.visible.right;
-      data[2] = borders.visible.top;
-      data[3] = borders.visible.bottom;
-    }
-
   meta_topic (META_DEBUG_GEOMETRY,
-              "Setting _NET_FRAME_EXTENTS on unmanaged window 0x%lx "
-              "to top = %lu, left = %lu, bottom = %lu, right = %lu",
-              xwindow, data[0], data[1], data[2], data[3]);
+              "Setting _NET_FRAME_EXTENTS on unmanaged window 0x%lx",
+              xwindow);
 
   meta_x11_error_trap_push (x11_display);
   XChangeProperty (x11_display->xdisplay, xwindow,
@@ -1083,8 +1057,6 @@ process_request_frame_extents (MetaX11Display *x11_display,
                    XA_CARDINAL,
                    32, PropModeReplace, (guchar*) data, 4);
   meta_x11_error_trap_pop (x11_display);
-
-  g_free (hints);
 }
 
 /* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */


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