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 128380 - _NET_ACTIVE_WINDOW does more than just activating a window
_NET_ACTIVE_WINDOW does more than just activating a window
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: EWMH specification
2.6.x
Other Linux
: High minor
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
: 168201 171543 (view as bug list)
Depends on:
Blocks: 161361
 
 
Reported: 2003-12-02 17:44 UTC by Lubos Lunak
Modified: 2005-07-24 01:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Metacity patch to fix the problem (1.86 KB, patch)
2005-02-16 09:16 UTC, Elijah Newren
accepted-commit_now Details | Review

Description Lubos Lunak 2003-12-02 17:44:21 UTC
After receiving _NET_ACTIVE_WINDOW, Metacity not only activates the window, but also 
moves it to the current desktop (instead of switching to its desktop). As other WMs I 
tried only activate the window after receiving this message, which I find more logical, I 
consider this Metacity's feature to be a bug. See 
http://mail.gnome.org/archives/wm-spec-list/2003-October/msg00062.html for full 
details. As there were no comments on it, I think this is now the place where it should be 
solved.
Comment 1 Havoc Pennington 2003-12-03 02:49:12 UTC
I'm OK with changing this in metacity, I can't think of a reason why
not really. We need to fix the tasklist at the same time.
Comment 2 Elijah Newren 2005-02-04 06:13:05 UTC
We really need to get this fixed.  I'll look into it soon; bumping up the
priority so it doesn't get lost...
Comment 3 Elijah Newren 2005-02-16 09:16:25 UTC
Created attachment 37532 [details] [review]
Metacity patch to fix the problem

I'm going to attach the libwnck portion of the patch to bug 161361 because I
have combined it with patches for two other things (the three libwnck patches
would have conflicted because they are modifying the same parts of the code and
are doing fairly similar things so it made sense to not separate them).
Comment 4 Havoc Pennington 2005-02-20 20:40:49 UTC
Comment on attachment 37532 [details] [review]
Metacity patch to fix the problem

thanks!
Comment 5 Elijah Newren 2005-02-20 22:44:53 UTC
committed:

2005-02-20  Elijah Newren  <newren@gmail.com>

	* src/window.c: (meta_window_activate): when receiving a
	_NET_ACTIVE_WINDOW message, switch to the desktop where the window
	is located before activating instead of moving the window to the
	current desktop.  Thanks to Lubos Lunak for catching this issue.
	Fixes #128380.
Comment 6 Elijah Newren 2005-02-23 00:25:32 UTC
*** Bug 168201 has been marked as a duplicate of this bug. ***
Comment 7 Alex Graveley 2005-03-24 09:28:01 UTC
This change really badly breaks Tomboy and Nautilus.  How do I work around this?
Comment 8 Elijah Newren 2005-03-24 15:36:53 UTC
If you _need_ the window to be moved to the current workspace instead of
changing the current workspace to the one where the window is, then you need to
use a _NET_WM_DESKTOP message instead of a _NET_ACTIVE_WINDOW message.  This is
either an application bug or a gtk+ bug (depending on your view of what
gtk_window_present should do).  See also bug 166379.

Either way, this metacity change was correct so I'm reclosing.
Comment 9 Alex Graveley 2005-03-25 01:15:02 UTC
From docs on gtk_window_present:

 * This function should be used when the user tries to open a window
 * that's already open. Say for example the preferences dialog is
 * currently open, and the user chooses Preferences from the menu
 * a second time; use gtk_window_present() to move the already-open dialog
 * where the user can see it.

And an inline comment:

      /* note that gdk_window_focus() will also move the window to
       * the current desktop, for WM spec compliant window managers.
       */

Congrats, you broke ABI.
Comment 10 Rob Adams 2005-03-25 01:24:59 UTC
gdk_window_present is the api for sending _NET_ACTIVE_WINDOW for the window.  It
still does that; nothing has changed.

Its up to the window manager to decide what to do with this information. 
Previously, metacity handled it differently from other window managers.  Now, it
handles it similarly to other window managers.
Comment 11 Alex Graveley 2005-03-25 01:35:15 UTC
I do not see _NET_ACTIVE_WINDOW mentioned in gtk_window_present doco anywhere.
Comment 12 Rob Adams 2005-03-25 01:44:55 UTC
The documentation is wrong and should probably be updated, though you'll need a
new bug for that.  Of course, if your application is broken now because of the
change, it means that it was previously broken under every window manager that
isn't metacity.  Now, at least, you can fix it so it'll work for every window
manager.
Comment 13 Billy Biggs 2005-03-25 01:47:45 UTC
FWIW, the (weird) metacity behaviour was already causing problems for some
applications (https://bugs.eclipse.org/bugs/show_bug.cgi?id=82387).
Comment 14 Elijah Newren 2005-03-25 02:00:20 UTC
(mid-air collision, but I'll send it anyway...)

Hi Alex,

You have spent an awful lot of time in email and bugzilla today.  You could have
put a lot of that time into actually fixing stuff.  At very least you could have
avoided demotivating others from helping with your tone.  Anyway, your claims
are based on misconstruing the comments and are not accurate.  In particular,
the start of the comment defining the functionality of gtk_window_present()
which you neglected to mention is the following:

 * Presents a window to the user. This may mean raising the window
 * in the stacking order, deiconifying it, moving it to the current
 * desktop, and/or giving it the keyboard focus, possibly dependent
 * on the user's platform, window manager, and preferences.

This makes it absolutely clear that the behavior depends on the window manager.
 You tried to base your claim about functionality off only the last half of the
comments (which doesn't say what you need) along with an inline comment from the
middle of the code.  Yes, it is unfortunate that the comment from the middle of
the code was wrong, but it is not part of the definition of the function or part
of the API/ABI guarantee.  (If it was, gtk+ was buggy because past versions
would have been broken on most window managers; it would have only worked for
people using Metacity by relying on this bug existing).

In summary, this change was correct, it was needed, and it didn't break ABI.  As
I said before, we may want to change gtk_window_present to use _NET_WM_DESKTOP
(bug 166379).  But that's a different bug.
Comment 15 Elijah Newren 2005-03-25 02:16:32 UTC
I shouldn't respond when frustrated, especially when lots of that frustration
was due to other stuff.   Sorry for being so excessively harsh, Alex.  You're
probably just frustrated too from trying to debug stuff.  Anyway, if you need a
temporary workaround to call (while waiting for gtk_window_present to change, if
it does), I can help you write a modified version that makes use of _NET_WM_DESKTOP.
Comment 16 Sebastien Bacher 2005-06-04 19:49:57 UTC
*** Bug 171543 has been marked as a duplicate of this bug. ***
Comment 17 Elijah Newren 2005-07-24 01:34:07 UTC
This patch is being reverted.  This has been discussed at 
http://mail.gnome.org/archives/wm-spec-list/2005-July/msg00028.html; since Lubos
drop his objection about possible breakage of taskbars after my explanation,
there seems to be no problems with reverting.  So, I'm doing it now.

The basic reasoning for the reverting of this patch was because keeping it would
mean introducing policy to the _NET_ACTIVE_WINDOW message (one which we don't
like and which others might not either), resulting in some apps (e.g. all gtk+
ones that use gtk_window_present() for activation) trying to send additional
messages to enforce the policy they like while others just use the
_NET_ACTIVE_WINDOW message.  In other words, the patch induced inconsistency
among apps from different toolkits.

If anyone has issues they believe are related to this, please open a new bug. 
This note is mostly for completeness.

Reverted on both the gnome-2-10 branch and HEAD.  New 2.10.x release (2.10.3)
just sent out.