GNOME Bugzilla – Bug 722919
Setting custom titlebar on realized window looks weird
Last modified: 2014-02-04 03:39:28 UTC
Created attachment 267130 [details] foo.c Test case and screenshot attached.
Created attachment 267131 [details] screenshot
The documentation says: * Depending on the system, this function may not work for a window * that is already visible, so you set the titlebar before calling * gtk_widget_show(). We could extend this to require you call it before realize - which we probably should, since we indirectly end up calling gtk_widget_set_visual() which doesn't have any effect after realize. Of course, we do now default to rgba, so it will still work most of the time. Is it impractical for you to call set_titlebar before realize ?
Created attachment 267149 [details] [review] Re-realize the window if needed When gtk_window_set_titlebar is called, we need to set up client-side decorations properly, and the easiest way to do so is to realize the window again. Really, you should call set_titlebar before the window is realized.
That works for me.
Without this patch, I can't run this hack in Totem: /* FIXME: Otherwise we get a visible but * not realized widget ?!?! */ gtk_widget_realize (GTK_WIDGET (totem->bvw)); Which causes the invisible page in the GtkStack containing the player to be visible, but not mapped nor realized. (In reply to comment #2) > The documentation says: > > * Depending on the system, this function may not work for a window > * that is already visible, so you set the titlebar before calling > * gtk_widget_show(). > > We could extend this to require you call it before realize I'm fine with a warning or a critical, which is probably less invasive.
Attachment 267149 [details] pushed as 365902c - Re-realize the window if needed