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 747634 - gdk_set_program_class() breaks --class
gdk_set_program_class() breaks --class
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-04-10 15:21 UTC by Lars Karlitski
Modified: 2015-05-12 09:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow overriding WM_CLASS from the command line (1.62 KB, patch)
2015-04-10 15:21 UTC, Lars Karlitski
committed Details | Review

Description Lars Karlitski 2015-04-10 15:21:47 UTC
See patch.
Comment 1 Lars Karlitski 2015-04-10 15:21:53 UTC
Created attachment 301299 [details] [review]
Allow overriding WM_CLASS from the command line

Even when the program itself calls gdk_set_program_class(). There's
currently no way for this function to be called without breaking gdk's
--class command line option, because you cannot call it before
gtk_init().
Comment 2 Matthias Clasen 2015-04-10 17:44:00 UTC
Who is using --class, and why ? I'm not sure we really want to fix it up - I'd rather deprecate it...
Comment 3 Lars Karlitski 2015-04-13 06:53:49 UTC
We have a lot of users that have custom desktop files for gnome terminal profiles. To make them appear as separate applications in the launcher and alt-tab dialog, they pass --class with some id.

This is not necessary with the newest versions of terminal anymore, because it has --app-id. We do want to keep backwards compatibility for a while though. We'll likely print a warning at some point to ease the transition.

When do you plan on deprecating --class?
Comment 4 Matthias Clasen 2015-04-13 10:47:17 UTC
(In reply to Lars Uebernickel from comment #3)
 
> When do you plan on deprecating --class?

Because commandline arguments for libraries are awkward, and almost all of them have environment variable alternatives.
Comment 5 Lars Karlitski 2015-04-13 11:15:13 UTC
(In reply to Matthias Clasen from comment #4)
> (In reply to Lars Uebernickel from comment #3)
>  
> > When do you plan on deprecating --class?
> 
> Because commandline arguments for libraries are awkward, and almost all of
> them have environment variable alternatives.

I asked "when".

I totally agree with your reasoning and only proposed this patch to keep backwards compatibility.

What do you think about making --class a no-op with a deprecation warning instead?
Comment 6 Matthias Clasen 2015-04-13 12:59:16 UTC
oh, missed the when. This cycle, I guess ?

I am ok with keeping them working in the meantime (until 4.0), but is this case here recent breakage ? Hasn't this always been the case ?
Comment 7 Lars Karlitski 2015-04-13 13:17:49 UTC
(In reply to Matthias Clasen from comment #6)
> oh, missed the when. This cycle, I guess ?
> 
> I am ok with keeping them working in the meantime (until 4.0), but is this
> case here recent breakage ? Hasn't this always been the case ?

Yes, this bug has always existed, but gnome-terminal hasn't called gdk_set_program_class() forever. We just updated to a recent version of it in Ubuntu, which is why we noticed.

I guess not many other applications call that function and not many users need --class.
Comment 8 Iain Lane 2015-04-16 11:10:40 UTC
(In reply to Matthias Clasen from comment #6)
> […]
> I am ok with keeping them working in the meantime (until 4.0), but is this
> case here recent breakage ? Hasn't this always been the case ?

If you're okay, can we take a patch like this one then? With a deprecation warning, if you like. I'd like to keep cases like gnome-terminal working if possible.
Comment 9 Matthias Clasen 2015-04-16 13:37:27 UTC
Maybe that is a stupid question, but why can't you call gdk_set_program_class before gtk_init() ? Just us declaring such use illegal ?

We could just add a not to the docs that it is ok to do so, like we have for gdk_disable_multidevice right below it.

And with that it becomes a gnome-terminal problem instead of a gtk+ problem.
Comment 10 Lars Karlitski 2015-04-16 14:18:47 UTC
(In reply to Matthias Clasen from comment #9)
> Maybe that is a stupid question, but why can't you call
> gdk_set_program_class before gtk_init() ? Just us declaring such use illegal
> ?

I thought about that as well, but the global 'gdk_progclass' is set in gtk_init (through gdk_pre_parse_libgtk_only). Apparently it's done that way so that --name doesn't override it.
Comment 11 Matthias Clasen 2015-04-16 18:56:12 UTC
I have to admit that I am still a little confused why you are trying to fix a gnome-terminal change by applying a patch in GTK+. If gnome-terminal is wrong to set the class, then it should not do that... looking at gnome-terminal git, there has been quite a bit of back-and-forth there wrt to wm class...
Comment 12 Lars Karlitski 2015-04-17 09:50:02 UTC
(In reply to Matthias Clasen from comment #11)
> I have to admit that I am still a little confused why you are trying to fix
> a gnome-terminal change by applying a patch in GTK+. If gnome-terminal is
> wrong to set the class, then it should not do that... looking at
> gnome-terminal git, there has been quite a bit of back-and-forth there wrt
> to wm class...

Because it's a bug in gtk. An application cannot call gdk_set_program_class() without breaking --class. So effectively, it can't ever call it.

We only noticed this bug because gnome-terminal started calling this function.
Comment 13 Matthias Clasen 2015-05-11 02:41:07 UTC
Attachment 301299 [details] pushed as a8e5cac - Allow overriding WM_CLASS from the command line