Open Bug 1423768 Opened 8 years ago Updated 25 days ago

Firefox chooses the last focused window on a different virtual desktop when opening a new link instead of the last focused window on the current virtual desktop

Categories

(Core :: Widget: Win32, defect, P3)

58 Branch
defect

Tracking

()

ASSIGNED

People

(Reporter: hayden, Assigned: gstoll)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20171204150510 Steps to reproduce: On a Windows 10 machine with native virtual desktop support. 1.) Open instance of firefox.exe (Win+R, firefox) 2.) Open instance of explorer.exe (Win+E) (taking focus away from Firefox on VD1) 3.) Switch to next virtual desktop (Ctrl+Win+Right or Ctrl+Win+D if next VD does not exist) 4.) Open instance of firefox.exe (Win+R, firefox) 5.) Open instance of explorer.exe (Win+E) (taking focus away from Firefox on VD2) 6.) Switch to first virtual desktop (Ctrl+Win+Left) 7.) Win+R -> http://google.com -> Enter Actual results: The Firefox window on virtual desktop 2 receives focus and opens a tab to Google.com, switching my display to virtual desktop 2. Expected results: The Firefox window on my current virtual desktop (VD1) receives focus and opens a tab to Google.com
Component: Untriaged → Window Management
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
This issue is also present when there is no window open in current virtual desktop. According to the Windows API Documentation, applications should not re-use windows from other virtual desktop. > From Windows API Documentation: > "In addition, if an application can reuse currently active windows, it should only reuse windows if they are on the currently active virtual desktop. Otherwise, a new window should be created." Source: https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nn-shobjidl-ivirtualdesktopmanager
Severity: normal → S3
Component: Window Management → Widget: Win32
Priority: -- → P3

Chiming in to bump this and say this is still an issue. Regardless of which virtual desktop I am in when clicking a web link, the link always opens in whatever the most recent Firefox window is, even if it is on a different virtual desktop. The preferred behavior is that it either opens in the most recent Firefox window on the current virtual desktop, or, in the case that there are no open Firefox windows on the current desktop, that a new window opens on the current desktop.

Assignee: nobody → gstoll
Status: NEW → ASSIGNED

This is tricky because Windows doesn't allow a lot of programmatic access to virtual desktop information since their philosophy is that is for the user to manage, not programs.

Because clicking on a web link launches a Firefox process which just sends a message to the running Firefox process, we're a bit hamstrung by this. I think we can get something working using IVirtualDesktopManager::IsWindowOnCurrentVirtualDesktop() but right now I'm running into a RPC_E_CANTCALLOUT_ININPUTSYNCCALL error, which probably needs I need to dispatch or something.

Per Raymond Chen, programs should not switch between virtual desktops since
they are an end user feature.
( https://devblogs.microsoft.com/oldnewthing/20201123-00/?p=104476 )
Windows on different virtual desktops are marked as cloaked by Windows, so
when looking for an existing window skip over cloaked ones.

There may be more places that we want to pass forceOnSameWorkspace to
getTopWindow(), but this is a start.

See Also: → 1812489
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: