Open Bug 1294273 Opened 8 years ago Updated 2 years ago

window.restore() doesn't work

Categories

(Core :: Widget: Gtk, defect, P4)

defect

Tracking

()

People

(Reporter: billm, Unassigned)

Details

(Whiteboard: tpi:+)

Attachments

(1 file)

STR:
1. Run the browser_minimize.js test. It fails for me 100% of the time.

Alternatively:
1. Open the devtools scratchpad.
2. Set the environment to "Browser". You may need to configure devtools to allow debugging chrome code.
3. Enter "window.minimize()" and hit run. The main window should minimize.
4. Enter "window.restore()" and hit run. The main window should restore. For me it doesn't in Linux. It does in Windows.

The browser_minimize.js test passes on tinderbox, so I guess this isn't a problem for everyone. I'm running Ubuntu 15.10 with the Gnome 3 window manager (mutter I guess).
(In reply to Bill McCloskey (:billm) from comment #0)
> 4. Enter "window.restore()" and hit run.

Is this in the same process as the main window?

If not, focus stealing prevention would prevent another process stealing focus, though usually it would flag the window as wanting attention.
(In reply to Karl Tomlinson (:karlt) from comment #1)
> (In reply to Bill McCloskey (:billm) from comment #0)
> > 4. Enter "window.restore()" and hit run.
> 
> Is this in the same process as the main window?

Yeah, it's all in the main process.

What I noticed is that, in the test, if I call window.focus() after window.restore(), it passes. I traced into gtk, and the call that actually causes the window to unminimize is here:
https://github.com/GNOME/gtk/blob/master/gdk/x11/gdkwindow-x11.c#L2280

What's strange is that window.focus() has no effect when I use it in the devtools scratchpad.
Priority: -- → P4
Whiteboard: tpi:+

I see the same on my Linux machine locally which is running Linux Mint with Cinnamon. When minimizing a window it iconifies as expected, but when calling window.restore() in the Scratchpad it stays minimized and never gets restored. Manually clicking the icon in the taskbar restores the window. $

Maybe this is a problem with some desktops and window managers only?

Karl, is there anything I could help to identify the problem? It's a bit annoying for me because I cannot run lots of the Webdriver wpt tests I usually work on locally.

Flags: needinfo?(karlt)

Note that switching over to the MATE desktop fixed the problem for me.

One thing to confirm might be that gtk_window_deiconify is getting called here:
https://searchfox.org/mozilla-central/rev/78cd247b5d7a08832f87d786541d3e2204842e8e/widget/gtk/nsWindow.cpp#1142

If that is getting called, then this may just be what the window manager is choosing to do. Different window managers have different opinions re whether the app or the user should be able control windows, and this may depend on what is currently focused.

Many tests make assumptions about focus and so only work under specific window managers and only when no user is changing the focus elsewhere. I don't know whether this is also true of wpt tests.

Mochitests generally need to be run under a separate display to what the user is running, to get good results in general. I typically use vncserver for this. Once using a separate display, the choice of window manager can be made independently of the development environment.

Flags: needinfo?(karlt)

(In reply to Karl Tomlinson (back Jan 29 :karlt) from comment #5)

One thing to confirm might be that gtk_window_deiconify is getting called here:
https://searchfox.org/mozilla-central/rev/78cd247b5d7a08832f87d786541d3e2204842e8e/widget/gtk/nsWindow.cpp#1142

Which kind of log is it to get the nsWindow::SetSizeMode... lines logged?

If that is getting called, then this may just be what the window manager is choosing to do. Different window managers have different opinions re whether the app or the user should be able control windows, and this may depend on what is currently focused.

Interesting. I thought that I maybe could find a system setting for that but it looks like there isn't one. So I will permanently switch to MATE desktop.

Many tests make assumptions about focus and so only work under specific window managers and only when no user is changing the focus elsewhere. I don't know whether this is also true of wpt tests.

wpt is using Marionette which enables the focus manager test mode. So there aren't that hard restrictions, and we even can run tests in parallel with different Firefox instances.

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #6)

Which kind of log is it to get the nsWindow::SetSizeMode... lines logged?

MOZ_LOG=Widget:5 in the environment.

wpt is using Marionette which enables the focus manager test mode. So there aren't that hard restrictions, and we even can run tests in parallel with different Firefox instances.

That's a nice feature!

Attached file mozlog.txt

As attached the moz log output for widget:5. Please note that I run window.restore() a couple of times within scratchpad, and finally manually clicked at the taskbar button to restore the window before exiting.

Karl, maybe this helps a bit?

Flags: needinfo?(karlt)

That's consistent with the window manager simply not honoring the request to restore.

Flags: needinfo?(karlt)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: