mirror of
https://github.com/moparisthebest/FireTray
synced 2024-11-11 03:25:07 -05:00
* fix (Chat) imports for Thunderbird
* fix Window.attachWndProc NOTE: WndProc crashes fixed in TB27+
This commit is contained in:
parent
42a8dac1ed
commit
20d137bd28
@ -21,15 +21,15 @@
|
|||||||
<Description>
|
<Description>
|
||||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
|
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
|
||||||
<em:minVersion>7.0</em:minVersion>
|
<em:minVersion>7.0</em:minVersion>
|
||||||
<em:maxVersion>27.0</em:maxVersion>
|
<em:maxVersion>30.0</em:maxVersion>
|
||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
|
|
||||||
<em:targetApplication> <!-- Thunderbird -->
|
<em:targetApplication> <!-- Thunderbird -->
|
||||||
<Description>
|
<Description>
|
||||||
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
|
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
|
||||||
<em:minVersion>7.0</em:minVersion>
|
<em:minVersion>27.0</em:minVersion>
|
||||||
<em:maxVersion>27.0</em:maxVersion>
|
<em:maxVersion>30.0</em:maxVersion>
|
||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ const Cu = Components.utils;
|
|||||||
|
|
||||||
Cu.import("resource:///modules/imServices.jsm");
|
Cu.import("resource:///modules/imServices.jsm");
|
||||||
Cu.import("resource://firetray/commons.js");
|
Cu.import("resource://firetray/commons.js");
|
||||||
Cu.import("resource://firetray/linux/FiretrayChatStatusIcon.jsm");
|
|
||||||
Cu.import("resource://firetray/linux/FiretrayWindow.jsm");
|
|
||||||
|
|
||||||
let log = firetray.Logging.getLogger("firetray.Chat");
|
let log = firetray.Logging.getLogger("firetray.Chat");
|
||||||
|
|
||||||
@ -24,10 +22,21 @@ firetray.Chat = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
if (this.initialized) {
|
if (this.initialized) {
|
||||||
log.warn("Chat already initialized");
|
log.warn("Chat already initialized");
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
log.debug("Enabling Chat");
|
log.debug("Enabling Chat");
|
||||||
|
|
||||||
|
switch (firetray.Handler.runtimeOS) {
|
||||||
|
case "Linux":
|
||||||
|
Cu.import("resource://firetray/linux/FiretrayChatStatusIcon.jsm");
|
||||||
|
Cu.import("resource://firetray/linux/FiretrayWindow.jsm");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.error("Only Linux platforms supported at this time. " +
|
||||||
|
"Chat not loaded");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
firetray.Utils.addObservers(firetray.Chat, [
|
firetray.Utils.addObservers(firetray.Chat, [
|
||||||
// "*", // debugging
|
// "*", // debugging
|
||||||
"account-connected", "account-disconnected", "idle-time-changed",
|
"account-connected", "account-disconnected", "idle-time-changed",
|
||||||
@ -42,10 +51,11 @@ firetray.Chat = {
|
|||||||
this.updateIcon();
|
this.updateIcon();
|
||||||
|
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
shutdown: function() {
|
shutdown: function() {
|
||||||
if (!this.initialized) return;
|
if (!this.initialized) return false;
|
||||||
log.debug("Disabling Chat");
|
log.debug("Disabling Chat");
|
||||||
|
|
||||||
if (firetray.Chat.convsToAcknowledge.length())
|
if (firetray.Chat.convsToAcknowledge.length())
|
||||||
@ -55,6 +65,7 @@ firetray.Chat = {
|
|||||||
firetray.Utils.removeAllObservers(firetray.Chat);
|
firetray.Utils.removeAllObservers(firetray.Chat);
|
||||||
|
|
||||||
this.initialized = false;
|
this.initialized = false;
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// FIXME: the listener should probably attached on the conv entry in the
|
// FIXME: the listener should probably attached on the conv entry in the
|
||||||
|
@ -85,7 +85,7 @@ firetray.Handler = {
|
|||||||
log.debug('FiretrayWindow WINNT imported');
|
log.debug('FiretrayWindow WINNT imported');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.error("FIRETRAY: only Linux and WINNT platforms supported at this"
|
log.error("Only Linux and WINNT platforms supported at this"
|
||||||
+ "time. Firetray not loaded");
|
+ "time. Firetray not loaded");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -71,11 +71,11 @@ firetray.Window.wndProc = function(hWnd, uMsg, wParam, lParam) { // filterWindow
|
|||||||
return user32.CallWindowProcW(procPrev, hWnd, uMsg, wParam, lParam);
|
return user32.CallWindowProcW(procPrev, hWnd, uMsg, wParam, lParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
firetray.Window.attachWndProc = function(wid) {
|
firetray.Window.attachWndProc = function(wid, hwnd) {
|
||||||
try {
|
try {
|
||||||
let wndProc = user32.WNDPROC(firetray.Window.wndProc);
|
let wndProc = user32.WNDPROC(firetray.Window.wndProc);
|
||||||
log.debug("proc="+wndProc);
|
log.debug("proc="+wndProc);
|
||||||
this.wndProcs.insert(wid, wndProc);
|
firetray.Handler.wndProcs.insert(wid, wndProc);
|
||||||
let procPrev = user32.WNDPROC(
|
let procPrev = user32.WNDPROC(
|
||||||
user32.SetWindowLongW(hwnd, user32.GWLP_WNDPROC,
|
user32.SetWindowLongW(hwnd, user32.GWLP_WNDPROC,
|
||||||
ctypes.cast(wndProc, win32.LONG_PTR))
|
ctypes.cast(wndProc, win32.LONG_PTR))
|
||||||
@ -83,14 +83,19 @@ firetray.Window.attachWndProc = function(wid) {
|
|||||||
log.debug("procPrev="+procPrev+" winLastError="+ctypes.winLastError);
|
log.debug("procPrev="+procPrev+" winLastError="+ctypes.winLastError);
|
||||||
// we can't store WNDPROC callbacks (JS ctypes objects) with SetPropW(), as
|
// we can't store WNDPROC callbacks (JS ctypes objects) with SetPropW(), as
|
||||||
// we need long-living refs.
|
// we need long-living refs.
|
||||||
this.wndProcsOrig.insert(wid, procPrev);
|
firetray.Handler.wndProcsOrig.insert(wid, procPrev);
|
||||||
|
|
||||||
} catch (x) {
|
} catch (x) {
|
||||||
if (x.name === "RangeError") // instanceof not working :-(
|
if (x.name === "RangeError") { // instanceof not working :-(
|
||||||
win.alert(x+"\n\nYou seem to have more than "+FIRETRAY_WINDOW_COUNT_MAX
|
let msg = x+"\n\nYou seem to have more than "+FIRETRAY_WINDOW_COUNT_MAX
|
||||||
+" windows open. This breaks FireTray and most probably "
|
+" windows open. This breaks FireTray and most probably "
|
||||||
+firetray.Handler.appName+".");
|
+firetray.Handler.appName+".";
|
||||||
else win.alert(x);
|
log.error(msg);
|
||||||
|
Cu.reportError(msg);
|
||||||
|
}else {
|
||||||
|
log.error(x);
|
||||||
|
Cu.reportError(x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +151,7 @@ firetray.Handler.registerWindow = function(win) {
|
|||||||
|
|
||||||
log.debug("window "+wid+" registered");
|
log.debug("window "+wid+" registered");
|
||||||
|
|
||||||
this.attachWndProc(wid);
|
firetray.Window.attachWndProc(wid, hwnd);
|
||||||
|
|
||||||
firetray.Win32.acceptAllMessages(hwnd);
|
firetray.Win32.acceptAllMessages(hwnd);
|
||||||
|
|
||||||
@ -163,7 +168,7 @@ firetray.Handler.unregisterWindow = function(win) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.detachWndProc(wid);
|
firetray.Window.detachWndProc(wid);
|
||||||
|
|
||||||
if (!delete firetray.Handler.windows[wid])
|
if (!delete firetray.Handler.windows[wid])
|
||||||
throw new DeleteError();
|
throw new DeleteError();
|
||||||
|
Loading…
Reference in New Issue
Block a user