GNOME Bugzilla – Bug 747634
gdk_set_program_class() breaks --class
Last modified: 2015-05-12 09:45:56 UTC
See patch.
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().
Who is using --class, and why ? I'm not sure we really want to fix it up - I'd rather deprecate it...
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?
(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.
(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?
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 ?
(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.
(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.
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.
(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.
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...
(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.
Attachment 301299 [details] pushed as a8e5cac - Allow overriding WM_CLASS from the command line