"Shut Down" dialog doesn't open in the foreground

Bug #279406 reported by Andrew Tipton
This bug affects 9 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
gnome-power-manager (Ubuntu)

Bug Description

Binary package hint: gnome-power-manager

When pressing either the "Shut Down" button in the GNOME system menu or pressing my laptop's power button (I have the action set to "Ask Me" in the Power settings), the "Shut Down the Computer" dialog opens but is *behind* all of my open windows. I have to click on the window in the panel's window list (or Alt-Tab to it) for it to be raised and receive focus!

(Needless to say, since the default action is to shut down after 60 seconds, not noticing the window could be dangerous.)

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 8.10
Package: gnome-power-manager 2.24.0-0ubuntu4~ppa3
SourcePackage: gnome-power-manager
Uname: Linux 2.6.27-5-generic i686
UnreportableReason: This is not a genuine Ubuntu package

Tags: apport-bug
Revision history for this message
Andrew Tipton (kiwidrew) wrote :
Revision history for this message
Bartek (tschew) wrote :

I can confirm this.
Andrew, does pressing the power button get you the shutdown dialogue or the logout dialogue? I get the latter and it is annoying.

Revision history for this message
Andrew Tipton (kiwidrew) wrote :


The power button bringing up the wrong dialog is noted in bug #252795 (https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/252795). Installing Ted's latest gnome-power-manager package in his PPA resolved that issue for me.

Revision history for this message
Michael Nagel (nailor) wrote :

i can confirm it opens in the background SOMETIMES (not every time) when summoned by pressing the laptops power button.

Changed in gnome-power-manager:
status: New → Confirmed
Revision history for this message
Michael Nagel (nailor) wrote :

in fact it seems to open on top, but it does not obtain focus

Revision history for this message
Rune Juhl Jacobsen (runejuhl) wrote :

It seems that the dialogue only obtains focus the first time after starting the computer. After suspending or hibernating the computer, the dialogue will appear on top, but will for some reason not gain focus.

Revision history for this message
mati (mati-wroc) wrote :

Confirming in current 9.04.

When I try to open the dialog and hibernate, it opens below other windows and doesn't have focus.

Revision history for this message
Adrian Bridgett (adrian-bridgett) wrote :

dunno if it's just my imagination, but I only noticed it once I started running compiz (i.e. set deskstop effects to max rather than none). Also on Jaunty.

Revision history for this message
Michael Nagel (nailor) wrote :

i dont use compiz and have the problem as well

Revision history for this message
Martin Albisetti (beuno) wrote :

This has happened to me many times in Jaunty. I agree it's a great papercut to fix.

Changed in hundredpapercuts:
status: New → Confirmed
Changed in hundredpapercuts:
milestone: none → round-7
milestone: round-7 → round-8
Revision history for this message
Radoslav Georgiev (valsodarg) wrote :

I can confirm this. I use compiz all the time and oddly enough this happens only once in a while. Also I get the correct dialog. (Is it possible that focus prevention prohibits it from displaying properly?)

Changed in gnome-power-manager (Ubuntu):
status: Confirmed → Triaged
Changed in hundredpapercuts:
milestone: round-8 → round-4
milestone: round-4 → round-9
Revision history for this message
Michael Rooney (mrooney) wrote :

This is working as intended originally, though perhaps the intention should change. What happens is that when you press the power button, if there has been keyboard or mouse activity recently, it opens in the background so you don't accidentally select one of the options. I'm not sure what the rationale is here exactly, perhaps that this dialog can be triggered automatically in some conditions, or that some power buttons are easily accidentally pressed, and so if you are in the middle of clicking or typing when this happens, you will shutdown/restart/etc unintentionally and perhaps lose data.

Perhaps it should not perform this check and always come to the front. This is almost definitely a dupe of an older bug in which the behavior has been explained but I can't find it at the moment.

Revision history for this message
Michael W. Koehler (mkoehle1) wrote :

Confirming what Michael said above ^

If I try to shut down my computer with either option, the dialog comes up and gains focus. The only instance in which this does not occur for me is when there is recent typing or mouse activity. I guess that I'd prefer to have the dialog gain focus regardless of the current state even at the risk of pressing a button accidentally.

Revision history for this message
Antoine Leclair (antoineleclair) wrote :

From what I can see, the bug is not in gnome-power-manager, but in gnome-session.

I can see in original file gnome-session/gsm-logout-dialog.c at line 142:

        gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE);

There is no logic surrounding it that could cause this window to be not kept above. Also, this file (gsm-logout-dialog.c) is affected by debian/patches/80_new_upstream_session_dialog.patch, but I don't see anything that could cause the bug.

Revision history for this message
Per Ångström (autark) wrote :

I'm seeing this on Karmic, too. I'm annoyed by this behavior when I press CTRL+ALT+DEL to bring up the dialog. I understand the reasoning about preventing accidental shutdown if somebody inadvertently presses the power button, but I don't think the same reasoning should apply when the dialog is triggered by pressing a key combination. The code should differentiate between the two cases.

But frankly, is it really that common for people to inadvertently bring up the shutdown dialog? Is it so common as to motivate this continually annoying behavior?

Revision history for this message
Per Ångström (autark) wrote :

Hey, I always thought that the shutdown dialog (which possibly should be called something else) should have an option to lock the screen, like in Windows XP. That option, which is non-destructive if selected by mistake, should be the default. In that way nobody would have to worry about the risk of dataloss.

Revision history for this message
Vish (vish) wrote :

People keep reporting that they notice this behavior...
But I have *never* noticed this.
I'v used the FUSA/indicator-session and the system menu for shutdowns/logouts and this doesnt happen with those.

Might this be a problem with triggering those actions using keyboard shortcuts?
 Can the people who have reported as noticing this behavior, comment on how they trigger the actions ?

FWIW , using the terminal is the best way ... just kidding ;)

Revision history for this message
David Siegel (djsiegel-deactivatedaccount) wrote :

Marking invalid /as a paper cut/, as this is not consistently reproducible (I cannot reproduce it, nor can mac_v), so it makes it difficult to fix. I also suspect that the sporadic nature of the problem means the technical details underneath the issue are non-trivial.

Changed in hundredpapercuts:
milestone: round-9 → none
status: Confirmed → Invalid
Revision history for this message
Michael Nagel (nailor) wrote :

@david: it works properly the first time but fails every subsequent time. to reproduce the bug do:

1) press power button to show menu (opens in foreground, has focus)
2) select suspend
3) press power button to resume the computer
4) enter password to unlock screen
5) press power button to show menu (opens in foreground, but does not have focus)

you have to start with one iteration of suspend/resume to make it "work". this is reproducible every time on multiple machines for me. have you tested it this way?

Revision history for this message
Per Ångström (autark) wrote :

This is on Lucid Lynx Alpha 1, running Gnome 2.29.3 under metacity.

How to reproduce:
1) Begin with a clean desktop.
2) Open an instance of Nautilus.
3) Press the power button.

Expected behavior: The shutdown dialog should come up in the foreground, active and ready to receive keyboard or mouse input.

Actual behavior: The shutdown dialog comes up inactivated (about 9 times out of 10), either in the foreground or in the background. For me, most of the time it comes up in the foreground, but occasionally it ends up obscured by other windows. If it is in the background it is never active.

For clarity, it doesn't matter whether I press the power button or press CTRL+ALT+DEL.

Revision history for this message
Per Ångström (autark) wrote :

This bug has become confusing, so I have opened bug #510771, about the dialog coming up without being active.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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