Window management - Apps raised from indicators sometimes dont have the focus

Reported by Omer Akram on 2010-08-31
532
This bug affects 122 people
Affects Status Importance Assigned to Milestone
Ayatana Design
Critical
John Lea
Compiz
High
Unassigned
DBus Menu
Medium
Unassigned
MPRIS
Confirmed
High
Messaging Menu
High
Marco Trevisan (Treviño)
13.04
High
Marco Trevisan (Treviño)
The Sound Menu
High
Marco Trevisan (Treviño)
13.04
High
Marco Trevisan (Treviño)
Ubuntu One Client
Undecided
Marco Trevisan (Treviño)
Unity
High
Unassigned
compiz (Ubuntu)
High
Unassigned
empathy (Ubuntu)
Undecided
Marco Trevisan (Treviño)
indicator-messages (Ubuntu)
Undecided
Marco Trevisan (Treviño)
Raring
Undecided
Unassigned
indicator-sound (Ubuntu)
Undecided
Marco Trevisan (Treviño)
Raring
Undecided
Unassigned
libdbusmenu (Ubuntu)
Undecided
Unassigned
tomboy (Ubuntu)
Undecided
Unassigned
ubuntuone-client (Ubuntu)
Undecided
Marco Trevisan (Treviño)
unity (Ubuntu)
High
Unassigned

Bug Description

Ubuntu 11.10 beta
compiz 1:0.9.5.94+bzr2803-0ubuntu5
unity 4.16.0-0ubuntu1

1. open banshee, start a song in it and minimize
2. open another application lets say gnome-terminal
3. click on the sound menu and select banshee

What happens
banshee icon in the launcher wiggles and banshee main window is not shown

What should happen
banshee main window should come to focus

This is a long standing bug which Ted Gould thinks should be fixed at window manager's level.

====Some other observations=====
The problem wont happen
1. if every other app is minimized or
2. Banshee is the only opened app or
3. after opening gnome-terminal, banshee window is closed so that it hides to the SoundMenu and opened again

=====Comment from Ted Gould=====
<om26er> tedg, Hi! any thoughts on the long standing bug 627195 ? Its been there before unity so I guess we can conclude unity not to be responsible

<tedg> om26er, My thought is that window managers should $%#$ get fixed... though I haven't convinced smspillaz of it yet.

=====The good rule=====
3v1n0: Indicators should present the application windows by passing to them the timestamp of the menu item activation event.

Unfortunately for indicator-sound, this is not trival as it sounds, since it needs a change to the MPRIS dbus specification.
See comment https://bugs.launchpad.net/ayatana-design/+bug/627195/comments/26 for more informations.

For what concerns libappindicator based indicators (such as the one used by tomboy), since it's not currently possible in libdbusmenu to pass the event during activation (so that clients will be able to get the proper timestamp using gtk_get_current_event_time), there are two "hackish" ways:
1. Use the server time to present a window:
   https://bugzilla.gnome.org/show_bug.cgi?id=688830
2. Get the event timestamp from the dbus-menu linked to the gtk-menus:
   http://paste.ubuntu.com/5701235/
3. Qt applications workaround: http://is.gd/WnW9eN

Window managers will obey to it.

Related branches

lp:~3v1n0/indicator-sound/gtk-application-player-activate
Merged into lp:indicator-sound/13.10 at revision 346
PS Jenkins bot: Approve (continuous-integration) on 2013-04-05
Lars Uebernickel: Approve on 2013-04-05
Merged into lp:indicator-sound/13.04 at revision 346
PS Jenkins bot: Approve (continuous-integration) on 2013-04-05
Lars Uebernickel: Approve on 2013-04-05
lp:~3v1n0/indicator-sound/bamf-player-activation
Merged into lp:indicator-sound/13.10 at revision 347
PS Jenkins bot: Approve (continuous-integration) on 2013-04-05
Lars Uebernickel: Approve on 2013-04-05
Merged into lp:indicator-sound/13.04 at revision 347
PS Jenkins bot: Approve (continuous-integration) on 2013-04-05
Lars Uebernickel: Approve on 2013-04-05
Mathieu Trudel-Lapierre: Abstain on 2013-04-04
lp:~3v1n0/indicator-messages/launch-app-with-timestamp
Merged into lp:indicator-messages/13.10 at revision 339
PS Jenkins bot: Approve (continuous-integration) on 2013-04-05
Lars Uebernickel: Approve on 2013-04-05
Merged into lp:indicator-messages/13.04 at revision 339
PS Jenkins bot: Approve (continuous-integration) on 2013-04-04
Mathieu Trudel-Lapierre: Approve on 2013-04-04
Omer Akram (om26er) wrote :
Omer Akram (om26er) wrote :

Here is another example to reproduce.

in unity open gwibber, minimize it now click on the messaging menu and select Broadcast. gwibber window comes up but not focused

summary: - applications that can come up quickly from the messaging menu or
- indicator applications can sometime not come up focused
+ many apps are unfocused when they are raised from MessagingMenu or
+ SoundMenu
affects: indicator-applet → libindicate
Alex Launi (alexlauni) on 2011-01-31
Changed in libindicate:
status: New → Confirmed
Omer Akram (om26er) on 2011-09-19
affects: ayatana-ubuntu → unity
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in compiz (Ubuntu):
status: New → Confirmed
Omer Akram (om26er) wrote :

<om26er> tedg, Hi! any thoughts on the long standing bug 627195 ? Its been there before unity so I guess we can conclude unity not to be responsible

<tedg> om26er, My thought is that window managers should $%#$ get fixed... though I haven't convinced smspillaz of it yet.

Changed in compiz (Ubuntu):
importance: Undecided → High
Changed in unity:
importance: Undecided → High
Changed in libindicate:
importance: Undecided → High
Changed in unity:
status: New → Confirmed
Omer Akram (om26er) on 2011-09-19
description: updated
affects: libindicate → ayatana-design
description: updated
summary: - many apps are unfocused when they are raised from MessagingMenu or
- SoundMenu
+ Apps raised from indicators sometimes dont have the focus

I can fix this by setting "focus prevention level" from Low to None in CCSM

Changed in compiz-core:
status: New → Confirmed
importance: Undecided → High
milestone: none → 0.9.5.96
John Lea (johnlea) on 2011-09-22
Changed in ayatana-design:
assignee: nobody → John Lea (johnlea)
status: Confirmed → Fix Committed
tags: added: onew udo
John Lea (johnlea) on 2011-09-28
Changed in ayatana-design:
status: Fix Committed → Fix Released
John Lea (johnlea) on 2011-10-18
Changed in unity:
milestone: none → backlog
tags: added: udp
Changed in ayatana-design:
status: Fix Released → Fix Committed
John Lea (johnlea) on 2011-10-19
Changed in ayatana-design:
status: Fix Committed → Triaged
John Lea (johnlea) on 2011-11-03
Changed in unity:
assignee: nobody → Ted Gould (ted)
Changed in ayatana-design:
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity (Ubuntu):
status: New → Confirmed
Omer Akram (om26er) on 2011-11-18
Changed in unity (Ubuntu):
importance: Undecided → High
Laryllan (laryllan) wrote :

I added this bug to the papercuts project.
It affects Empathy too.

Chris Wilson (notgary) wrote :

Thanks for forwarding this to the paper cuts project, however it unfortunately doesn't qualify for inclusion there as any work this far down into the stack, ie at the level of the window manager, is non-trivial and so cannot be considered a paper cut.

no longer affects: hundredpapercuts
Nikolaus Waxweiler (madleser) wrote :

Possibly related: Assign some key-combination to "show player" (e.g. meta-p) in system settings -> keyboard -> shortcuts -> multimedia, press combination, watch as symbol in dash to the left wiggles but does not put focus on it. Very annoying when I want to quickly change songs without moving the mouse to the left screen border, wait until dash shows up and select player icon (or worse yet, when not having media player attached to dash, use the sound indicator *before* having to do those steps). I'm now improvising by attaching the media player to the dash and pressing meta+<number of icon> to make the player window appear and be in focus. Sucks, but it works.

Changed in compiz-core:
milestone: 0.9.5.96 → none
Omer Akram (om26er) on 2012-02-13
Changed in compiz-core:
status: Confirmed → Triaged
Changed in unity:
status: Confirmed → Triaged
Changed in compiz (Ubuntu):
status: Confirmed → Triaged
Changed in unity (Ubuntu):
status: Confirmed → Triaged
John Lea (johnlea) on 2012-02-16
summary: - Apps raised from indicators sometimes dont have the focus
+ Window management - Apps raised from indicators sometimes dont have the
+ focus
John Lea (johnlea) on 2012-02-20
Changed in ayatana-design:
importance: High → Critical
Alexandr (olexandr-dmitriev) wrote :

Hello, any forecasts if the fix will be released before final 12.04?

TomasHnyk (sup) wrote :

Another case that triggers this:
1. Install Opera (it does not happen wiht Firefox)
2. Set it to default browser (system settings > system info > default applications)
3. Run gnome-open http://www.ubuntu.com

Alexandr (olexandr-dmitriev) wrote :

The same on 12.04.

Alexandr (olexandr-dmitriev) wrote :

Sorry, but what the status fix commited means? Does it mean that this fix in proposed? If so - that it still does not work on 12.04, using gedit and devhelp plugin. The devhelp windows just blinking unusable in the appbar.
Maybe the status should be changed to confirmed?

Sebastian Bator (eremit7) wrote :

Fix committed does not mean that the fix is already distributed, that is „fix released“ (see wiki.ubuntu.com/Bugs/Status)

By the way, it is fixed in Ayatana, the upstream project, not Ubuntu itself.

Alexandr (olexandr-dmitriev) wrote :

Thank you, Sebastion, vor your explanation. I have already read about statuses and did not understand what does it mean according to this bug - fixed - but where and how? I tried to find this bug in changelogs and failed. I would be glad if you can explain me how and where to trace bug fixes in ayatana. Also I do not understand the difference between unity and ayatana projects. I was looking for this bug in unity...

Now I know that it is fixed and this makes me very happy! But how to know on which release this will be moved to ubuntu? Because the fix is dated 2011-11 and this looks a bit strange that this was not included to 12.04.

Owais Lone (loneowais) wrote :

Alexandr, fix-commited in ayatana means the design team has taken a decision about the matter, it has nothing to do with the code. This has not been fixed in compiz yet AFAIK.

Changed in compiz:
importance: Undecided → High
status: New → Triaged
Omer Akram (om26er) wrote :

That's bug in Compiz so removed unity package from affects.

no longer affects: compiz-core
no longer affects: unity (Ubuntu)
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity (Ubuntu):
status: New → Confirmed
Ted Gould (ted) on 2012-09-13
Changed in unity:
assignee: Ted Gould (ted) → nobody
Tim Penhey (thumper) on 2012-09-14
Changed in unity:
milestone: backlog → none
Tim Penhey (thumper) on 2012-09-14
tags: added: exbacklog
John Lea (johnlea) on 2012-10-10
Changed in unity (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → High
glennric (glennric) wrote :

I have a problem that i think might be related to this, but I want to make sure. If it isn't I will file a separate bug. When I raise a minimized window via an indicator the app seems to have focus, but lacks window decorations. This bug has been around through several Ubuntu releases. This only happens with compiz, and not metacity. Is this the same bug or is this different?
For example if Thunderbird is open, but minimized, and I click on "Thunderbird Mail" from the Messaging Menu in the indicator, then Thunderbird pops up, but there are no window decorations on it.

glennric (glennric) wrote :

I should add that the bug in my previous comment does not just occur when raising a minimized window via an indicator. It occurs when a minimized window is raised through about any means other than Alt-Tab or clicking on the minimized app itself.

Pierce Gerhart (piercegerhart) wrote :

This bug disappeared for a while for me, but it's back with a vengeance. Twice today I've closed the wrong window and lost work. I used to have the problem with Rhythmbox, but now It's Spotify. The symptoms are exactly the same otherwise.

If you're still having the bug, in CCSM, go into General Options. In the "Focus & Raise Behavior" tab, select Low (default) for "Focus Prevention Level." If it still doesn't work, select off.

TomasHnyk (sup) wrote :

But changing that setting usually has other undesired effects regarding focus in other circumstances (at least according to my experience).

Changed in indicator-sound:
importance: Undecided → High
status: New → Triaged
Changed in compiz:
status: Triaged → Invalid
Changed in unity:
status: Triaged → Won't Fix
status: Won't Fix → Invalid

The MPRIS Raise method of the MediaPlayer2 interface does not require a timestamp parameter and this leads to focus issues in recent linux window managers (such as compiz, mutter or xfce) that need the event timestamp that triggered the call in order to correctly focus and raise a window. Otherwise the focus stealing prevention of the window managers would avoid a media player to be fully raised.

See for example this Ubuntu bug: https://bugs.launchpad.net/ayatana-design/+bug/627195

So, we should deprecate this method and provide another - say - RaiseWithTimestamp method that players should use to correctly raise their windows.

Unity is not the problem here.
Indicator-session should actually pass the activation timestamp to the player when raising it.

However, the problem is that IndicatorSound is just calling the Raise() method of the MPRIS dbus interface that most of the players are implementing. See: http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Method:Raise

As you see this method is not taking any parameter, while it should actually take the timestamp of the click event (the one we get into indicator-sound's MetadataMenuitem::handle_event), in order to work with the Focus Stealing Prevention mechanism that the windows managers are using nowadays (both compiz and mutter in fact).

I've opened a bug for the MPRIS specification at https://bugs.freedesktop.org/show_bug.cgi?id=62917 and I encourage you to complete it.
However this process can be long and until then the only way we have is to patch our players.

Basically what we need to do is *temporary* using the workaround shown in the bug linked below to bypass the focus stealing prevention when the Raise method is called on them:
https://bugzilla.gnome.org/show_bug.cgi?id=688830

description: updated
Changed in compiz (Ubuntu):
status: Triaged → Invalid
Changed in unity (Ubuntu):
status: Triaged → Invalid
Changed in indicator-sound (Ubuntu):
status: New → Confirmed
TomasHnyk (sup) wrote :

Marco Trevisan: how does gnome-open fit into this (see my comment #13)

TomasHnyk: also gnome-open should pass the timestamp to the application it wants to launch, but it does not (it uses g_app_info_launch_default_for_uri without any GAppLaunchContext that keeps the event timeout), and this is not possible to do since in theory the terminal should pass the enter-key event timestamp to such programs. An environment variable could be used instead.

However starting from Raring, also nautilus would highlight this problem when you open a location from terminal (the same doesn't happen when launched from unity), for the very same reason. When you open it from unity all works fine since we pass the event timestamp to the application.

TomasHnyk (sup) wrote :

Marco: so both gnme-terminal and gnome-open should be patched? Should bugs against them be opened?

On a related note, is this bug https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/782758 related (only in reverse, because there, the problem is reversed - application gets focus even when it should not).

Changed in indicator-sound:
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
milestone: none → 13.04.0
status: Triaged → In Progress
Changed in mpris:
importance: Unknown → High
status: Unknown → Confirmed

TomasHnyk: well, not sure... More than gnome-open gnome-terminal would be needed.
Not sure how much trivial it can be, though.

Changed in indicator-sound (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: Confirmed → In Progress
Changed in indicator-messages:
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
importance: Undecided → High
status: New → In Progress
TomasHnyk (sup) wrote :

I see. So it is basically this bug that you filled: https://bugzilla.gnome.org/show_bug.cgi?id=693815

Changed in empathy (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: New → In Progress
Changed in indicator-sound:
milestone: 13.04.0 → none
assignee: Marco Trevisan (Treviño) (3v1n0) → nobody
status: In Progress → Triaged
Changed in indicator-messages:
assignee: Marco Trevisan (Treviño) (3v1n0) → nobody
status: In Progress → Triaged
Changed in indicator-messages (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: New → In Progress
description: updated
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:indicator-messages/13.04 at revision None, scheduled for release in indicator-messages, milestone 13.04.0

Changed in indicator-messages:
status: Triaged → Fix Committed
Changed in indicator-messages:
status: Fix Committed → Triaged
Changed in indicator-messages (Ubuntu):
status: In Progress → Fix Committed
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:indicator-sound/13.04 at revision 346, scheduled for release in indicator-sound, milestone 13.04.0

Changed in indicator-sound:
status: Triaged → Fix Committed
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:indicator-sound/13.04 at revision 347, scheduled for release in indicator-sound, milestone 13.04.0

Changed in indicator-sound:
status: Fix Committed → Triaged
Changed in indicator-sound:
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: Triaged → In Progress
Changed in indicator-messages:
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: Triaged → In Progress
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:indicator-messages at revision 339, scheduled for release in indicator-messages, milestone Unknown

Changed in indicator-messages:
status: In Progress → Fix Committed
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:indicator-sound at revision 346, scheduled for release in indicator-sound, milestone Unknown

Changed in indicator-sound:
status: In Progress → Fix Committed
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:indicator-sound at revision 347, scheduled for release in indicator-sound, milestone Unknown

Changed in empathy (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package empathy - 3.6.4-0ubuntu3

---------------
empathy (3.6.4-0ubuntu3) raring; urgency=low

  * debian/patches/47_git_activate_with_platform_data.patch:
    - Use g_application_activate to pass platform-data to the GtkApplication
      when running it. (LP: #627195)
 -- Marco Trevisan (Trevino) <email address hidden> Wed, 03 Apr 2013 18:24:18 +0200

Changed in empathy (Ubuntu):
status: Fix Committed → Fix Released
Changed in indicator-sound (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package indicator-messages - 12.10.6daily13.04.09-0ubuntu1

---------------
indicator-messages (12.10.6daily13.04.09-0ubuntu1) raring; urgency=low

  * Automatic snapshot from revision 340

indicator-messages (12.10.6daily13.04.08-0ubuntu1) raring; urgency=low

  [ Marco Trevisan (Treviño) ]
  * Window management - Apps raised from indicators sometimes dont have
    the focus (LP: #627195)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 339
 -- Ubuntu daily release <email address hidden> Tue, 09 Apr 2013 02:02:02 +0000

Changed in indicator-messages (Ubuntu):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package indicator-sound - 12.10.2daily13.04.09-0ubuntu1

---------------
indicator-sound (12.10.2daily13.04.09-0ubuntu1) raring; urgency=low

  * Automatic snapshot from revision 348

indicator-sound (12.10.2daily13.04.08-0ubuntu1) raring; urgency=low

  [ Marco Trevisan (Treviño) ]
  * Indicator-sound should send the event timestamp when launching a
    player (LP: #1163434)
  * Window management - Apps raised from indicators sometimes dont have
    the focus (LP: #627195)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 347
 -- Ubuntu daily release <email address hidden> Tue, 09 Apr 2013 02:02:50 +0000

Changed in indicator-sound (Ubuntu):
status: Fix Committed → Fix Released
Changed in indicator-messages:
milestone: none → 13.10.1
Changed in ubuntuone-client:
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: New → In Progress
Changed in libdbusmenu:
importance: Undecided → Medium
status: New → Triaged
description: updated
Changed in tomboy (Ubuntu):
status: New → Confirmed
Changed in ubuntuone-client (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: New → In Progress
Changed in ubuntuone-client:
status: In Progress → Fix Committed
Dave Morley (davmor2) on 2013-04-17
tags: added: u1-notrack
description: updated
Changed in ubuntuone-client (Ubuntu):
status: In Progress → Fix Released
Ted Gould (ted) on 2013-10-04
Changed in indicator-messages:
status: Fix Committed → Fix Released
Changed in indicator-sound:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.