Changeset 256 for trunk/src/3rdparty/os2/xsystray/xsystray_api.c
- Timestamp:
- Oct 27, 2009, 2:36:55 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/os2/xsystray/xsystray_api.c
r255 r256 27 27 28 28 static HWND G_hwndSysTray = NULLHANDLE; 29 static int G_itlsSysTray MsgData = -1;29 static int G_itlsSysTrayData = -1; 30 30 31 31 static HWND FindSysTrayWindow() … … 46 46 } 47 47 48 static BOOL SendSysTrayCtlMsg(PSYSTRAY MSGDATA pData)48 static BOOL SendSysTrayCtlMsg(PSYSTRAYDATA pData) 49 49 { 50 50 APIRET arc; … … 70 70 arc = ERROR_INVALID_HANDLE; 71 71 if (WinQueryWindowProcess(G_hwndSysTray, &pid, &tid)) 72 arc = DosGiveSharedMem(__libc_TLSGet(G_itlsSysTray MsgData),72 arc = DosGiveSharedMem(__libc_TLSGet(G_itlsSysTrayData), 73 73 pid, PAG_READ | PAG_WRITE); 74 74 if (arc != NO_ERROR) … … 80 80 mrc = WinSendMsg(G_hwndSysTray, WM_XST_CONTROL, pData, NULL); 81 81 if (mrc == (MRESULT)TRUE && pData->bAcknowledged) 82 break;82 ; 83 83 84 84 // if we failed to send the message, it may mean that XCenter was restarted … … 98 98 } 99 99 100 static PSYSTRAY MSGDATA GetSysTrayMsgDataPtr()100 static PSYSTRAYDataPtr() 101 101 { 102 102 APIRET arc; 103 103 104 104 // allocate a thread local storage entry if not done so 105 if (G_itlsSysTray MsgData == -1)105 if (G_itlsSysTrayData == -1) 106 106 { 107 107 // @todo does XWorkplace have its own TLS? Not? Use … … 109 109 // to the lack of space in that area) 110 110 int itls = __libc_TLSAlloc(); 111 if (!__atomic_cmpxchg32(&G_itlsSysTray MsgData, itls, -1))111 if (!__atomic_cmpxchg32(&G_itlsSysTrayData, itls, -1)) 112 112 { 113 113 // another thread has already got an entry, discard our try … … 116 116 } 117 117 118 if (G_itlsSysTray MsgData == -1)118 if (G_itlsSysTrayData == -1) 119 119 return NULL; 120 120 } 121 121 122 // allocate a SYSTRAY MSGDATA struct for this thread if not done so123 PSYSTRAY MSGDATA pData = __libc_TLSGet(G_itlsSysTrayMsgData);124 if (!pData) 125 { 126 arc = DosAllocSharedMem((PVOID)&pData, NULL, sizeof(SYSTRAY MSGDATA),122 // allocate a SYSTRAYDATA struct for this thread if not done so 123 PSYSTRAYData); 124 if (!pData) 125 { 126 arc = DosAllocSharedMem((PVOID)&pData, NULL, sizeof(SYSTRAYDATA), 127 127 PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE); 128 128 if (arc != NO_ERROR) 129 129 return NULL; 130 130 131 __libc_TLSSet(G_itlsSysTray MsgData, pData);131 __libc_TLSSet(G_itlsSysTrayData, pData); 132 132 133 133 // note that we don't ever free the allocated block since our API doesn't … … 159 159 PULONG pulRevision) // out: revision number 160 160 { 161 PSYSTRAY MSGDATA pData = GetSysTrayMsgDataPtr();161 PSYSTRAYDataPtr(); 162 162 if (!pData) 163 163 return FALSE; … … 166 166 pData->hwndSender = NULLHANDLE; 167 167 168 BOOL rc = SendSysTrayCtlMsg(pData);169 if ( rc)168 BOOL rc = SendSysTrayCtlMsg(pData); 169 if (rc) 170 170 { 171 171 if (pulMajor) … … 177 177 } 178 178 179 return rc;179 return rc; 180 180 } 181 181 … … 215 215 ULONG ulFlags) // in: flags (not currently used, must be 0) 216 216 { 217 PSYSTRAY MSGDATA pData = GetSysTrayMsgDataPtr();217 PSYSTRAYDataPtr(); 218 218 if (!pData) 219 219 return FALSE; … … 240 240 ULONG ulId) // in: icon ID to remove 241 241 { 242 PSYSTRAY MSGDATA pData = GetSysTrayMsgDataPtr();242 PSYSTRAYDataPtr(); 243 243 if (!pData) 244 244 return FALSE; … … 272 272 PSZ pszText) // in: tooltip text 273 273 { 274 PSYSTRAY MSGDATA pData = GetSysTrayMsgDataPtr();274 PSYSTRAYDataPtr(); 275 275 if (!pData) 276 276 return FALSE; … … 361 361 ULONG xstGetSysTrayMaxTextLen() 362 362 { 363 return sizeof(((PSYSTRAY MSGDATA)0)->u.tooltip.szText);364 } 365 363 return sizeof(((PSYSTRAYDATA)0)->u.tooltip.szText); 364 } 365
Note:
See TracChangeset
for help on using the changeset viewer.