Closed Bug 196238 Opened 23 years ago Closed 7 years ago

GTK, GTK2 initialize X properties to "mozilla-bin"

Categories

(Core :: XUL, defect)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: kherron+mozilla, Assigned: blizzard)

Details

Attachments

(1 file)

The GTK+ toolkit initializes several values from the name of the program, e.g. "/path/to/mozilla-bin". Specifically the following items are based on argv[0]: * The WM_CLASS for the application top-level window. The gnome-panel window list (taskbar) utility uses this for the button label when it groups several windows under one task button. * The initial WM_CLASS for other windows opened by mozilla. There are bugs about setting WM_CLASS for new windows (see bug 29856 and bug 194299), but the patches submitted so far don't catch all cases, e.g. alert windows. * The WM_COMMAND property for the top-level window. This is the command a session manager could use to restart mozilla. It's set to "/path/to/mozilla-bin", which is wrong since mozilla should be launched through a frontend. Mozilla should use the application's canonical name, i.e. "mozilla", for these things, and supply a useful command to WM_COMMAND. How to reproduce: 1) The app's top-level window isn't a visible window. To inspect it, run "xlsclients -l" and look for the mozilla entry. It should look something like the following: Window 0x5800001: Machine: piggies Command: /opt/mozilla/mozilla-bin Instance/Class: mozilla-bin/Mozilla-bin 2) You can then run xprop on the window if you like: $ xprop -id 0x5800001 WM_LOCALE_NAME(STRING) = "C" WM_CLASS(STRING) = "mozilla-bin", "Mozilla-bin" WM_CLIENT_MACHINE(STRING) = "piggies" WM_COMMAND(STRING) = { "/opt/mozilla/mozilla-bin" } 3) Launch mozilla under gnome, using a gnome-panel running the window list applet. Once mozilla is launched, open several windows with ctrl-N. The window list applet will eventually coalesce all of the mozilla windows under a single button labelled "Mozilla-bin". I believe this label comes from the top-level window's WM_CLASS. See also the Inter-client conventions manual at <http://tronche.com/gui/x/icccm/>. WM_CLASS is discussed in section 4. WM_COMMAND is in appendix C (obsolete properties) but since GTK+ sets it, mozilla should try to make the value useful.
This patch makes two changes: 1) Inside the "mozilla" script, set MOZ_LAUNCHER to the argv[0] used to launch the script. 2) Inside mozilla-bin's main(), replace argv[0] with the value of MOZ_LAUNCHER just before calling gtk_init(). This causes gtk to initialize based on the name of the frontend rather than the incidental name of the final executable.
Attachment #116480 - Flags: review?(blizzard)
See also bug 192263. The issue described there is probably KDE storing the useless WM_COMMAND value, then later trying to use it to restart mozilla.
to Chris
Assignee: jaggernaut → blizzard
Status: UNCONFIRMED → NEW
Ever confirmed: true
Also same as bug 180319, BTW.
Comment on attachment 116480 [details] [diff] [review] Set argv[0] to the name of the launcher relevant code lives in toolkit now (xpfe/bootstrap is going away on trunk)
Attachment #116480 - Flags: review?(blizzard)
Closing GTK2 related bugs since we removed GTK2 support at the beginning of 2018 in bug 1278282. Probably best to open a new bug in the unlikely event that any of these are still relevant.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: