After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722919 - Setting custom titlebar on realized window looks weird
Setting custom titlebar on realized window looks weird
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.10.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-01-24 14:51 UTC by Bastien Nocera
Modified: 2014-02-04 03:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
foo.c (529 bytes, text/plain)
2014-01-24 14:51 UTC, Bastien Nocera
  Details
screenshot (3.63 KB, image/png)
2014-01-24 14:52 UTC, Bastien Nocera
  Details
Re-realize the window if needed (1.39 KB, patch)
2014-01-24 19:33 UTC, Matthias Clasen
committed Details | Review

Description Bastien Nocera 2014-01-24 14:51:29 UTC
Created attachment 267130 [details]
foo.c

Test case and screenshot attached.
Comment 1 Bastien Nocera 2014-01-24 14:52:01 UTC
Created attachment 267131 [details]
screenshot
Comment 2 Matthias Clasen 2014-01-24 19:10:14 UTC
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 ?
Comment 3 Matthias Clasen 2014-01-24 19:33:23 UTC
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.
Comment 4 Bastien Nocera 2014-01-31 08:19:04 UTC
That works for me.
Comment 5 Bastien Nocera 2014-01-31 08:24:52 UTC
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.
Comment 6 Matthias Clasen 2014-02-04 03:39:25 UTC
Attachment 267149 [details] pushed as 365902c - Re-realize the window if needed