diff options
-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); |