diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2014-03-05 15:23:46 -0500 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2015-01-19 05:08:34 +0200 |
commit | ba8500663457ad9f18ebfdf405162c2cb5caf88f (patch) | |
tree | 20a35072aa9445b42b56c46c14852013348a192f /src | |
parent | 7e7f25f40ce3b15cbc63d6e8743215e287f08710 (diff) | |
download | metacity-ba8500663457ad9f18ebfdf405162c2cb5caf88f.tar.gz |
Fix handling of dynamic updates to colors/font/etc.
Since the introduction of frame sync in GTK+, updates to titlebar font and
colors haven't been working because GTK+ counts on the frame clock to
do style updates, and the frame clock doesn't run for an unmapped
GdkWindow. (It's possible that GtkStyleContext changes subsequent to
the introduction of the frame clock were also needed to fully break
things.)
We actually need to map the MetaFrames GdkWindow and let the
compositor code send out the frame sync messages in order to pick up
style changes.
Hopefully no bad side effects will occur from this - we make the window
override-redirect, 1x1, and outside the bounds of the screen.
https://bugzilla.gnome.org/show_bug.cgi?id=725751
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/frames.c | 36 | ||||
-rw-r--r-- | src/ui/ui.c | 9 |
2 files changed, 22 insertions, 23 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c index a1db4bf3..74c93389 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -45,8 +45,6 @@ static void meta_frames_destroy (GtkWidget *widget); static void meta_frames_finalize (GObject *object); static void meta_frames_style_updated (GtkWidget *widget); -static void meta_frames_map (GtkWidget *widget); -static void meta_frames_unmap (GtkWidget *widget); static void meta_frames_update_prelit_control (MetaFrames *frames, MetaUIFrame *frame, @@ -137,9 +135,6 @@ meta_frames_class_init (MetaFramesClass *class) widget_class->destroy = meta_frames_destroy; widget_class->style_updated = meta_frames_style_updated; - widget_class->map = meta_frames_map; - widget_class->unmap = meta_frames_unmap; - widget_class->draw = meta_frames_draw; widget_class->destroy_event = meta_frames_destroy_event; widget_class->button_press_event = meta_frames_button_press_event; @@ -611,13 +606,26 @@ MetaFrames* meta_frames_new (int screen_number) { GdkScreen *screen; + MetaFrames *frames; screen = gdk_display_get_screen (gdk_display_get_default (), screen_number); - 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 @@ -732,18 +740,6 @@ meta_frames_unmanage_window (MetaFrames *frames, meta_warning ("Frame 0x%lx not managed, can't unmanage\n", xwindow); } -static void -meta_frames_map (GtkWidget *widget) -{ - gtk_widget_set_mapped (widget, TRUE); -} - -static void -meta_frames_unmap (GtkWidget *widget) -{ - gtk_widget_set_mapped (widget, FALSE); -} - static MetaUIFrame* meta_frames_lookup_window (MetaFrames *frames, Window xwindow) diff --git a/src/ui/ui.c b/src/ui/ui.c index e4a54f82..2cd8559e 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -277,9 +277,12 @@ meta_ui_new (Display *xdisplay, g_assert (xdisplay == GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); ui->frames = meta_frames_new (XScreenNumberOfScreen (screen)); - /* This does not actually show any widget. MetaFrames has been hacked so - * that showing it doesn't actually do anything. But we need the flags - * set for GTK to deliver events properly. */ + /* GTK+ needs the frame-sync protocol to work in order to properly + * handle style changes. This means that the dummy widget we create + * to get the style for title bars actually needs to be mapped + * and fully tracked as a MetaWindow. Horrible, but mostly harmless - + * the window is a 1x1 overide redirect window positioned offscreen. + */ gtk_widget_show (GTK_WIDGET (ui->frames)); g_object_set_data (G_OBJECT (gdisplay), "meta-ui", ui); |