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 721304 - GtkApplicationX11: read the startup ID from the platform data
GtkApplicationX11: read the startup ID from the platform data
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkApplication
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-01-01 15:55 UTC by Giovanni Campagna
Modified: 2015-07-05 19:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkApplicationX11: read the startup ID from the platform data (1.94 KB, patch)
2014-01-01 15:55 UTC, Giovanni Campagna
committed Details | Review
GtkApplicationX11: try to reuse the startup ID when remote (2.59 KB, patch)
2014-01-01 16:12 UTC, Giovanni Campagna
rejected Details | Review

Description Giovanni Campagna 2014-01-01 15:55:46 UTC
If the platform data passed with actions and activations includes
a startup notify ID, we should read it and pass it down to GDK.
This ensures that the right startup notify is completed after the
signal emission, and that the user time of the GdkDisplay is properly
updated (which in turn makes sure the windows are not subjected
to focus-stealing-prevention)
Comment 1 Giovanni Campagna 2014-01-01 15:55:50 UTC
Created attachment 265105 [details] [review]
GtkApplicationX11: read the startup ID from the platform data
Comment 2 Giovanni Campagna 2014-01-01 16:12:49 UTC
Created attachment 265106 [details] [review]
GtkApplicationX11: try to reuse the startup ID when remote

If the application is remote, but initialized gdk already (thus
clearing the DESKTOP_STARTUP_ID variable), try to obtain a startup
ID from the GdkDisplay and pass that on.
Comment 3 Allison Karlitskaya (desrt) 2014-01-01 19:33:02 UTC
Review of attachment 265105 [details] [review]:

This one is fine.  It's pretty much what we had before the re-factor, but it was accidentally dropped.  Thanks for the catch.
Comment 4 Allison Karlitskaya (desrt) 2014-01-01 19:35:31 UTC
Review of attachment 265106 [details] [review]:

Not so happy about this one.  What kind of apps are calling gtk_init() themselves?  That's just wrong...

Even if we were to accept this, I'd want it to be done via the impl backend anyway -- if gtk_init() has run then we already have a default display and then we'd be capable of choosing the backend based on that so we could move up the creating of the impl.

I still think it's incorrect, however.
Comment 5 Matthias Clasen 2014-01-02 15:23:49 UTC
If it is incorrect, shouldn't gtk_application_run issue a warning if gtk_init has already been called ?

I think we have to evaluate what causes people to call gtk_init ahead of time - what gtk calls are needed before entering gtk_application_run ?
Comment 6 Allison Karlitskaya (desrt) 2014-01-02 15:28:32 UTC
That's a good suggestion.  Probably just a critical message (with no return) would be enough to get most people to notice, and then we might also get some bugs from people about it (and can help them through their perceived problem, or discover their legitimate need).
Comment 7 Christian Persch 2014-01-02 17:54:14 UTC
Calling gtk_init (e.g. through gtk_get_option_group() and pre-parsing args) should be supported, IMO. E.g. gnome-terminal first parses args, then creates a GtkApplication and runs it (with NULL passed as argv).
Comment 8 Jasper St. Pierre (not reading bugmail) 2014-01-02 20:06:25 UTC
Doesn't e.g. clutter_gtk_init or cheese_gtk_init or others (GStreamer?) require that gtk_init be called first?
Comment 9 Giovanni Campagna 2014-01-02 20:20:33 UTC
Comment on attachment 265105 [details] [review]
GtkApplicationX11: read the startup ID from the platform data

Attachment 265105 [details] pushed as cecb2fa - GtkApplicationX11: read the startup ID from the platform data

Jasper, in theory all the _init() stuff should be called from GtkApplication::startup.
The problem, if any, is init() stuff that is called behind your back (like pygobject's
Gtk module)
Comment 10 Jasper St. Pierre (not reading bugmail) 2015-07-05 19:30:20 UTC
This was left open by accident, it seems.