- Timestamp:
- Oct 31, 2009, 2:00:20 AM (16 years ago)
- Location:
- trunk/src/3rdparty/os2/xsystray
- Files:
-
- 2 edited
-
xsystray.h (modified) (2 diffs)
-
xsystray_api.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/os2/xsystray/xsystray.h
r256 r272 39 39 } SYSTRAYCMD; 40 40 41 // NOTE: the idea is to fit SYSTRAYCTLDATA into a page (4K) since this is the42 // smallest piece DosAllocSharedMem() allocates anyway.43 41 typedef struct 44 42 { … … 69 67 { 70 68 ULONG ulId; 71 CHAR szText[ 4000]; // occupy as much of 4K page as we can69 CHAR szText[ 72 70 } tooltip; 73 71 -
trunk/src/3rdparty/os2/xsystray/xsystray_api.c
r270 r272 17 17 #define INCL_DOSPROCESS 18 18 #define INCL_WINWINDOWMGR 19 19 20 #define INCL_WINATOM 20 21 #define INCL_WINPOINTERS … … 26 27 #include <string.h> 27 28 #include <sys/builtin.h> // atomics 28 #include <InnotekLIBC/thread.h> // TLS29 29 30 30 static HWND G_hwndSysTray = NULLHANDLE; 31 static int G_itlsSysTrayCtlData = -1; 32 33 static HWND FindSysTrayWindow() 31 // window handle of the system tray server 32 33 static PVOID G_pvMemoryPool = NULL; 34 // memory pool for SYSTRAYCTLDATA structs used by WM_XST_CONTROL 35 // messages. Note that once allocated, this memory is never freed: 36 // it is intentional since the memory is assumed to be always in 37 // need and that the system will free it when the application 38 // terminates 39 40 #define MEMORYPOOL_SIZE 65536 41 // taking SYSTRAYCTLDATA size into account, this is enough for at least 42 // 64 threads sending WM_XST_CONTROL simultaneously, which sounds sane 43 44 // @todo to be on the safe side with casting in __atomic_cmpxchg32() we need 45 // compile-time assertions like this: 46 // AssertCompile(sizeof(uint32_t) == sizeof(HWND)); 47 // AssertCompile(sizeof(uint32_t) == sizeof(PVOID)); 48 49 static HWND FindSysTrayServerWindow() 34 50 { 35 51 char buf[sizeof(WNDCLASS_WIDGET_XSYSTRAY_SERVER) + 1]; … … 62 78 { 63 79 bTriedFind = TRUE; 64 HWND hwnd = FindSysTray Window();80 HWND hwnd = FindSysTrayWindow(); 65 81 __atomic_cmpxchg32((uint32_t *)&G_hwndSysTray, hwnd, NULLHANDLE); 66 82 if (G_hwndSysTray == NULLHANDLE) … … 72 88 arc = ERROR_INVALID_HANDLE; 73 89 if (WinQueryWindowProcess(G_hwndSysTray, &pid, &tid)) 74 arc = DosGiveSharedMem( __libc_TLSGet(G_itlsSysTrayCtlData),90 arc = DosGiveSharedMem(, 75 91 pid, PAG_READ | PAG_WRITE); 76 92 if (arc != NO_ERROR)
