Firefox扩展:检查窗口是否最小化 [英] Firefox extension: check if window is minimized
问题描述
我试图跟踪Firefox窗口的状态(最大化,最小化,正常,全屏);请参阅这里)。不过,无论我尝试过什么,我都不会去看最小化的事件。其他人做得很好。例如,如果我将侦听器添加到窗口中,比如
window.addEventListener(activate,function(event){dump (activate+ window.windowState ++ window.screenX ++ window.screenY +\\\
);},false);
window.addEventListener(deactivate,function(event){dump(deactivate+ window.windowState ++ window.screenX ++ window.screenY +\\\
);},假);
window.addEventListener(resize,function(event){dump(resize+ window.windowState ++ window.screenX ++ window.screenY +\\\
);},假);
我从来不会将2看作是window.windowState(2 = STATE_MINIMIZED)。我已经尝试了使用screenX和screenY的解决方法,但是这没有帮助。当我最小化窗口停用 - 而不是resize - 事件触发与window.windowState为3(STATE_NORMAL)和旧的screenX / screenY值。
有什么办法检测Firefox窗口何时被最小化?我在我的智慧结束。感谢您的帮助!
.org / en / XUL / Events#Window_eventsrel =noreferrer> I'm trying to keep track of the state of a Firefox window ("maximized", "minimized", "normal", "fullscreen"; see here). However, whatever I've tried, I never get to see the minimized event; the others doing fine. For example, if I add listeners to the window such as I never see 2 as the window.windowState (2 = STATE_MINIMIZED). I've tried a workaround using screenX and screenY, but that doesn't help. When I minimize the window the deactivate - not the resize - event fires with window.windowState being 3 (STATE_NORMAL) and the old screenX/screenY values. Is there any way to detect when the Firefox window is being minimized? I'm at my wits' end. Thanks a lot for any help! You should be listening to the 这篇关于Firefox扩展:检查窗口是否最小化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! sizemodechange
事件。这是在窗口被最小化或最大化之后触发的事件。 resize
事件不会触发窗口最小化,因为从技术上来说窗口没有调整大小 - 它是隐藏的。而取消激活
事件可能在之前触发窗口被最小化,当它仍然处于正常状态时(我没有检查) p> window.addEventListener("activate", function(event) { dump("activate " + window.windowState + " " + window.screenX + " " + window.screenY + "\n"); }, false);
window.addEventListener("deactivate", function(event) { dump("deactivate " + window.windowState + " " + window.screenX + " " + window.screenY + "\n"); }, false);
window.addEventListener("resize", function(event) { dump("resize " + window.windowState + " " + window.screenX + " " + window.screenY + "\n"); }, false);
sizemodechange
event. That's the event firing after the window is minimized or maximized. The resize
event doesn't fire for window minimization because technically the window isn't resized - it is hidden. And the deactivate
event likely fires before the window is minimized, when it still has the normal state (I didn't check however).