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 705640 - GtkWindow incorrectly requires a default screen
GtkWindow incorrectly requires a default screen
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 705638
 
 
Reported: 2013-08-07 20:38 UTC by Morten Welinder
Modified: 2017-08-31 19:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Window: Connect screen signals properly in init() (1.79 KB, patch)
2017-08-31 19:23 UTC, Daniel Boles
committed Details | Review

Description Morten Welinder 2013-08-07 20:38:03 UTC
gtk_window_init now depends on a default screen.  This was introduced with
the code:

#ifdef GDK_WINDOWING_X11
  g_signal_connect (gtk_settings_get_for_screen (priv->screen),
                    "notify::gtk-application-prefer-dark-theme",
                    G_CALLBACK (gtk_window_on_theme_variant_changed), window);
#endif

Note, that the code immediately before specifically checks for priv->screen
being non-NULL before attaching a signal.


There also seems to be some mismatch between this code and code in
gtk_window_finalize.  The signal is connected to one object and appears
to be be disconnected from a different object.  At the very least it looks
weird.
Comment 1 Daniel Boles 2017-08-29 23:25:23 UTC
(In reply to Morten Welinder from comment #0)
> Note, that the code immediately before specifically checks for priv->screen
> being non-NULL before attaching a signal.

Yeah, that X11-specific connection really should be made in that above if(priv->screen) block too. Every other related bit that's X11-specific does this.


It's not clear why this is only done in X11, but I don't know the background.


> There also seems to be some mismatch between this code and code in
> gtk_window_finalize.  The signal is connected to one object and appears
> to be be disconnected from a different object.  At the very least it looks
> weird.

It looks OK to me.
Comment 2 Daniel Boles 2017-08-31 19:14:11 UTC
Yeah, no, it is weird: init() uses g_signal_connect, while set_screen() uses g_signal_connect_object, which is strangely inconsistent.

Presumably we can make both sites use connect_object(), then remove the manually disconnect_by_func()s from finalize(). Or the converse: use connect() for both.
Comment 3 Daniel Boles 2017-08-31 19:23:04 UTC
Created attachment 358885 [details] [review]
Window: Connect screen signals properly in init()

Do not connect to get_settings_for_screen() if we have no screen…

Use g_signal_connect(), not connect_object(), to match how set_screen()
makes these same connections, and how finalize() already disconnects.