1
0
mirror of https://github.com/moparisthebest/FireTray synced 2025-01-08 12:08:05 -05:00

fix SendMessage'ing to any window

still crashes for FF windows with our hook registered
This commit is contained in:
foudfou 2013-12-04 23:49:50 +01:00
parent 258ddbfbe0
commit 40cf41e97d
5 changed files with 17 additions and 19 deletions

View File

@ -35,7 +35,6 @@ function kernel32_defines(lib) {
lib.lazy_bind("GetProcAddress", win32.FARPROC, win32.HMODULE, win32.LPCSTR);
lib.lazy_bind("GetCurrentThreadId", win32.DWORD);
}
new ctypes_library(KERNEL32_LIBNAME, KERNEL32_ABIS, kernel32_defines, this);

View File

@ -32,7 +32,7 @@ function user32_defines(lib) {
lib.lazy_bind("GetWindowTextW", ctypes.int, win32.HWND, win32.LPTSTR, ctypes.int);
lib.lazy_bind("FindWindowW", win32.HWND, win32.LPCTSTR, win32.LPCTSTR);
lib.lazy_bind("SendMessageW", win32.LRESULT, win32.HWND, win32.UINT, win32.WPARAM, win32.WPARAM);
lib.lazy_bind("SendMessageW", win32.LRESULT, win32.HWND, win32.UINT, win32.WPARAM, win32.LPARAM);
this.WM_GETICON = 0x007F;
this.ICON_SMALL = 0;
this.ICON_BIG = 1;
@ -183,6 +183,8 @@ function user32_defines(lib) {
this.HC_SYSMODALON = 4;
this.HC_SYSMODALOFF = 5;
lib.lazy_bind("GetWindowThreadProcessId", win32.DWORD, win32.HWND, win32.LPDWORD);
}
new ctypes_library(USER32_LIBNAME, USER32_ABIS, user32_defines, this);

View File

@ -24,6 +24,7 @@ var win32 = new function() {
this.UINT_PTR = is64bit ? ctypes.uint64_t : ctypes.unsigned_int;
this.WORD = ctypes.unsigned_short;
this.DWORD = ctypes.unsigned_long;
this.LPDWORD = this.DWORD.ptr;
this.PVOID = ctypes.voidptr_t;
this.LPVOID = ctypes.voidptr_t;
this.LONG = ctypes.long;

View File

@ -132,19 +132,6 @@ firetray.StatusIcon = {
switch (+lParam) {
case win32.WM_LBUTTONUP:
log.debug("WM_LBUTTONUP");
let rv = user32.SendMessageW(hWnd, firetray.Win32.WM_TRAYMESSAGEFWD, 0, 1);
break;
case win32.WM_RBUTTONUP:
log.debug("WM_RBUTTONUP");
break;
case win32.WM_CONTEXTMENU:
log.debug("WM_CONTEXTMENU");
break;
case win32.NIN_KEYSELECT:
log.debug("NIN_KEYSELECT");
break;
default:
}
try {
@ -158,6 +145,19 @@ try {
log.error(error);
}
break;
case win32.WM_RBUTTONUP:
log.debug("WM_RBUTTONUP");
break;
case win32.WM_CONTEXTMENU:
log.debug("WM_CONTEXTMENU");
break;
case win32.NIN_KEYSELECT:
log.debug("NIN_KEYSELECT");
break;
default:
}
}
return user32.DefWindowProcW(hWnd, uMsg, wParam, lParam);

View File

@ -164,7 +164,6 @@ firetray.Handler.registerWindow = function(win) {
firetray.Window.updateVisibility(wid, true);
log.debug("window "+wid+" registered");
/*
try {
let callProcHook = user32.HOOKPROC(firetray.Window.callProcHook);
log.debug("callhk="+callProcHook);
@ -184,7 +183,6 @@ firetray.Handler.registerWindow = function(win) {
+firetray.Handler.appName+".");
else win.alert(x);
}
*/
log.debug("AFTER"); firetray.Handler.dumpWindows();
return wid;
@ -202,10 +200,8 @@ firetray.Handler.unregisterWindow = function(win) {
if (!delete firetray.Handler.windows[wid])
throw new DeleteError();
/*
user32.UnhookWindowsHookEx(firetray.Handler.callProcHooks.get(wid));
firetray.Handler.callProcHooks.remove(wid);
*/
firetray.Handler.windowsCount -= 1;
firetray.Handler.visibleWindowsCount -= 1;