Changeset 273 for trunk/src/3rdparty/os2/xsystray/xsystray.h
- Timestamp:
- Nov 2, 2009, 3:10:29 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/os2/xsystray/xsystray.h
r272 r273 17 17 #define XSYSTRAY_HEADER_INCLUDED 18 18 19 #include "xsystray_api.h" 20 21 #include <sys/builtin.h> // atomics 22 19 23 #define XSYSTRAY_VERSION_MAJOR 0 20 24 #define XSYSTRAY_VERSION_MINOR 1 … … 26 30 #define INTCLASS_WIDGET_XSYSTRAY "ExtendedSysTray" 27 31 #define HUMANSTR_WIDGET_XSYSTRAY "Extended system tray" 32 33 #define WM_XST_CREATED_ATOM "ExtendedSysTray.WM_XST_CREATED" 34 #define WM_XST_NOTIFY_ATOM "ExtendedSysTray.WM_XST_NOTIFY" 28 35 29 36 #define WM_XST_CONTROL (WM_USER + 0) … … 38 45 SYSTRAYCMD_HIDEBALLOON, 39 46 } SYSTRAYCMD; 47 48 /* 49 *@@ SYSTRAYCTLDATA: 50 * Structure holding information accompanying WM_XST_CONTROL messages sent 51 * to the system tray server by clients (windows associated with system 52 * tray icons). 53 * 54 * NOTE: When you change the size of this structure, you may also need to 55 * change CLIENT_MEMORYPOOL_SIZE value (see the comments there for 56 * details). 57 */ 40 58 41 59 typedef struct … … 58 76 struct 59 77 { 60 U LONG ulId;78 USHORT usId; 61 79 HPOINTER hIcon; 62 80 ULONG ulMsgId; … … 66 84 struct 67 85 { 68 U LONG ulId;86 USHORT usId; 69 87 CHAR szText[512]; 70 88 } tooltip; … … 77 95 } SYSTRAYCTLDATA, *PSYSTRAYCTLDATA; 78 96 97 /* 98 *@@ NOTIFYDATA: 99 * Structure holding information acompanying notification messages 100 * posted to clients (windows associated with system tray icons) about 101 * icon events. This structure unions all public notification code 102 * dependent structures defined in xsystray_api.h (starting with XST*). 103 * 104 * All messages posted to the client have an ID corresponding to the 105 * WM_XST_NOTIFY_ATOM in the system atom table. The client-side API 106 * implementation intercepts these messages (using HK_INPUT), composes a 107 * new message given the information in NOTIFYDATA, frees the NOTIFYDATA 108 * pointer using FreeNotifyDataPtr() and then sends the composed message to 109 * the appropriate window. 110 * 111 * The layout of the XST_NOTIFY message is as follows: 112 * 113 * param1 114 * PNOTIFYDATA pNotifyData pointer to the NOTIFYDATA structure 115 * 116 * param2 117 * PVOID pvMemoryPool server memory pool (for the 118 * FreeNotifyDataPtr() call) 119 * 120 * NOTE: When you change the size of this structure, you may also need to 121 * change SERVER_MEMORYPOOL_SIZE value in xsystray.c (see the comments 122 * there for details). 123 */ 124 125 typedef struct 126 { 127 ULONG msg; 128 // ID of the message that is to be sent to the target window 129 MPARAM mp1; 130 // message parameter (usually: USHORT usIconId, USHORT usNotifyCode) 131 MPARAM mp2; 132 // message parameter (usually, a pointer to a struct from the union) 133 union 134 { 135 XSTMOUSEMSG MouseMsg; 136 XSTCONTEXTMSG ContextMsg; 137 XSTWHEELMSG WheelMsg; 138 } u; 139 140 } NOTIFYDATA, *PNOTIFYDATA; 141 142 // Header of the server-side memory pool 143 typedef struct 144 { 145 volatile HWND hwnd; // owner of the block or NULLHANDLE if free 146 NOTIFYDATA NotifyData; // data 147 148 } MEMPOOLBLK, *PMEMPOOLBLK; 149 150 // allocation unit in the server-side memory pool 151 typedef struct 152 { 153 ULONG ulBeyond; // address of the first byte beyond the memory pool 154 155 volatile ULONG ulNeedsCommit; // address of the first decommitted byte 156 volatile ULONG ulNext; // address of next possibly free block 157 158 MEMPOOLBLK aBlocks[0]; // fake array for easier addressing 159 160 } MEMPOOLHDR, *PMEMPOOLHDR; 161 162 /* 163 *@@ FreeNotifyDataPtr: 164 * Frees the NOTIFYDATA structure allocated by AllocNotifyDataPtr(). 165 * 166 * See AllocNotifyDataPtr() for more details about allocating these 167 * structures.dd 168 */ 169 170 inline 171 VOID FreeNotifyDataPtr(PVOID pvMemoryPool, // in: memory pool base address 172 HWND hwndOwner, // in: owner of the struct to free 173 PNOTIFYDATA pData) // in: address of the struct to free 174 { 175 PMEMPOOLHDR pHdr = (PMEMPOOLHDR)pvMemoryPool; 176 PMEMPOOLBLK pBlk = (PMEMPOOLBLK)((ULONG)pData - sizeof(HWND)); 177 178 ULONG ulNext = pHdr->ulNext; 179 180 __atomic_cmpxchg32((uint32_t *)&pBlk->hwnd, NULLHANDLE, hwndOwner); 181 182 // if the next possible free block is greater than we just freed, 183 // set it to us (to minimize the amount of committed pages) 184 if (ulNext > (ULONG)pBlk) 185 __atomic_cmpxchg32((uint32_t *)&pHdr->ulNext, (ULONG)pBlk, ulNext); 186 } 187 79 188 #endif // XSYSTRAY_HEADER_INCLUDED 80 189
Note:
See TracChangeset
for help on using the changeset viewer.