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
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 + "
"); }, false);
window.addEventListener("resize", function(event) { dump("resize " + window.windowState + " " + window.screenX + " " + window.screenY + "
"); }, false);
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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…