From 659ca4bb80c05b8c36df67f6bf4aa8c1a01fb1ea Mon Sep 17 00:00:00 2001 From: foudfou Date: Wed, 4 Jun 2014 22:00:47 +0200 Subject: [PATCH 1/2] Try to get the default icon from getMostRecentWindow/nativeHandle instead of FindWindow/HiddenWindow. --- src/modules/winnt/FiretrayStatusIcon.jsm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/winnt/FiretrayStatusIcon.jsm b/src/modules/winnt/FiretrayStatusIcon.jsm index b7681c2..3803d1b 100644 --- a/src/modules/winnt/FiretrayStatusIcon.jsm +++ b/src/modules/winnt/FiretrayStatusIcon.jsm @@ -85,10 +85,15 @@ firetray.StatusIcon = { loadThemedIcons: function() { }, loadImages: function() { - // the Mozilla hidden window has the default Mozilla icon - let hwnd_hidden_moz = user32.FindWindowW("MozillaHiddenWindowClass", null); - log.debug("=== hwnd_hidden_moz="+hwnd_hidden_moz); - this.icons.insert('app', this.getIconFromWindow(hwnd_hidden_moz)); + let topmost = firetray.Handler.getWindowInterface( + Services.wm.getMostRecentWindow(null), "nsIBaseWindow"); + let hwnd; + if (topmost.nativeHandle) + hwnd = firetray.Win32.hexStrToHwnd(topmost.nativeHandle); + else + hwnd = user32.FindWindowW("MozillaHiddenWindowClass", null); + log.debug("topmost or hiddenWin hwnd="+hwnd); + this.icons.insert('app', this.getIconFromWindow(hwnd)); ['app_icon_custom', 'mail_icon_custom'].forEach(function(elt) { firetray.StatusIcon.loadImageCustom(elt); }); From e4419c47f7d83e23e75b4c2adef411e8adcb29dd Mon Sep 17 00:00:00 2001 From: foudfou Date: Thu, 5 Jun 2014 12:14:08 +0200 Subject: [PATCH 2/2] Don't fallback on FindWindow() when loading the default icon (winnt). The minimal supported platformVersion for winnt is 27.0 where nativeHandle is provided. --- src/modules/winnt/FiretrayStatusIcon.jsm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/modules/winnt/FiretrayStatusIcon.jsm b/src/modules/winnt/FiretrayStatusIcon.jsm index 3803d1b..f2acb10 100644 --- a/src/modules/winnt/FiretrayStatusIcon.jsm +++ b/src/modules/winnt/FiretrayStatusIcon.jsm @@ -87,11 +87,7 @@ firetray.StatusIcon = { loadImages: function() { let topmost = firetray.Handler.getWindowInterface( Services.wm.getMostRecentWindow(null), "nsIBaseWindow"); - let hwnd; - if (topmost.nativeHandle) - hwnd = firetray.Win32.hexStrToHwnd(topmost.nativeHandle); - else - hwnd = user32.FindWindowW("MozillaHiddenWindowClass", null); + let hwnd = firetray.Win32.hexStrToHwnd(topmost.nativeHandle); log.debug("topmost or hiddenWin hwnd="+hwnd); this.icons.insert('app', this.getIconFromWindow(hwnd)); ['app_icon_custom', 'mail_icon_custom'].forEach(function(elt) {