Changeset 273 for trunk/src/3rdparty/os2/xsystray/xsystray_api.c
- Timestamp:
- Nov 2, 2009, 3:10:29 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/os2/xsystray/xsystray_api.c
r272 r273 28 28 #include <sys/builtin.h> // atomics 29 29 30 static HWND G_hwndSysTray = NULLHANDLE; 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 30 static 31 volatile HWND G_hwndSysTray = NULLHANDLE; 32 // window handle of the system tray server 33 34 static 35 volatile PVOID G_pvMemoryPool = NULL; 36 // shared memory pool for SYSTRAYCTLDATA structs used by 37 // WM_XST_CONTROL messages. Note that once allocated, this memory 38 // is never freed: it is intentional since the memory is assumed 39 // to be always in need and that the system will free it when the 40 // application terminates 41 42 #define CLIENT_MEMORYPOOL_SIZE 65536 43 // taking SYSTRAYCTLDATA size into account (<=1024 B), this is enough 44 // for at least 64 threads sending WM_XST_CONTROL simultaneously, which 45 // sounds sane 43 46 44 47 // @todo to be on the safe side with casting in __atomic_cmpxchg32() we need … … 116 119 } 117 120 118 // This function allocates a SYSTRAYCTLDATA struct in the pool of shared memory. 119 // If there is no free space in the pool, it returns NULL. The allocated memory 120 // must be freed by FreeSysTrayCtlDataPtr() when not needed. 121 /* 122 *@@ AllocSysTrayCtlDataPtr: 123 * Allocates a SYSTRAYCTLDATA struct in the pool of shared memory. 124 * 125 * If there is no free space in the pool, it returns NULL. The allocated 126 * memory must be freed by FreeSysTrayCtlDataPtr() when not needed. 127 */ 128 121 129 static PSYSTRAYCTLDATA AllocSysTrayCtlDataPtr() 122 130 { … … 128 136 { 129 137 // Note: we don't PAG_COMMIT, DosSubAllocMem will do so when needed 130 arc = DosAllocSharedMem((PVOID)&pvPool, NULL, MEMORYPOOL_SIZE,138 arc = DosAllocSharedMem((PVOID)&pvPool, NULL, MEMORYPOOL_SIZE, 131 139 PAG_READ | PAG_WRITE | OBJ_GIVEABLE); 132 140 if (arc == NO_ERROR) 133 141 arc = DosSubSetMem(pvPool, 134 142 DOSSUB_INIT | DOSSUB_SPARSE_OBJ, 135 MEMORYPOOL_SIZE);143 MEMORYPOOL_SIZE); 136 144 if (!__atomic_cmpxchg32((uint32_t *)&G_pvMemoryPool, 137 145 (uint32_t)pvPool, (uint32_t)NULL)) … … 149 157 } 150 158 151 arc = DosSubAllocMem(G_pvMemoryPool, (PVOID)&pData, sizeof( SYSTRAYCTLDATA));159 arc = DosSubAllocMem(G_pvMemoryPool, (PVOID)&pData, sizeof()); 152 160 if (arc != NO_ERROR) 153 161 return NULL; … … 158 166 static VOID FreeSysTrayCtlDataPtr(PSYSTRAYCTLDATA pData) 159 167 { 160 DosSubFreeMem(G_pvMemoryPool, pData, sizeof( SYSTRAYCTLDATA));168 DosSubFreeMem(G_pvMemoryPool, pData, sizeof()); 161 169 } 162 170 … … 220 228 * 221 229 * param1 222 * USHORT usI D icon ID223 * USHORT us Codenotify code, one of XST_IN_ constants230 * USHORT usID icon ID 231 * USHORT us notify code, one of XST_IN_ constants 224 232 * 225 233 * param2 226 * PVOID pData notify code specific data (see below)234 * PVOID pData notify code specific data (see below) 227 235 * 228 236 * The following notify codes are currently recognized: … … 232 240 * messages are recognized. param2 is a pointer to the XSTMOUSEMSG 233 241 * structure containing full mouse message details. 242 243 244 245 246 247 248 249 234 250 */ 235 251 236 252 BOOL xstAddSysTrayIcon(HWND hwnd, // in: window handle associated with the icon 237 U LONG ulId,// in: icon ID to add253 U // in: icon ID to add 238 254 HPOINTER hIcon, // in: icon handle 239 255 ULONG ulMsgId, // in: message ID for notifications … … 252 268 pData->ulCommand = SYSTRAYCMD_ADDICON; 253 269 pData->hwndSender = hwnd; 254 pData->u.icon.u lId = ulId;270 pData->u.icon.uId; 255 271 pData->u.icon.hIcon = hIcon; 256 272 pData->u.icon.ulMsgId = ulMsgId; … … 278 294 279 295 BOOL xstRemoveSysTrayIcon(HWND hwnd, // in: window handle associated with the icon 280 U LONG ulId)// in: icon ID to remove296 U // in: icon ID to remove 281 297 { 282 298 BOOL brc; … … 287 303 pData->ulCommand = SYSTRAYCMD_REMOVEICON; 288 304 pData->hwndSender = hwnd; 289 pData->u.icon.u lId = ulId;305 pData->u.icon.uId; 290 306 291 307 brc = SendSysTrayCtlMsg(pData); … … 314 330 315 331 BOOL xstSetSysTrayIconToolTip(HWND hwnd, // in: window handle associated with the icon 316 U LONG ulId,// in: icon ID to set the tooltip for332 U // in: icon ID to set the tooltip for 317 333 PSZ pszText) // in: tooltip text 318 334 { … … 324 340 pData->ulCommand = SYSTRAYCMD_SETTOOLTIP; 325 341 pData->hwndSender = hwnd; 326 pData->u.tooltip.u lId = ulId;342 pData->u.tooltip.uId; 327 343 328 344 if (pszText == NULL) … … 343 359 } 344 360 345 BOOL xstShowSysTrayIconBalloon(HWND hwnd, U LONG ulId, PSZ pszTitle, PSZ pszText,361 BOOL xstShowSysTrayIconBalloon(HWND hwnd, UId, PSZ pszTitle, PSZ pszText, 346 362 ULONG ulFlags, ULONG ulTimeout) 347 363 { … … 350 366 } 351 367 352 BOOL xstHideSysTrayIconBalloon(HWND hwnd, U LONG ulId)368 BOOL xstHideSysTrayIconBalloon(HWND hwnd, UId) 353 369 { 354 370 // @todo implement … … 364 380 * Returns TRUE on success and FALSE otherwise. 365 381 */ 366 BOOL xstQuerySysTrayIconRect(HWND hwnd, U LONG ulId, PRECTL prclRect)382 BOOL xstQuerySysTrayIconRect(HWND hwnd, UId, PRECTL prclRect) 367 383 { 368 384 // @todo implement … … 384 400 ULONG xstGetSysTrayCreatedMsgId() 385 401 { 386 // NOTE: keep in sync with fnwpXSysTray()::WM_CREATED387 388 402 static ULONG WM_XST_CREATED = 0; 389 403 if (WM_XST_CREATED == 0) 390 404 WM_XST_CREATED = WinAddAtom(WinQuerySystemAtomTable(), 391 "ExtendedSysTray.WM_XST_CREATED");405 ); 392 406 return WM_XST_CREATED; 393 407 }
Note:
See TracChangeset
for help on using the changeset viewer.