Closed
Bug 962286
Opened 10 years ago
Closed 10 years ago
activeWindow "isFocused" or "isForeground" attribute.
Categories
(Add-on SDK Graveyard :: General, defect, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: glind, Assigned: evold)
Details
Attachments
(1 file)
Rare case, but sometimes knowing if 'firefox' is the focused window is useful. (notifications, other ui bits) I have a small implementation, but it's hard to test as part of another addon, and it would be nice to roll it into core, if people think it's useful. If so: - thoughts on name (foreground? active?) - my hack relies on getOuterId and such, but I think I can get around that. - what should semantics be around private? I am assuming the same as for 'activeWindow'?
Reporter | ||
Comment 1•10 years ago
|
||
Closest I got: https://github.com/gregglind/hotdish/commit/3f966a1c28108835c8528097bc9eec74aae16291 Hard one to test.
P3, and patches welcome. ;)
Priority: -- → P3
Reporter | ||
Comment 3•10 years ago
|
||
wes, have opinions on the vibe of it (before I get working on it)? I plan to expose something like "getForegroundWindow -> sdkWindow" (in 'browserWindows') and "isForeground -> bool" on any sdk window.
I got nothing. Maybe Irakli has some ideas?
Flags: needinfo?(rFobic)
Comment 5•10 years ago
|
||
Gregg, I feel like you maybe complicating things here a little, it should be easy to implement isFocused(window): const { viewFor } = require("sdk/view/core"); const focusManager = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager); const isFocused = window => focusManager.activeWindow === viewFor(window); I don't mind exposing `isFocused` getter on window instance as well. As of `getForegroundWindow` I don't see what's the purpose, since `browserWindows.activeWindow` is that unless non browser window has a focus, for which there's no SDK analogues.
Flags: needinfo?(rFobic)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8484150 -
Flags: review?(zer0)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → evold
Comment 7•10 years ago
|
||
Comment on attachment 8484150 [details] [review] Link to Github pull-request: https://github.com/mozilla/addon-sdk/pull/1612 I wasn't sure if r+ with the comments addressed or r- because the comments; I think it's probably better just have a quick glance before commit after the comments are addressed – or discussed, if I misunderstood something.
Attachment #8484150 -
Flags: review?(zer0) → review-
Assignee | ||
Updated•10 years ago
|
Attachment #8484150 -
Flags: review- → review?(zer0)
Updated•10 years ago
|
Attachment #8484150 -
Flags: review?(zer0) → review+
Comment 8•10 years ago
|
||
Commits pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/14a5932642b834fbea88bde3baa3cd5e2aaf95a5 Bug 962286 making sdk/window/utils isFocused export a dispatcher which now works for high level windows https://github.com/mozilla/addon-sdk/commit/95a2f2548a8968d70e4441858670aed204e2229f Merge pull request #1612 from erikvold/962286 Bug 962286 making sdk/window/utils isFocused export a dispatcher which now works for high level windows r=@ZER0
Assignee | ||
Updated•10 years ago
|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•