[mutter] frame: Put a MetaUIFrame* in our MetaFrame



commit 2413e672c853fa9fdf7706c66bd5760abc9a5b50
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Dec 31 21:55:36 2014 -0800

    frame: Put a MetaUIFrame* in our MetaFrame
    
    This is a small start, but it lets us start to clean up this
    UI split mess.

 src/core/frame.c |   20 +++++++++++---------
 src/core/frame.h |    4 ++++
 src/ui/frames.c  |    4 +++-
 src/ui/frames.h  |    6 +++---
 src/ui/ui.c      |   24 +++++++++++-------------
 src/ui/ui.h      |   13 +++++++------
 6 files changed, 39 insertions(+), 32 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index 264e615..41934d7 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -85,15 +85,17 @@ meta_window_ensure_frame (MetaWindow *window)
   else
     visual = NULL;
 
-  frame->xwindow = meta_ui_create_frame_window (window->screen->ui,
-                                                window->display->xdisplay,
-                                                visual,
-                                                frame->rect.x,
-                                                frame->rect.y,
-                                               frame->rect.width,
-                                               frame->rect.height,
-                                               frame->window->screen->number,
-                                                &create_serial);
+  frame->ui_frame = meta_ui_create_frame (window->screen->ui,
+                                          window->display->xdisplay,
+                                          visual,
+                                          frame->rect.x,
+                                          frame->rect.y,
+                                          frame->rect.width,
+                                          frame->rect.height,
+                                          frame->window->screen->number,
+                                          &create_serial);
+  frame->xwindow = frame->ui_frame->xwindow;
+
   meta_stack_tracker_record_add (window->screen->stack_tracker,
                                  frame->xwindow,
                                  create_serial);
diff --git a/src/core/frame.h b/src/core/frame.h
index d253773..8d70469 100644
--- a/src/core/frame.h
+++ b/src/core/frame.h
@@ -24,6 +24,8 @@
 
 #include "window-private.h"
 
+#include "ui/frames.h"
+
 struct _MetaFrame
 {
   /* window we frame */
@@ -50,6 +52,8 @@ struct _MetaFrame
   guint need_reapply_frame_shape : 1;
   guint is_flashing : 1; /* used by the visual bell flash */
   guint borders_cached : 1;
+
+  MetaUIFrame *ui_frame;
 };
 
 void     meta_window_ensure_frame           (MetaWindow *window);
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 1603a6f..095bb97 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -512,7 +512,7 @@ meta_frames_attach_style (MetaUIFrame *frame)
                                                                             variant));
 }
 
-void
+MetaUIFrame *
 meta_frames_manage_window (MetaFrames *frames,
                            Window      xwindow,
                            GdkWindow  *window)
@@ -544,6 +544,8 @@ meta_frames_manage_window (MetaFrames *frames,
   meta_core_grab_buttons (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow);
 
   g_hash_table_replace (frames->frames, &frame->xwindow, frame);
+
+  return frame;
 }
 
 void
diff --git a/src/ui/frames.h b/src/ui/frames.h
index f4a240e..de9853b 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -120,9 +120,9 @@ GType        meta_frames_get_type               (void) G_GNUC_CONST;
 
 MetaFrames *meta_frames_new (int screen_number);
 
-void meta_frames_manage_window (MetaFrames *frames,
-                                Window      xwindow,
-                               GdkWindow  *window);
+MetaUIFrame * meta_frames_manage_window (MetaFrames *frames,
+                                         Window      xwindow,
+                                         GdkWindow  *window);
 void meta_frames_unmanage_window (MetaFrames *frames,
                                   Window      xwindow);
 void meta_frames_set_title (MetaFrames *frames,
diff --git a/src/ui/ui.c b/src/ui/ui.c
index a00434f..880d7f4 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -342,16 +342,16 @@ set_background_none (Display *xdisplay,
                            CWBackPixmap, &attrs);
 }
 
-Window
-meta_ui_create_frame_window (MetaUI *ui,
-                             Display *xdisplay,
-                             Visual *xvisual,
-                            gint x,
-                            gint y,
-                            gint width,
-                            gint height,
-                            gint screen_no,
-                             gulong *create_serial)
+MetaUIFrame *
+meta_ui_create_frame (MetaUI *ui,
+                      Display *xdisplay,
+                      Visual *xvisual,
+                      gint x,
+                      gint y,
+                      gint width,
+                      gint height,
+                      gint screen_no,
+                      gulong *create_serial)
 {
   GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
   GdkScreen *screen = gdk_display_get_screen (display, screen_no);
@@ -410,9 +410,7 @@ meta_ui_create_frame_window (MetaUI *ui,
   gdk_window_resize (window, width, height);
   set_background_none (xdisplay, GDK_WINDOW_XID (window));
 
-  meta_frames_manage_window (ui->frames, GDK_WINDOW_XID (window), window);
-
-  return GDK_WINDOW_XID (window);
+  return meta_frames_manage_window (ui->frames, GDK_WINDOW_XID (window), window);
 }
 
 void
diff --git a/src/ui/ui.h b/src/ui/ui.h
index bf0a358..33d364a 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -31,6 +31,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 typedef struct _MetaUI MetaUI;
+typedef struct _MetaUIFrame MetaUIFrame;
 
 typedef gboolean (* MetaEventFunc) (XEvent *xevent, gpointer data);
 
@@ -58,14 +59,14 @@ void meta_ui_get_frame_mask (MetaUI *ui,
                              guint height,
                              cairo_t *cr);
 
-Window meta_ui_create_frame_window (MetaUI *ui,
+MetaUIFrame * meta_ui_create_frame (MetaUI *ui,
                                     Display *xdisplay,
                                     Visual *xvisual,
-                                   gint x,
-                                   gint y,
-                                   gint width,
-                                   gint height,
-                                   gint screen_no,
+                                    gint x,
+                                    gint y,
+                                    gint width,
+                                    gint height,
+                                    gint screen_no,
                                     gulong *create_serial);
 void meta_ui_destroy_frame_window (MetaUI *ui,
                                   Window  xwindow);


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