Bug 307581

Summary: apps jump workspaces when urls opened
Product: [Fedora] Fedora Reporter: Bill Nottingham <notting>
Component: metacityAssignee: Søren Sandmann Pedersen <sandmann>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 7CC: adam, cra, davidz, gecko-bugs-nobody, jturner, kem, lmacken, mauricio, me, petersen, p.van.egdom, rstrode, rvokal, triage, walters, xgl-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-06-02 19:17:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
partial fix for firefox none

Description Bill Nottingham 2007-09-26 18:09:57 UTC
Description of problem:

When I open a new tab (via right click on a terminal, clicking on something in
liferea, whatever), firefox immediately jumps onto the current workspace.

This is irritating. 

Version-Release number of selected component (if applicable):

firefox-2.0.0.6-11.fc8

Additional info:

Seems related to the startup notification patch, as it worked ok in 2.0.0.6-8.fc8.

Comment 1 Adam Goode 2007-10-01 00:17:03 UTC
I will second this. Very irritating!

Comment 2 Christopher Aillon 2007-10-01 19:22:40 UTC
Owen says this is a metacity bug.  The following program also hops windows.

#!/bin/env python

import gtk
import gobject
w = gtk.Window()
w.set_title("Foo")
w.show()

def on_timeout():
        w.present()
        return False

gobject.timeout_add(5000, on_timeout)
gtk.main()


Comment 3 Christopher Aillon 2007-10-01 19:23:35 UTC
er, hops workspaces

Comment 4 Colin Walters 2007-10-01 19:34:29 UTC
To give some background on this issue, Firefox now supports startup notification:
https://bugzilla.mozilla.org/show_bug.cgi?id=223492

The issue in this bug only occurs when there are multiple workspaces.

Removing this Firefox patch would be a regression in the single workspace case
because it would require clicking on a flashing browser entry in the task list
after activating an external link.

From IRC:

<owen> walters: metacity could look at the window role and alter the behavior
based on that



Comment 5 Bill Nottingham 2007-10-01 19:48:25 UTC
FWIW, commenting out the call to gdk_window_focus() in the patch makes it DTRT
for me.

Comment 6 Owen Taylor 2007-10-01 20:00:33 UTC
Actually, what I meant was that based on the "type" of the window application
vs. dialog, you could do different things.

A application never, under any circumstances, should be moved between desktops.


Comment 7 Colin Walters 2007-10-01 20:03:13 UTC
Bill, what effect does that have in the single-workspace case?

Comment 8 Colin Walters 2007-10-01 20:04:24 UTC
Also, I've filed this bug upstream here:

http://bugzilla.gnome.org/show_bug.cgi?id=482354

Since there seems to be agreement this is an upstream Metacity issue, please
continue discussion there.


Comment 9 Bill Nottingham 2007-10-01 20:10:27 UTC
Colin: when it's on the same workspace, I get the throbbing entry in the panel.
When it's on the other workspace, I don't.

Comment 10 David Zeuthen 2007-10-11 20:06:50 UTC
We need to fix this for F8...

Comment 11 Jeremy Katz 2007-10-11 21:48:48 UTC
This is also happening in compiz... so more than just metacity at work here.

Comment 12 Christopher Aillon 2007-10-11 23:26:44 UTC
Jeremy: not quite...

in metacity, the _window_ switches to the current workspace.

In compiz, the _active workspace_ switches.

This is about the metacity issue, which everyone agrees is clearly wrong.  The
compiz behavior seems more or less sane.  While different, i've already gotten
used to it.

Comment 13 Matthias Clasen 2007-10-12 03:06:19 UTC
The long discussion leading to the current metacity behaviour can be found 
here: http://bugzilla.gnome.org/show_bug.cgi?id=166379

Comment 14 Bill Nottingham 2007-10-12 04:48:32 UTC
So, going back to the beginning. The original patch (for firefox) has the
following comments usptream from Elijah
(https://bugzilla.mozilla.org/show_bug.cgi?id=223492#c31):

************
>+    if (desktopStartupID.IsEmpty()) {
>+        PRUint32 timestamp = GTKToolkit->GetFocusTimestamp();
>+        if (timestamp) {
>+            gdk_window_focus(aWindow->window, timestamp);
>+            GTKToolkit->SetFocusTimestamp(0);
>+        }
>+        return;
>+    }

This block of SetUserTimeAndStartupIDForActivatedWindow() is a little
confusing.  It doesn't set the user time or the startup id for the activated
window.  Instead, it sends an "activate me, please" message to the window
manager.  I understand it's just a workaround when no startup id is available
(because either firefox wasn't launched with startup-notification or wasn't
built with MOZ_ENABLE_STARTUP_NOTIFICATION), but it'd be nice to have it
documented as such.  It'd also be good to verify in testing that this block of
code isn't being executed (i.e. that startup id is non-empty), since it is just
a workaround.
*****************

I find it odd that the supposed 'workaround' part of the code is what's causing
the problem in my testing.

Comment 15 Bill Nottingham 2007-10-12 06:34:52 UTC
Created attachment 225081 [details]
partial fix for firefox

Note that due to missing changes to the configury, we aren't even *building*
the SN support at the moment - this patch fixes that.

Doesn't change the behavior, though.

Comment 16 David Zeuthen 2007-10-17 20:15:02 UTC
"This is not a blocker"

Comment 17 Jens Petersen 2007-10-18 04:33:20 UTC
<notting> halfline: why not just take the patch out of ff, since we're not even
applying it in a way that works
<juhp> notting: exactly
<halfline> notting: that's not a horrible idea
 notting: might be worth talking to stransky about
 or caillon if he pops on

Comment 18 Bill Nottingham 2007-10-18 15:32:34 UTC
*** Bug 337721 has been marked as a duplicate of this bug. ***

Comment 19 Colin Walters 2007-10-18 20:33:15 UTC
Note there is now a patch for metacity upstream at:
http://bugzilla.gnome.org/show_bug.cgi?id=482354#c2

Comment 20 Colin Walters 2007-10-18 21:25:49 UTC
Also in response to:

<notting> halfline: why not just take the patch out of ff, since we're not even
applying it in a way that works

The patch does function as expected in the single workspace case, even if it may
be entering into a fallback section of the code (will investigate).


Comment 21 Colin Walters 2007-10-19 00:15:15 UTC
I have built a new version of metacity with the patch:
http://koji.fedoraproject.org/koji/buildinfo?buildID=21629

Please test, if it works well then we can reable to re-enable the Firefox fix.

Comment 22 Bill Nottingham 2007-10-19 00:33:39 UTC
(In reply to comment #20)
> Also in response to:
> 
> <notting> halfline: why not just take the patch out of ff, since we're not even
> applying it in a way that works
> 
> The patch does function as expected in the single workspace case, even if it may
> be entering into a fallback section of the code (will investigate).

The patch adds configury for using libstartupnotification, and ifdef'd code to
use libsn. We then build moz without sn support. If it's functioning, it's
completely by accident.


Comment 23 Jens Petersen 2007-10-19 00:52:52 UTC
(In reply to comment #21)
> I have built a new version of metacity with the patch:
> http://koji.fedoraproject.org/koji/buildinfo?buildID=21629
> 
> Please test, if it works well then we can reable to re-enable the Firefox fix.

Thanks, Colin!  Yes, that works well for me so far. :)

Comment 24 Colin Walters 2007-10-19 01:15:11 UTC
(In reply to comment #22)
> 
> The patch adds configury for using libstartupnotification, and ifdef'd code to
> use libsn. We then build moz without sn support. If it's functioning, it's
> completely by accident.

Ok, I'm at home so I can't actually test this with my rawhide computer, but from
looking at the patch again, the section you identified earlier (which calls
gdk_window_focus which ultimately causes the focus event) is the source of the
behavior under discussion.

The startup notification specification if supported correctly would make Firefox
display a progress status on first launch, but this (to me) is not the most
useful part of the patch.  The most useful part is the behavior that when one
clicks on a link in an external program, the web browser appears and displays
the link.  

Some people feel that behavior wasn't right for multiple desktops (and the
metacity patch addresses this), but please when testing things, try the single
workspace case.  The expected behavior is that the browser appears; it should
not pulse as in comment #9.  This is the way clicking on links works on other
platforms, and is the most sensible thing I believe for most situations in the
single-workspace case.  

There might be some more special cases such as feed readers (liferea?) where one
wants to click a number of links to "queue" urls; I am open to discussion around
those.  Probably the right solution for them will be to have the ability at
link-click time whether or not you want to see it.




Comment 25 Colin Walters 2007-10-19 01:17:11 UTC
I meant to mention above; the reason the patch still has effect is because the
gdk_window_focus call is outside the #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION.

Also, bear in mind this patch is already upstreamed and will be in the Firefox 3
release; I am not yet sure whether it will be in the 2.0.0.7 stream.


Comment 26 Christopher Aillon 2007-10-19 12:21:59 UTC
We'll probably want this metacity fix for FC7 too before Firefox's support makes
it there.

Comment 27 Matthias Clasen 2007-10-22 13:22:20 UTC
Fixed in F8, moving off blocker

Comment 28 Mauricio Pretto 2007-10-22 19:56:16 UTC
Its fixed for me after last update in F8
Cheers

Comment 29 Bug Zapper 2008-05-14 14:31:36 UTC
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:
http://docs.fedoraproject.org/release-notes/

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 30 Peter van Egdom 2008-06-02 19:17:23 UTC
Thank you for the bug report. Closing bug as per comment #27 and comment #28.

If you still experience this problem after updating to our latest Fedora
release, reopen this bug against that version if this bug exists there.