[mutter] Support _GTK_FRAME_EXTENTS



commit 12d2e1f6007b94b29237dd5bcd22032ff922d327
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Aug 8 16:58:20 2013 -0400

    Support _GTK_FRAME_EXTENTS
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705766

 src/core/window-private.h |    3 +++
 src/core/window-props.c   |   30 ++++++++++++++++++++++++++++++
 src/core/window.c         |   13 ++++++++++++-
 src/meta/atomnames.h      |    1 +
 4 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index ec94cca..2fb1016 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -394,6 +394,9 @@ struct _MetaWindow
    */
   MetaRectangle rect;
 
+  gboolean has_custom_frame_extents;
+  GtkBorder custom_frame_extents;
+
   /* The geometry to restore when we unmaximize.  The position is in
    * root window coords, even if there's a frame, which contrasts with
    * window->rect above.  Note that this gives the position and size
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 0b9d7ea..adbfe59 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -290,6 +290,35 @@ reload_icon_geometry (MetaWindow    *window,
 }
 
 static void
+reload_gtk_frame_extents (MetaWindow    *window,
+                          MetaPropValue *value,
+                          gboolean       initial)
+{
+  if (value->type != META_PROP_VALUE_INVALID)
+    {
+      if (value->v.cardinal_list.n_cardinals != 4)
+        {
+          meta_verbose ("_GTK_FRAME_EXTENTS on %s has %d values instead of 4\n",
+                        window->desc, value->v.cardinal_list.n_cardinals);
+        }
+      else
+        {
+          GtkBorder *extents = &window->custom_frame_extents;
+
+          window->has_custom_frame_extents = TRUE;
+          extents->left   = (int)value->v.cardinal_list.cardinals[0];
+          extents->right  = (int)value->v.cardinal_list.cardinals[1];
+          extents->top    = (int)value->v.cardinal_list.cardinals[2];
+          extents->bottom = (int)value->v.cardinal_list.cardinals[3];
+        }
+    }
+  else
+    {
+      window->has_custom_frame_extents = FALSE;
+    }
+}
+
+static void
 reload_struts (MetaWindow    *window,
                MetaPropValue *value,
                gboolean       initial)
@@ -1766,6 +1795,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
     { display->atom__GTK_WINDOW_OBJECT_PATH,           META_PROP_VALUE_UTF8,         
reload_gtk_window_object_path,           TRUE, FALSE },
     { display->atom__GTK_APP_MENU_OBJECT_PATH,         META_PROP_VALUE_UTF8,         
reload_gtk_app_menu_object_path,         TRUE, FALSE },
     { display->atom__GTK_MENUBAR_OBJECT_PATH,          META_PROP_VALUE_UTF8,         
reload_gtk_menubar_object_path,          TRUE, FALSE },
+    { display->atom__GTK_FRAME_EXTENTS,                
META_PROP_VALUE_CARDINAL_LIST,reload_gtk_frame_extents,                TRUE, FALSE },
     { display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, TRUE, 
FALSE },
     { display->atom_WM_STATE,          META_PROP_VALUE_INVALID,  NULL,                     FALSE, FALSE },
     { display->atom__NET_WM_ICON,      META_PROP_VALUE_INVALID,  reload_net_wm_icon,       FALSE, FALSE },
diff --git a/src/core/window.c b/src/core/window.c
index 9252ab2..3372353 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5821,7 +5821,18 @@ meta_window_get_outer_rect (const MetaWindow *window,
       rect->height -= borders.invisible.top  + borders.invisible.bottom;
     }
   else
-    *rect = window->rect;
+    {
+      *rect = window->rect;
+
+      if (window->has_custom_frame_extents)
+        {
+          GtkBorder *extents = &window->custom_frame_extents;
+          rect->x += extents->left;
+          rect->y += extents->top;
+          rect->width -= extents->left + extents->right;
+          rect->height -= extents->top + extents->bottom;
+        }
+    }
 }
 
 const char*
diff --git a/src/meta/atomnames.h b/src/meta/atomnames.h
index 2a62873..0646799 100644
--- a/src/meta/atomnames.h
+++ b/src/meta/atomnames.h
@@ -63,6 +63,7 @@ item(_GTK_APPLICATION_OBJECT_PATH)
 item(_GTK_WINDOW_OBJECT_PATH)
 item(_GTK_APP_MENU_OBJECT_PATH)
 item(_GTK_MENUBAR_OBJECT_PATH)
+item(_GTK_FRAME_EXTENTS)
 item(_GNOME_WM_KEYBINDINGS)
 item(_GNOME_PANEL_ACTION)
 item(_GNOME_PANEL_ACTION_MAIN_MENU)


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