mirror of
https://github.com/moparisthebest/FireTray
synced 2025-01-09 04:28:16 -05:00
* hides_on_minimize for winnt
* explicit removeEventListener('close') in overlay.js Them titlebar is preventing fake close/minimize buttons to fire needed events (close, WM_SYSCOMMAND). So, until Bug 827880 is fixed, hides_on_minimize doesn't work with the menubar hidden.
This commit is contained in:
parent
25af98f911
commit
25bc039a6d
@ -36,6 +36,7 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
|
|||||||
window close, a new window will create a new handler (and hence, a new tray
|
window close, a new window will create a new handler (and hence, a new tray
|
||||||
icon) */
|
icon) */
|
||||||
onQuit: function(win) {
|
onQuit: function(win) {
|
||||||
|
win.removeEventListener('close', firetrayChrome.onClose, true);
|
||||||
firetray.Handler.unregisterWindow(win);
|
firetray.Handler.unregisterWindow(win);
|
||||||
firetray_log.info("windowsCount="+firetray.Handler.windowsCount+", visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
firetray_log.info("windowsCount="+firetray.Handler.windowsCount+", visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
||||||
firetray_log.debug('Firetray UNLOADED !');
|
firetray_log.debug('Firetray UNLOADED !');
|
||||||
@ -46,11 +47,12 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
|
|||||||
hides_on_close is set (we are not actually closing the tabs!). There is no
|
hides_on_close is set (we are not actually closing the tabs!). There is no
|
||||||
use trying to set warnOnClose=false temporarily in onClose, since onClose is
|
use trying to set warnOnClose=false temporarily in onClose, since onClose is
|
||||||
called *after* the popup */
|
called *after* the popup */
|
||||||
|
// FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=827880 menubar
|
||||||
|
// prevents close button to fire 'close'
|
||||||
onClose: function(event) {
|
onClose: function(event) {
|
||||||
firetray_log.debug('Firetray CLOSE');
|
firetray_log.debug('Firetray CLOSE');
|
||||||
let win = event.originalTarget;
|
if (event.originalTarget != window)
|
||||||
if (!win instanceof ChromeWindow)
|
throw new TypeError('originalTarget not the current ChromeWindow');
|
||||||
throw new TypeError('originalTarget not a ChromeWindow');
|
|
||||||
|
|
||||||
let hides_on_close = firetray.Utils.prefService.getBoolPref('hides_on_close');
|
let hides_on_close = firetray.Utils.prefService.getBoolPref('hides_on_close');
|
||||||
firetray_log.debug('hides_on_close: '+hides_on_close);
|
firetray_log.debug('hides_on_close: '+hides_on_close);
|
||||||
|
@ -129,7 +129,7 @@ firetray.Handler = {
|
|||||||
firetray.Chat.init();
|
firetray.Chat.init();
|
||||||
} else {
|
} else {
|
||||||
let platforms = FIRETRAY_CHAT_SUPPORTED_OS.join(", ");
|
let platforms = FIRETRAY_CHAT_SUPPORTED_OS.join(", ");
|
||||||
log.error("Only "+platforms+" platform(s) supported at this time. Chat not loaded");
|
log.warn("Only "+platforms+" platform(s) supported at this time. Chat not loaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +370,20 @@ firetray.Handler = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hideOnMinimizeMaybe: function(wid) {
|
||||||
|
let hidden = false;
|
||||||
|
let hides_on_minimize = firetray.Utils.prefService.getBoolPref('hides_on_minimize');
|
||||||
|
if (hides_on_minimize) {
|
||||||
|
let hides_single_window = firetray.Utils.prefService.getBoolPref('hides_single_window');
|
||||||
|
if (hides_single_window)
|
||||||
|
firetray.Handler.hideWindow(wid);
|
||||||
|
else
|
||||||
|
firetray.Handler.hideAllWindows();
|
||||||
|
hidden = true;
|
||||||
|
}
|
||||||
|
return hidden;
|
||||||
|
},
|
||||||
|
|
||||||
showHideIcon: function() {
|
showHideIcon: function() {
|
||||||
if (firetray.Utils.prefService.getBoolPref('show_icon_on_hide'))
|
if (firetray.Utils.prefService.getBoolPref('show_icon_on_hide'))
|
||||||
firetray.Handler.setIconVisibility(
|
firetray.Handler.setIconVisibility(
|
||||||
|
@ -105,6 +105,8 @@ var win32 = new function() {
|
|||||||
this.WM_SHOWWINDOW = 0x0018;
|
this.WM_SHOWWINDOW = 0x0018;
|
||||||
this.WM_WININICHANGE = 0x001A;
|
this.WM_WININICHANGE = 0x001A;
|
||||||
this.WM_SETTINGCHANGE = this.WM_WININICHANGE;
|
this.WM_SETTINGCHANGE = this.WM_WININICHANGE;
|
||||||
|
this.WM_COMMAND = 0x0111;
|
||||||
|
this.WM_SYSCOMMAND = 0x0112;
|
||||||
this.WM_HSCROLL = 0x0114;
|
this.WM_HSCROLL = 0x0114;
|
||||||
this.WM_VSCROLL = 0x0115;
|
this.WM_VSCROLL = 0x0115;
|
||||||
this.WM_MOUSEWHEEL = 0x020A;
|
this.WM_MOUSEWHEEL = 0x020A;
|
||||||
@ -132,6 +134,9 @@ var win32 = new function() {
|
|||||||
this.WM_MOUSELAST = 0x020D;
|
this.WM_MOUSELAST = 0x020D;
|
||||||
this.WM_MOUSELAST = 0x020A;
|
this.WM_MOUSELAST = 0x020A;
|
||||||
|
|
||||||
|
this.SC_MINIMIZE = 0xF020;
|
||||||
|
this.SC_CLOSE = 0xF060;
|
||||||
|
|
||||||
this.BITMAP = ctypes.StructType("BITMAP", [
|
this.BITMAP = ctypes.StructType("BITMAP", [
|
||||||
{ "bmType": this.LONG },
|
{ "bmType": this.LONG },
|
||||||
{ "bmWidth": this.LONG },
|
{ "bmWidth": this.LONG },
|
||||||
|
@ -555,17 +555,12 @@ firetray.Window.filterWindow = function(xev, gdkEv, data) {
|
|||||||
let winStates = firetray.Window.getXWindowStates(xid);
|
let winStates = firetray.Window.getXWindowStates(xid);
|
||||||
let isHidden = winStates & FIRETRAY_XWINDOW_HIDDEN;
|
let isHidden = winStates & FIRETRAY_XWINDOW_HIDDEN;
|
||||||
log.debug("winStates="+winStates+", isHidden="+isHidden);
|
log.debug("winStates="+winStates+", isHidden="+isHidden);
|
||||||
// NOTE: Gecko 8.0 provides the 'sizemodechange' event
|
// NOTE: Gecko 8.0 provides the 'sizemodechange' event, which comes once
|
||||||
|
// the window is minimized. i.e. preventDefault() or returning false won't
|
||||||
|
// prevent the event.
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
log.debug("GOT ICONIFIED");
|
log.debug("GOT ICONIFIED");
|
||||||
let hides_on_minimize = firetray.Utils.prefService.getBoolPref('hides_on_minimize');
|
firetray.Handler.hideOnMinimizeMaybe(xid);
|
||||||
let hides_single_window = firetray.Utils.prefService.getBoolPref('hides_single_window');
|
|
||||||
if (hides_on_minimize) {
|
|
||||||
if (hides_single_window)
|
|
||||||
firetray.Handler.hideWindow(xid);
|
|
||||||
else
|
|
||||||
firetray.Handler.hideAllWindows();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -69,6 +69,16 @@ firetray.Window.wndProc = function(hWnd, uMsg, wParam, lParam) { // filterWindow
|
|||||||
} else if (uMsg === win32.WM_CLOSE) {
|
} else if (uMsg === win32.WM_CLOSE) {
|
||||||
log.debug("wndProc CALLED with WM_CLOSE");
|
log.debug("wndProc CALLED with WM_CLOSE");
|
||||||
|
|
||||||
|
} else if (uMsg === win32.WM_SYSCOMMAND) {
|
||||||
|
// FIXME: not work with window.minimize() (menubar hidden)
|
||||||
|
log.debug("wndProc CALLED with WM_SYSCOMMAND wParam="+wParam);
|
||||||
|
if (wParam === win32.SC_MINIMIZE) {
|
||||||
|
log.debug("GOT ICONIFIED");
|
||||||
|
if (firetray.Window.hideOnMinimizeMaybe(wid)) {
|
||||||
|
return 0; // processed => preventDefault
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if (uMsg === win32.WM_DESTROY) {
|
} else if (uMsg === win32.WM_DESTROY) {
|
||||||
log.debug("wndProc CALLED with WM_DESTROY "+wid);
|
log.debug("wndProc CALLED with WM_DESTROY "+wid);
|
||||||
|
|
||||||
@ -80,7 +90,7 @@ firetray.Window.wndProc = function(hWnd, uMsg, wParam, lParam) { // filterWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
let procPrev = firetray.Handler.wndProcsOrig.get(wid);
|
let procPrev = firetray.Handler.wndProcsOrig.get(wid);
|
||||||
return user32.CallWindowProcW(procPrev, hWnd, uMsg, wParam, lParam);
|
return user32.CallWindowProcW(procPrev, hWnd, uMsg, wParam, lParam); // or DefWindowProcW
|
||||||
};
|
};
|
||||||
|
|
||||||
firetray.Window.attachWndProc = function(wid, hwnd) {
|
firetray.Window.attachWndProc = function(wid, hwnd) {
|
||||||
|
Loading…
Reference in New Issue
Block a user