Closed Bug 683423 Opened 13 years ago Closed 3 years ago

Need API to help tab drag/detach work properly with Spaces

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: Dolske, Unassigned)

References

Details

The new tab drag/detach work (bug 455694) changes how dragging a tab works. One spot in the new code is essentially doing window hit-testing, and is gets mislead by spaces... Specifically, this code in tabbrowser.xml's _updateTabDetachState():

3006             let winEnum = Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
3007             let wins = [];
3008             while (winEnum.hasMoreElements())
3009               wins.push(winEnum.getNext());
...
3016             wins.every(function(win) {
3017               if (win.closed || win.windowState == STATE_MINIMIZED ||
3018                   isEventOutsideWindow(event, win))
3019                 return true;
3020               data._targetWindow = win;
3021               win.focus(); // Raise window when cursor moves over it.
3022             });

We need to add some extra condition to the conditional @ 2017 to ignore the window if it's on another Space.

Ideally this would be an API to determine if a window is on the active Space, or maybe just an API to determine what Space a window belongs to (eg, to check win1.space != win2.space).

Clever indirect approaches would also be acceptable. For example, given a point on the screen, is there a window from the current process there (and if so which)? Or maybe we can determine activeness watching paint requests? Even an imperfect fix might be an improvement over the current state.

Bug 675860 will eventually be resolved via bug 674925, but I think this merits a short term fix, especially on that can land on Aurora. The "is this window on the active Space" info would also be useful for reducing overhead for active tabs on inactive Spaces (bug 646937 and varieties).

Also related: bug 450953. That's prescribing a specific API that we might not need here, though.
Hmm, so 10.6 has a [NSWindow isOnActiveSpace]. And I found (untested) this little utility on GitHub, which allows getting/setting the Spaces ID for a window... https://github.com/shabble/osx-space-id/blob/master/main.c
QA Whiteboard: qa-not-actionable

Bug 675860 and bug 450953 have since been fixed and I don't believe that the bug as written still reproduces. Please reopen if this isn't the case.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.