diff options
author | monsta <[email protected]> | 2019-07-30 11:50:34 +0300 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-09-12 15:14:51 +0200 |
commit | 44c20584f3b64163126d7846beb61825efd02d64 (patch) | |
tree | 4f9a2b42891fff3d1f99bb70740b4e9a697940d8 /src/ui/frames.c | |
parent | b2898238f715a67d6e560a10e5894a04ee3455c9 (diff) | |
download | marco-44c20584f3b64163126d7846beb61825efd02d64.tar.bz2 marco-44c20584f3b64163126d7846beb61825efd02d64.tar.xz |
frames: apply modified hack from Mutter/Metacity
- this will be needed for proper window decoration color updates on theme change
when theme variants fixes are applied
- realize/unrealize functions are dropped instead of map/unmap ones, because
we didn't change these during GTK+3 porting
- MetaFrames now has GtkWindow as parent instead of GtkInvisible, otherwise
the hack doesn't work (revert part of 96c7256d638b8c76c8abf786ba307e82a595dd67)
adapted from:
https://github.com/GNOME/metacity/commit/ba8500663457ad9f18ebfdf405162c2cb5caf88f
Diffstat (limited to 'src/ui/frames.c')
-rw-r--r-- | src/ui/frames.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c index 74e97a30..52001c7d 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -42,7 +42,7 @@ #include <cairo-xlib.h> -G_DEFINE_TYPE (MetaFrames, meta_frames, GTK_TYPE_INVISIBLE); +G_DEFINE_TYPE (MetaFrames, meta_frames, GTK_TYPE_WINDOW); #define DEFAULT_INNER_BUTTON_BORDER 3 @@ -51,8 +51,6 @@ static void meta_frames_init (MetaFrames *frames); static void meta_frames_destroy (GtkWidget *object); static void meta_frames_finalize (GObject *object); static void meta_frames_style_updated (GtkWidget *widget); -static void meta_frames_realize (GtkWidget *widget); -static void meta_frames_unrealize (GtkWidget *widget); static void meta_frames_update_prelit_control (MetaFrames *frames, MetaUIFrame *frame, @@ -131,8 +129,6 @@ meta_frames_class_init (MetaFramesClass *class) gobject_class->finalize = meta_frames_finalize; widget_class->destroy = meta_frames_destroy; widget_class->style_updated = meta_frames_style_updated; - widget_class->realize = meta_frames_realize; - widget_class->unrealize = meta_frames_unrealize; widget_class->draw = meta_frames_draw; widget_class->destroy_event = meta_frames_destroy_event; @@ -620,12 +616,25 @@ MetaFrames* meta_frames_new (void) { GdkScreen *screen; + MetaFrames *frames; screen = gdk_display_get_default_screen (gdk_display_get_default ()); - return g_object_new (META_TYPE_FRAMES, - "screen", screen, - NULL); + frames = g_object_new (META_TYPE_FRAMES, + "screen", screen, + "type", GTK_WINDOW_POPUP, + NULL); + + /* Put the window at an arbitrary offscreen location; the one place + * it can't be is at -100x-100, since the meta_window_new() will + * mistake it for a window created via meta_create_offscreen_window() + * and ignore it, and we need this window to get frame-synchronization + * messages so that GTK+'s style change handling works. + */ + gtk_window_move (GTK_WINDOW (frames), -200, -200); + gtk_window_resize (GTK_WINDOW (frames), 1, 1); + + return frames; } /* In order to use a style with a window it has to be attached to that @@ -734,20 +743,6 @@ meta_frames_unmanage_window (MetaFrames *frames, meta_warning ("Frame 0x%lx not managed, can't unmanage\n", xwindow); } -static void -meta_frames_realize (GtkWidget *widget) -{ - if (GTK_WIDGET_CLASS (meta_frames_parent_class)->realize) - GTK_WIDGET_CLASS (meta_frames_parent_class)->realize (widget); -} - -static void -meta_frames_unrealize (GtkWidget *widget) -{ - if (GTK_WIDGET_CLASS (meta_frames_parent_class)->unrealize) - GTK_WIDGET_CLASS (meta_frames_parent_class)->unrealize (widget); -} - static MetaUIFrame* meta_frames_lookup_window (MetaFrames *frames, Window xwindow) |