1
0
mirror of https://github.com/moparisthebest/FireTray synced 2025-01-08 12:08:05 -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:
foudfou 2014-03-15 17:38:00 +01:00
parent 25af98f911
commit 25bc039a6d
5 changed files with 40 additions and 14 deletions

View File

@ -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
icon) */
onQuit: function(win) {
win.removeEventListener('close', firetrayChrome.onClose, true);
firetray.Handler.unregisterWindow(win);
firetray_log.info("windowsCount="+firetray.Handler.windowsCount+", visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
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
use trying to set warnOnClose=false temporarily in onClose, since onClose is
called *after* the popup */
// FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=827880 menubar
// prevents close button to fire 'close'
onClose: function(event) {
firetray_log.debug('Firetray CLOSE');
let win = event.originalTarget;
if (!win instanceof ChromeWindow)
throw new TypeError('originalTarget not a ChromeWindow');
if (event.originalTarget != window)
throw new TypeError('originalTarget not the current ChromeWindow');
let hides_on_close = firetray.Utils.prefService.getBoolPref('hides_on_close');
firetray_log.debug('hides_on_close: '+hides_on_close);

View File

@ -129,7 +129,7 @@ firetray.Handler = {
firetray.Chat.init();
} else {
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() {
if (firetray.Utils.prefService.getBoolPref('show_icon_on_hide'))
firetray.Handler.setIconVisibility(

View File

@ -105,6 +105,8 @@ var win32 = new function() {
this.WM_SHOWWINDOW = 0x0018;
this.WM_WININICHANGE = 0x001A;
this.WM_SETTINGCHANGE = this.WM_WININICHANGE;
this.WM_COMMAND = 0x0111;
this.WM_SYSCOMMAND = 0x0112;
this.WM_HSCROLL = 0x0114;
this.WM_VSCROLL = 0x0115;
this.WM_MOUSEWHEEL = 0x020A;
@ -132,6 +134,9 @@ var win32 = new function() {
this.WM_MOUSELAST = 0x020D;
this.WM_MOUSELAST = 0x020A;
this.SC_MINIMIZE = 0xF020;
this.SC_CLOSE = 0xF060;
this.BITMAP = ctypes.StructType("BITMAP", [
{ "bmType": this.LONG },
{ "bmWidth": this.LONG },

View File

@ -555,17 +555,12 @@ firetray.Window.filterWindow = function(xev, gdkEv, data) {
let winStates = firetray.Window.getXWindowStates(xid);
let isHidden = winStates & FIRETRAY_XWINDOW_HIDDEN;
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) {
log.debug("GOT ICONIFIED");
let hides_on_minimize = firetray.Utils.prefService.getBoolPref('hides_on_minimize');
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();
}
firetray.Handler.hideOnMinimizeMaybe(xid);
}
break;

View File

@ -69,6 +69,16 @@ firetray.Window.wndProc = function(hWnd, uMsg, wParam, lParam) { // filterWindow
} else if (uMsg === win32.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) {
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);
return user32.CallWindowProcW(procPrev, hWnd, uMsg, wParam, lParam);
return user32.CallWindowProcW(procPrev, hWnd, uMsg, wParam, lParam); // or DefWindowProcW
};
firetray.Window.attachWndProc = function(wid, hwnd) {