Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Message queues related functions |
| 3 | * |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 4 | * Copyright 1993, 1994 Alexandre Julliard |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 7 | #include <stdlib.h> |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 8 | #include <string.h> |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 9 | #include <ctype.h> |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 10 | #include <sys/time.h> |
| 11 | #include <sys/types.h> |
Alexandre Julliard | f41aeca | 1993-09-14 16:47:10 +0000 | [diff] [blame] | 12 | |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 13 | #include "message.h" |
| 14 | #include "win.h" |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 15 | #include "gdi.h" |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 16 | #include "sysmetrics.h" |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 17 | #include "heap.h" |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 18 | #include "hook.h" |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 19 | #include "keyboard.h" |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 20 | #include "spy.h" |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 21 | #include "winpos.h" |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 22 | #include "atom.h" |
| 23 | #include "dde.h" |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 24 | #include "queue.h" |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 25 | #include "winproc.h" |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 26 | #include "task.h" |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 27 | #include "process.h" |
| 28 | #include "thread.h" |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 29 | #include "options.h" |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 30 | #include "struct32.h" |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 31 | #include "debug.h" |
| 32 | |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 33 | #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE |
| 34 | #define WM_NCMOUSELAST WM_NCMBUTTONDBLCLK |
| 35 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 36 | typedef enum { SYSQ_MSG_ABANDON, SYSQ_MSG_SKIP, |
| 37 | SYSQ_MSG_ACCEPT, SYSQ_MSG_CONTINUE } SYSQ_STATUS; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 38 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 39 | extern MESSAGEQUEUE *pCursorQueue; /* queue.c */ |
| 40 | extern MESSAGEQUEUE *pActiveQueue; |
| 41 | |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 42 | DWORD MSG_WineStartTicks; /* Ticks at Wine startup */ |
Alexandre Julliard | 4f8c37b | 1996-01-14 18:12:01 +0000 | [diff] [blame] | 43 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 44 | static UINT32 doubleClickSpeed = 452; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 45 | static INT32 debugSMRL = 0; /* intertask SendMessage() recursion level */ |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 46 | |
| 47 | /*********************************************************************** |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 48 | * MSG_CheckFilter |
| 49 | */ |
| 50 | BOOL32 MSG_CheckFilter(WORD uMsg, DWORD filter) |
| 51 | { |
| 52 | if( filter ) |
| 53 | return (uMsg >= LOWORD(filter) && uMsg <= HIWORD(filter)); |
| 54 | return TRUE; |
| 55 | } |
| 56 | |
| 57 | /*********************************************************************** |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 58 | * MSG_SendParentNotify |
| 59 | * |
| 60 | * Send a WM_PARENTNOTIFY to all ancestors of the given window, unless |
| 61 | * the window has the WS_EX_NOPARENTNOTIFY style. |
| 62 | */ |
| 63 | static void MSG_SendParentNotify(WND* wndPtr, WORD event, WORD idChild, LPARAM lValue) |
| 64 | { |
| 65 | #define lppt ((LPPOINT16)&lValue) |
| 66 | |
| 67 | /* pt has to be in the client coordinates of the parent window */ |
| 68 | |
| 69 | MapWindowPoints16( 0, wndPtr->hwndSelf, lppt, 1 ); |
| 70 | while (wndPtr) |
| 71 | { |
| 72 | if (!(wndPtr->dwStyle & WS_CHILD) || (wndPtr->dwExStyle & WS_EX_NOPARENTNOTIFY)) break; |
| 73 | lppt->x += wndPtr->rectClient.left; |
| 74 | lppt->y += wndPtr->rectClient.top; |
| 75 | wndPtr = wndPtr->parent; |
| 76 | SendMessage32A( wndPtr->hwndSelf, WM_PARENTNOTIFY, |
| 77 | MAKEWPARAM( event, idChild ), lValue ); |
| 78 | } |
| 79 | #undef lppt |
| 80 | } |
| 81 | |
| 82 | |
| 83 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 84 | * MSG_TranslateMouseMsg |
| 85 | * |
| 86 | * Translate an mouse hardware event into a real mouse message. |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 87 | * Return value indicates whether the translated message must be passed |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 88 | * to the user, left in the queue, or skipped entirely (in this case |
| 89 | * HIWORD contains hit test code). |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 90 | */ |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 91 | static DWORD MSG_TranslateMouseMsg( HWND16 hTopWnd, DWORD filter, |
| 92 | MSG16 *msg, BOOL32 remove, WND* pWndScope ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 93 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 94 | static DWORD dblclk_time_limit = 0; |
| 95 | static UINT16 clk_message = 0; |
| 96 | static HWND16 clk_hwnd = 0; |
| 97 | static POINT16 clk_pos = { 0, 0 }; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 98 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 99 | WND *pWnd; |
| 100 | HWND16 hWnd; |
| 101 | INT16 ht, hittest, sendSC = 0; |
| 102 | UINT16 message = msg->message; |
| 103 | POINT16 screen_pt, pt; |
| 104 | HANDLE16 hQ = GetTaskQueue(0); |
| 105 | MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16(hQ); |
| 106 | BOOL32 eatMsg = FALSE; |
| 107 | BOOL32 mouseClick = ((message == WM_LBUTTONDOWN) || |
| 108 | (message == WM_RBUTTONDOWN) || |
| 109 | (message == WM_MBUTTONDOWN))?1:0; |
| 110 | SYSQ_STATUS ret = 0; |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 111 | |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 112 | /* Find the window */ |
| 113 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 114 | ht = hittest = HTCLIENT; |
| 115 | hWnd = GetCapture16(); |
| 116 | if( !hWnd ) |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 117 | { |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 118 | ht = hittest = WINPOS_WindowFromPoint( pWndScope, msg->pt, &pWnd ); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 119 | if( !pWnd ) pWnd = WIN_GetDesktop(); |
| 120 | hWnd = pWnd->hwndSelf; |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 121 | sendSC = 1; |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 122 | } |
| 123 | else |
| 124 | { |
| 125 | pWnd = WIN_FindWndPtr(hWnd); |
| 126 | ht = EVENT_GetCaptureInfo(); |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 127 | } |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 128 | |
| 129 | /* stop if not the right queue */ |
| 130 | |
| 131 | if (pWnd->hmemTaskQ != hQ) |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 132 | { |
| 133 | /* Not for the current task */ |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 134 | if (queue) QUEUE_ClearWakeBit( queue, QS_MOUSE ); |
| 135 | /* Wake up the other task */ |
| 136 | queue = (MESSAGEQUEUE *)GlobalLock16( pWnd->hmemTaskQ ); |
| 137 | if (queue) QUEUE_SetWakeBit( queue, QS_MOUSE ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 138 | return SYSQ_MSG_ABANDON; |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 139 | } |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 140 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 141 | /* check if hWnd is within hWndScope */ |
| 142 | |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 143 | if( hTopWnd && hWnd != hTopWnd ) |
| 144 | if( !IsChild16(hTopWnd, hWnd) ) return SYSQ_MSG_CONTINUE; |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 145 | |
| 146 | if( mouseClick ) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 147 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 148 | /* translate double clicks - |
| 149 | * note that ...MOUSEMOVEs can slip in between |
| 150 | * ...BUTTONDOWN and ...BUTTONDBLCLK messages */ |
Alexandre Julliard | 329f068 | 1996-04-14 13:21:20 +0000 | [diff] [blame] | 151 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 152 | if( pWnd->class->style & CS_DBLCLKS || ht != HTCLIENT ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 153 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 154 | if ((message == clk_message) && (hWnd == clk_hwnd) && |
| 155 | (msg->time - dblclk_time_limit < doubleClickSpeed) && |
| 156 | (abs(msg->pt.x - clk_pos.x) < SYSMETRICS_CXDOUBLECLK/2) && |
| 157 | (abs(msg->pt.y - clk_pos.y) < SYSMETRICS_CYDOUBLECLK/2)) |
| 158 | { |
| 159 | message += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); |
| 160 | mouseClick++; /* == 2 */ |
| 161 | } |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 162 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 163 | } |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 164 | screen_pt = pt = msg->pt; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 165 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 166 | if (hittest != HTCLIENT) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 167 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 168 | message += ((INT16)WM_NCMOUSEMOVE - WM_MOUSEMOVE); |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 169 | msg->wParam = hittest; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 170 | } |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 171 | else ScreenToClient16( hWnd, &pt ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 172 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 173 | /* check message filter */ |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 174 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 175 | if (!MSG_CheckFilter(message, filter)) return SYSQ_MSG_CONTINUE; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 176 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 177 | pCursorQueue = queue; |
| 178 | |
| 179 | /* call WH_MOUSE */ |
| 180 | |
| 181 | if (HOOK_IsHooked( WH_MOUSE )) |
| 182 | { |
| 183 | MOUSEHOOKSTRUCT16 *hook = SEGPTR_NEW(MOUSEHOOKSTRUCT16); |
| 184 | if( hook ) |
| 185 | { |
| 186 | hook->pt = screen_pt; |
| 187 | hook->hwnd = hWnd; |
| 188 | hook->wHitTestCode = hittest; |
| 189 | hook->dwExtraInfo = 0; |
| 190 | ret = HOOK_CallHooks16( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE, |
| 191 | message, (LPARAM)SEGPTR_GET(hook) ); |
| 192 | SEGPTR_FREE(hook); |
| 193 | } |
| 194 | if( ret ) return MAKELONG((INT16)SYSQ_MSG_SKIP, hittest); |
| 195 | } |
| 196 | |
| 197 | if ((hittest == HTERROR) || (hittest == HTNOWHERE)) |
| 198 | eatMsg = sendSC = 1; |
| 199 | else if( remove && mouseClick ) |
| 200 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 201 | HWND32 hwndTop = WIN_GetTopParent( hWnd ); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 202 | |
| 203 | if( mouseClick == 1 ) |
| 204 | { |
| 205 | /* set conditions */ |
| 206 | dblclk_time_limit = msg->time; |
| 207 | clk_message = msg->message; |
| 208 | clk_hwnd = hWnd; |
| 209 | clk_pos = screen_pt; |
| 210 | } else |
| 211 | /* got double click - zero them out */ |
| 212 | dblclk_time_limit = clk_hwnd = 0; |
| 213 | |
| 214 | if( sendSC ) |
| 215 | { |
| 216 | /* Send the WM_PARENTNOTIFY, |
| 217 | * note that even for double/nonclient clicks |
| 218 | * notification message is still WM_L/M/RBUTTONDOWN. |
| 219 | */ |
| 220 | |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 221 | MSG_SendParentNotify( pWnd, msg->message, 0, MAKELPARAM(screen_pt.x, screen_pt.y) ); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 222 | |
| 223 | /* Activate the window if needed */ |
| 224 | |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 225 | if (hWnd != GetActiveWindow16() && hWnd != GetDesktopWindow16()) |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 226 | { |
| 227 | LONG ret = SendMessage16( hWnd, WM_MOUSEACTIVATE, hwndTop, |
| 228 | MAKELONG( hittest, message ) ); |
| 229 | |
| 230 | if ((ret == MA_ACTIVATEANDEAT) || (ret == MA_NOACTIVATEANDEAT)) |
| 231 | eatMsg = TRUE; |
| 232 | |
| 233 | if (((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT)) |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 234 | && hwndTop != GetActiveWindow16() ) |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 235 | if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE )) |
| 236 | eatMsg = TRUE; |
| 237 | } |
| 238 | } |
| 239 | } else sendSC = (remove && sendSC); |
| 240 | |
| 241 | /* Send the WM_SETCURSOR message */ |
| 242 | |
| 243 | if (sendSC) |
| 244 | SendMessage16( hWnd, WM_SETCURSOR, (WPARAM16)hWnd, |
| 245 | MAKELONG( hittest, message )); |
| 246 | if (eatMsg) return MAKELONG( (UINT16)SYSQ_MSG_SKIP, hittest); |
| 247 | |
| 248 | msg->hwnd = hWnd; |
| 249 | msg->message = message; |
| 250 | msg->lParam = MAKELONG( pt.x, pt.y ); |
| 251 | return SYSQ_MSG_ACCEPT; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 255 | /*********************************************************************** |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 256 | * MSG_TranslateKbdMsg |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 257 | * |
| 258 | * Translate an keyboard hardware event into a real message. |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 259 | */ |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 260 | static DWORD MSG_TranslateKbdMsg( HWND16 hTopWnd, DWORD filter, |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 261 | MSG16 *msg, BOOL32 remove ) |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 262 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 263 | WORD message = msg->message; |
| 264 | HWND16 hWnd = GetFocus16(); |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 265 | WND *pWnd; |
| 266 | |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 267 | /* Should check Ctrl-Esc and PrintScreen here */ |
| 268 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 269 | if (!hWnd) |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 270 | { |
| 271 | /* Send the message to the active window instead, */ |
| 272 | /* translating messages to their WM_SYS equivalent */ |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 273 | |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 274 | hWnd = GetActiveWindow16(); |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 275 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 276 | if( message < WM_SYSKEYDOWN ) |
| 277 | message += WM_SYSKEYDOWN - WM_KEYDOWN; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 278 | } |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 279 | pWnd = WIN_FindWndPtr( hWnd ); |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 280 | if (pWnd && (pWnd->hmemTaskQ != GetTaskQueue(0))) |
| 281 | { |
| 282 | /* Not for the current task */ |
| 283 | MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ); |
| 284 | if (queue) QUEUE_ClearWakeBit( queue, QS_KEY ); |
| 285 | /* Wake up the other task */ |
| 286 | queue = (MESSAGEQUEUE *)GlobalLock16( pWnd->hmemTaskQ ); |
| 287 | if (queue) QUEUE_SetWakeBit( queue, QS_KEY ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 288 | return SYSQ_MSG_ABANDON; |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 289 | } |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 290 | |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 291 | if (hTopWnd && hWnd != hTopWnd) |
| 292 | if (!IsChild16(hTopWnd, hWnd)) return SYSQ_MSG_CONTINUE; |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 293 | if (!MSG_CheckFilter(message, filter)) return SYSQ_MSG_CONTINUE; |
| 294 | |
| 295 | msg->hwnd = hWnd; |
| 296 | msg->message = message; |
| 297 | |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 298 | return (HOOK_CallHooks16( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE, |
| 299 | msg->wParam, msg->lParam ) |
| 300 | ? SYSQ_MSG_SKIP : SYSQ_MSG_ACCEPT); |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 301 | } |
| 302 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 303 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 304 | /*********************************************************************** |
| 305 | * MSG_JournalRecordMsg |
| 306 | * |
| 307 | * Build an EVENTMSG structure and call JOURNALRECORD hook |
| 308 | */ |
| 309 | static void MSG_JournalRecordMsg( MSG16 *msg ) |
| 310 | { |
| 311 | EVENTMSG16 *event = SEGPTR_NEW(EVENTMSG16); |
| 312 | if (!event) return; |
| 313 | event->message = msg->message; |
| 314 | event->time = msg->time; |
| 315 | if ((msg->message >= WM_KEYFIRST) && (msg->message <= WM_KEYLAST)) |
| 316 | { |
| 317 | event->paramL = (msg->wParam & 0xFF) | (HIWORD(msg->lParam) << 8); |
| 318 | event->paramH = msg->lParam & 0x7FFF; |
| 319 | if (HIWORD(msg->lParam) & 0x0100) |
| 320 | event->paramH |= 0x8000; /* special_key - bit */ |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 321 | HOOK_CallHooks16( WH_JOURNALRECORD, HC_ACTION, 0, |
| 322 | (LPARAM)SEGPTR_GET(event) ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 323 | } |
| 324 | else if ((msg->message >= WM_MOUSEFIRST) && (msg->message <= WM_MOUSELAST)) |
| 325 | { |
| 326 | event->paramL = LOWORD(msg->lParam); /* X pos */ |
| 327 | event->paramH = HIWORD(msg->lParam); /* Y pos */ |
| 328 | ClientToScreen16( msg->hwnd, (LPPOINT16)&event->paramL ); |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 329 | HOOK_CallHooks16( WH_JOURNALRECORD, HC_ACTION, 0, |
| 330 | (LPARAM)SEGPTR_GET(event) ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 331 | } |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 332 | else if ((msg->message >= WM_NCMOUSEFIRST) && |
| 333 | (msg->message <= WM_NCMOUSELAST)) |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 334 | { |
| 335 | event->paramL = LOWORD(msg->lParam); /* X pos */ |
| 336 | event->paramH = HIWORD(msg->lParam); /* Y pos */ |
| 337 | event->message += WM_MOUSEMOVE-WM_NCMOUSEMOVE;/* give no info about NC area */ |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 338 | HOOK_CallHooks16( WH_JOURNALRECORD, HC_ACTION, 0, |
| 339 | (LPARAM)SEGPTR_GET(event) ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 340 | } |
| 341 | SEGPTR_FREE(event); |
| 342 | } |
| 343 | |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 344 | /*********************************************************************** |
| 345 | * MSG_JournalPlayBackMsg |
| 346 | * |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 347 | * Get an EVENTMSG struct via call JOURNALPLAYBACK hook function |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 348 | */ |
| 349 | static int MSG_JournalPlayBackMsg(void) |
| 350 | { |
| 351 | EVENTMSG16 *tmpMsg; |
| 352 | long wtime,lParam; |
| 353 | WORD keyDown,i,wParam,result=0; |
| 354 | |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 355 | if ( HOOK_IsHooked( WH_JOURNALPLAYBACK ) ) |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 356 | { |
| 357 | tmpMsg = SEGPTR_NEW(EVENTMSG16); |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 358 | wtime=HOOK_CallHooks16( WH_JOURNALPLAYBACK, HC_GETNEXT, 0, |
| 359 | (LPARAM)SEGPTR_GET(tmpMsg)); |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 360 | /* TRACE(msg,"Playback wait time =%ld\n",wtime); */ |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 361 | if (wtime<=0) |
| 362 | { |
| 363 | wtime=0; |
| 364 | if ((tmpMsg->message>= WM_KEYFIRST) && (tmpMsg->message <= WM_KEYLAST)) |
| 365 | { |
| 366 | wParam=tmpMsg->paramL & 0xFF; |
| 367 | lParam=MAKELONG(tmpMsg->paramH&0x7ffff,tmpMsg->paramL>>8); |
| 368 | if (tmpMsg->message == WM_KEYDOWN || tmpMsg->message == WM_SYSKEYDOWN) |
| 369 | { |
| 370 | for (keyDown=i=0; i<256 && !keyDown; i++) |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 371 | if (InputKeyStateTable[i] & 0x80) |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 372 | keyDown++; |
| 373 | if (!keyDown) |
| 374 | lParam |= 0x40000000; |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 375 | AsyncKeyStateTable[wParam]=InputKeyStateTable[wParam] |= 0x80; |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 376 | } |
| 377 | else /* WM_KEYUP, WM_SYSKEYUP */ |
| 378 | { |
| 379 | lParam |= 0xC0000000; |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 380 | AsyncKeyStateTable[wParam]=InputKeyStateTable[wParam] &= ~0x80; |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 381 | } |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 382 | if (InputKeyStateTable[VK_MENU] & 0x80) |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 383 | lParam |= 0x20000000; |
| 384 | if (tmpMsg->paramH & 0x8000) /*special_key bit*/ |
| 385 | lParam |= 0x01000000; |
| 386 | hardware_event( tmpMsg->message, wParam, lParam,0, 0, tmpMsg->time, 0 ); |
| 387 | } |
| 388 | else |
| 389 | { |
| 390 | if ((tmpMsg->message>= WM_MOUSEFIRST) && (tmpMsg->message <= WM_MOUSELAST)) |
| 391 | { |
| 392 | switch (tmpMsg->message) |
| 393 | { |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 394 | case WM_LBUTTONDOWN: |
| 395 | MouseButtonsStates[0]=AsyncMouseButtonsStates[0]=TRUE;break; |
| 396 | case WM_LBUTTONUP: |
| 397 | MouseButtonsStates[0]=AsyncMouseButtonsStates[0]=FALSE;break; |
| 398 | case WM_MBUTTONDOWN: |
| 399 | MouseButtonsStates[1]=AsyncMouseButtonsStates[1]=TRUE;break; |
| 400 | case WM_MBUTTONUP: |
| 401 | MouseButtonsStates[1]=AsyncMouseButtonsStates[1]=FALSE;break; |
| 402 | case WM_RBUTTONDOWN: |
| 403 | MouseButtonsStates[2]=AsyncMouseButtonsStates[2]=TRUE;break; |
| 404 | case WM_RBUTTONUP: |
| 405 | MouseButtonsStates[2]=AsyncMouseButtonsStates[2]=FALSE;break; |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 406 | } |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 407 | AsyncKeyStateTable[VK_LBUTTON]= InputKeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] ? 0x80 : 0; |
| 408 | AsyncKeyStateTable[VK_MBUTTON]= InputKeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] ? 0x80 : 0; |
| 409 | AsyncKeyStateTable[VK_RBUTTON]= InputKeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] ? 0x80 : 0; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 410 | SetCursorPos32(tmpMsg->paramL,tmpMsg->paramH); |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 411 | lParam=MAKELONG(tmpMsg->paramL,tmpMsg->paramH); |
| 412 | wParam=0; |
| 413 | if (MouseButtonsStates[0]) wParam |= MK_LBUTTON; |
| 414 | if (MouseButtonsStates[1]) wParam |= MK_MBUTTON; |
| 415 | if (MouseButtonsStates[2]) wParam |= MK_RBUTTON; |
| 416 | hardware_event( tmpMsg->message, wParam, lParam, |
| 417 | tmpMsg->paramL, tmpMsg->paramH, tmpMsg->time, 0 ); |
| 418 | } |
| 419 | } |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 420 | HOOK_CallHooks16( WH_JOURNALPLAYBACK, HC_SKIP, 0, |
| 421 | (LPARAM)SEGPTR_GET(tmpMsg)); |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 422 | } |
| 423 | else |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 424 | { |
| 425 | if( tmpMsg->message == WM_QUEUESYNC ) |
| 426 | if (HOOK_IsHooked( WH_CBT )) |
| 427 | HOOK_CallHooks16( WH_CBT, HCBT_QS, 0, 0L); |
| 428 | |
| 429 | result= QS_MOUSE | QS_KEY; /* ? */ |
| 430 | } |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 431 | SEGPTR_FREE(tmpMsg); |
| 432 | } |
| 433 | return result; |
| 434 | } |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 435 | |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 436 | /*********************************************************************** |
| 437 | * MSG_PeekHardwareMsg |
| 438 | * |
| 439 | * Peek for a hardware message matching the hwnd and message filters. |
| 440 | */ |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 441 | static BOOL32 MSG_PeekHardwareMsg( MSG16 *msg, HWND16 hwnd, DWORD filter, |
| 442 | BOOL32 remove ) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 443 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 444 | DWORD status = SYSQ_MSG_ACCEPT; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 445 | MESSAGEQUEUE *sysMsgQueue = QUEUE_GetSysQueue(); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 446 | int i, kbd_msg, pos = sysMsgQueue->nextMessage; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 447 | |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 448 | /* FIXME: there has to be a better way to do this */ |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 449 | joySendMessages(); |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 450 | |
Alexandre Julliard | cdcdede | 1996-04-21 14:57:41 +0000 | [diff] [blame] | 451 | /* If the queue is empty, attempt to fill it */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 452 | if (!sysMsgQueue->msgCount && THREAD_IsWin16( THREAD_Current() ) |
| 453 | && TSXPending(display)) |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 454 | EVENT_WaitNetEvent( FALSE, FALSE ); |
Alexandre Julliard | cdcdede | 1996-04-21 14:57:41 +0000 | [diff] [blame] | 455 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 456 | for (i = kbd_msg = 0; i < sysMsgQueue->msgCount; i++, pos++) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 457 | { |
Alexandre Julliard | b7258be | 1995-09-01 15:57:28 +0000 | [diff] [blame] | 458 | if (pos >= sysMsgQueue->queueSize) pos = 0; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 459 | *msg = sysMsgQueue->messages[pos].msg; |
| 460 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 461 | /* Translate message */ |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 462 | |
| 463 | if ((msg->message >= WM_MOUSEFIRST) && (msg->message <= WM_MOUSELAST)) |
| 464 | { |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 465 | HWND32 hWndScope = (HWND32)sysMsgQueue->messages[pos].extraInfo; |
| 466 | |
| 467 | status = MSG_TranslateMouseMsg(hwnd, filter, msg, remove, |
| 468 | (Options.managed && IsWindow32(hWndScope) ) |
| 469 | ? WIN_FindWndPtr(hWndScope) : WIN_GetDesktop() ); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 470 | kbd_msg = 0; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 471 | } |
| 472 | else if ((msg->message >= WM_KEYFIRST) && (msg->message <= WM_KEYLAST)) |
| 473 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 474 | status = MSG_TranslateKbdMsg(hwnd, filter, msg, remove); |
| 475 | kbd_msg = 1; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 476 | } |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 477 | else /* Non-standard hardware event */ |
Alexandre Julliard | ade697e | 1995-11-26 13:59:11 +0000 | [diff] [blame] | 478 | { |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 479 | HARDWAREHOOKSTRUCT16 *hook; |
| 480 | if ((hook = SEGPTR_NEW(HARDWAREHOOKSTRUCT16))) |
| 481 | { |
| 482 | BOOL32 ret; |
| 483 | hook->hWnd = msg->hwnd; |
| 484 | hook->wMessage = msg->message; |
| 485 | hook->wParam = msg->wParam; |
| 486 | hook->lParam = msg->lParam; |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 487 | ret = HOOK_CallHooks16( WH_HARDWARE, |
| 488 | remove ? HC_ACTION : HC_NOREMOVE, |
| 489 | 0, (LPARAM)SEGPTR_GET(hook) ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 490 | SEGPTR_FREE(hook); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 491 | if (ret) |
| 492 | { |
| 493 | QUEUE_RemoveMsg( sysMsgQueue, pos ); |
| 494 | continue; |
| 495 | } |
| 496 | status = SYSQ_MSG_ACCEPT; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 497 | } |
Alexandre Julliard | ade697e | 1995-11-26 13:59:11 +0000 | [diff] [blame] | 498 | } |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 499 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 500 | switch (LOWORD(status)) |
| 501 | { |
| 502 | case SYSQ_MSG_ACCEPT: |
| 503 | break; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 504 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 505 | case SYSQ_MSG_SKIP: |
| 506 | if (HOOK_IsHooked( WH_CBT )) |
Jesper Skov | 5c3e457 | 1998-11-01 19:27:22 +0000 | [diff] [blame^] | 507 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 508 | if( kbd_msg ) |
| 509 | HOOK_CallHooks16( WH_CBT, HCBT_KEYSKIPPED, |
| 510 | msg->wParam, msg->lParam ); |
| 511 | else |
| 512 | { |
| 513 | MOUSEHOOKSTRUCT16 *hook = SEGPTR_NEW(MOUSEHOOKSTRUCT16); |
| 514 | if (hook) |
| 515 | { |
| 516 | hook->pt = msg->pt; |
| 517 | hook->hwnd = msg->hwnd; |
| 518 | hook->wHitTestCode = HIWORD(status); |
| 519 | hook->dwExtraInfo = 0; |
| 520 | HOOK_CallHooks16( WH_CBT, HCBT_CLICKSKIPPED ,msg->message, |
| 521 | (LPARAM)SEGPTR_GET(hook) ); |
| 522 | SEGPTR_FREE(hook); |
| 523 | } |
| 524 | } |
Jesper Skov | 5c3e457 | 1998-11-01 19:27:22 +0000 | [diff] [blame^] | 525 | } |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 526 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 527 | if (remove) |
| 528 | QUEUE_RemoveMsg( sysMsgQueue, pos ); |
| 529 | /* continue */ |
| 530 | |
| 531 | case SYSQ_MSG_CONTINUE: |
| 532 | continue; |
| 533 | |
| 534 | case SYSQ_MSG_ABANDON: |
| 535 | return FALSE; |
| 536 | } |
| 537 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 538 | if (remove) |
| 539 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 540 | if (HOOK_IsHooked( WH_JOURNALRECORD )) MSG_JournalRecordMsg( msg ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 541 | QUEUE_RemoveMsg( sysMsgQueue, pos ); |
| 542 | } |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 543 | return TRUE; |
| 544 | } |
| 545 | return FALSE; |
| 546 | } |
| 547 | |
| 548 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 549 | /********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 550 | * SetDoubleClickTime16 (USER.20) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 551 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 552 | void WINAPI SetDoubleClickTime16( UINT16 interval ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 553 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 554 | SetDoubleClickTime32( interval ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 555 | } |
| 556 | |
| 557 | |
| 558 | /********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 559 | * SetDoubleClickTime32 (USER32.480) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 560 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 561 | BOOL32 WINAPI SetDoubleClickTime32( UINT32 interval ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 562 | { |
| 563 | doubleClickSpeed = interval ? interval : 500; |
| 564 | return TRUE; |
| 565 | } |
| 566 | |
| 567 | |
| 568 | /********************************************************************** |
| 569 | * GetDoubleClickTime16 (USER.21) |
| 570 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 571 | UINT16 WINAPI GetDoubleClickTime16(void) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 572 | { |
| 573 | return doubleClickSpeed; |
| 574 | } |
| 575 | |
| 576 | |
| 577 | /********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 578 | * GetDoubleClickTime32 (USER32.239) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 579 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 580 | UINT32 WINAPI GetDoubleClickTime32(void) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 581 | { |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 582 | return doubleClickSpeed; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | |
| 586 | /*********************************************************************** |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 587 | * MSG_SendMessage |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 588 | * |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 589 | * Implementation of an inter-task SendMessage. |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 590 | */ |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 591 | static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 592 | WPARAM32 wParam, LPARAM lParam, WORD flags ) |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 593 | { |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 594 | INT32 prevSMRL = debugSMRL; |
| 595 | QSMCTRL qCtrl = { 0, 1}; |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 596 | MESSAGEQUEUE *queue, *destQ; |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 597 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 598 | if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetTaskQueue(0) ))) return 0; |
| 599 | if (!(destQ = (MESSAGEQUEUE*)GlobalLock16( hDestQueue ))) return 0; |
| 600 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 601 | if (IsTaskLocked() || !IsWindow32(hwnd)) return 0; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 602 | |
| 603 | debugSMRL+=4; |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 604 | TRACE(sendmsg,"%*sSM: %s [%04x] (%04x -> %04x)\n", |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 605 | prevSMRL, "", SPY_GetMsgName(msg), msg, queue->self, hDestQueue ); |
| 606 | |
| 607 | if( !(queue->wakeBits & QS_SMPARAMSFREE) ) |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 608 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 609 | TRACE(sendmsg,"\tIntertask SendMessage: sleeping since unreplied SendMessage pending\n"); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 610 | queue->changeBits &= ~QS_SMPARAMSFREE; |
| 611 | QUEUE_WaitBits( QS_SMPARAMSFREE ); |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 612 | } |
| 613 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 614 | /* resume sending */ |
| 615 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 616 | queue->hWnd = hwnd; |
| 617 | queue->msg = msg; |
| 618 | queue->wParam = LOWORD(wParam); |
| 619 | queue->wParamHigh = HIWORD(wParam); |
| 620 | queue->lParam = lParam; |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 621 | queue->hPrevSendingTask = destQ->hSendingTask; |
| 622 | destQ->hSendingTask = GetTaskQueue(0); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 623 | |
| 624 | queue->wakeBits &= ~QS_SMPARAMSFREE; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 625 | queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 626 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 627 | TRACE(sendmsg,"%*ssm: smResultInit = %08x\n", prevSMRL, "", (unsigned)&qCtrl); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 628 | |
| 629 | queue->smResultInit = &qCtrl; |
| 630 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 631 | QUEUE_SetWakeBit( destQ, QS_SENDMESSAGE ); |
| 632 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 633 | /* perform task switch and wait for the result */ |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 634 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 635 | while( qCtrl.bPending ) |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 636 | { |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 637 | if (!(queue->wakeBits & QS_SMRESULT)) |
| 638 | { |
| 639 | queue->changeBits &= ~QS_SMRESULT; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 640 | if (THREAD_IsWin16( THREAD_Current() )) |
| 641 | DirectedYield( destQ->hTask ); |
| 642 | else |
| 643 | QUEUE_Signal( destQ->hTask ); |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 644 | QUEUE_WaitBits( QS_SMRESULT ); |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 645 | TRACE(sendmsg,"\tsm: have result!\n"); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 646 | } |
| 647 | /* got something */ |
| 648 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 649 | TRACE(sendmsg,"%*ssm: smResult = %08x\n", prevSMRL, "", (unsigned)queue->smResult ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 650 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 651 | if (queue->smResult) { /* FIXME, smResult should always be set */ |
| 652 | queue->smResult->lResult = queue->SendMessageReturn; |
| 653 | queue->smResult->bPending = FALSE; |
| 654 | } |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 655 | queue->wakeBits &= ~QS_SMRESULT; |
| 656 | |
| 657 | if( queue->smResult != &qCtrl ) |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 658 | ERR(sendmsg, "%*ssm: weird scenes inside the goldmine!\n", prevSMRL, ""); |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 659 | } |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 660 | queue->smResultInit = NULL; |
| 661 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 662 | TRACE(sendmsg,"%*sSM: [%04x] returning %08lx\n", prevSMRL, "", msg, qCtrl.lResult); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 663 | debugSMRL-=4; |
| 664 | |
| 665 | return qCtrl.lResult; |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 666 | } |
| 667 | |
| 668 | |
| 669 | /*********************************************************************** |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 670 | * ReplyMessage16 (USER.115) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 671 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 672 | void WINAPI ReplyMessage16( LRESULT result ) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 673 | { |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 674 | MESSAGEQUEUE *senderQ; |
| 675 | MESSAGEQUEUE *queue; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 676 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 677 | if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetTaskQueue(0) ))) return; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 678 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 679 | TRACE(msg,"ReplyMessage, queue %04x\n", queue->self); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 680 | |
| 681 | while( (senderQ = (MESSAGEQUEUE*)GlobalLock16( queue->InSendMessageHandle))) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 682 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 683 | TRACE(msg,"\trpm: replying to %04x (%04x -> %04x)\n", |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 684 | queue->msg, queue->self, senderQ->self); |
| 685 | |
| 686 | if( queue->wakeBits & QS_SENDMESSAGE ) |
| 687 | { |
| 688 | QUEUE_ReceiveMessage( queue ); |
| 689 | continue; /* ReceiveMessage() already called us */ |
| 690 | } |
| 691 | |
| 692 | if(!(senderQ->wakeBits & QS_SMRESULT) ) break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 693 | if (THREAD_IsWin16(THREAD_Current())) OldYield(); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 694 | } |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 695 | if( !senderQ ) { TRACE(msg,"\trpm: done\n"); return; } |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 696 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 697 | senderQ->SendMessageReturn = result; |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 698 | TRACE(msg,"\trpm: smResult = %08x, result = %08lx\n", |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 699 | (unsigned)queue->smResultCurrent, result ); |
| 700 | |
| 701 | senderQ->smResult = queue->smResultCurrent; |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 702 | queue->InSendMessageHandle = 0; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 703 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 704 | QUEUE_SetWakeBit( senderQ, QS_SMRESULT ); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 705 | if (THREAD_IsWin16(THREAD_Current())) DirectedYield( queue->hSendingTask ); |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 706 | } |
| 707 | |
| 708 | |
| 709 | /*********************************************************************** |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 710 | * MSG_PeekMessage |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 711 | */ |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 712 | static BOOL32 MSG_PeekMessage( LPMSG16 msg, HWND16 hwnd, WORD first, WORD last, |
| 713 | WORD flags, BOOL32 peek ) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 714 | { |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 715 | int pos, mask; |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 716 | MESSAGEQUEUE *msgQueue; |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 717 | HQUEUE16 hQueue; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 718 | |
Alexandre Julliard | b7258be | 1995-09-01 15:57:28 +0000 | [diff] [blame] | 719 | #ifdef CONFIG_IPC |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 720 | DDE_TestDDE(hwnd); /* do we have dde handling in the window ?*/ |
| 721 | DDE_GetRemoteMessage(); |
Alexandre Julliard | b7258be | 1995-09-01 15:57:28 +0000 | [diff] [blame] | 722 | #endif /* CONFIG_IPC */ |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 723 | |
| 724 | mask = QS_POSTMESSAGE | QS_SENDMESSAGE; /* Always selected */ |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 725 | if (first || last) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 726 | { |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 727 | if ((first <= WM_KEYLAST) && (last >= WM_KEYFIRST)) mask |= QS_KEY; |
| 728 | if ( ((first <= WM_MOUSELAST) && (last >= WM_MOUSEFIRST)) || |
| 729 | ((first <= WM_NCMOUSELAST) && (last >= WM_NCMOUSEFIRST)) ) mask |= QS_MOUSE; |
| 730 | if ((first <= WM_TIMER) && (last >= WM_TIMER)) mask |= QS_TIMER; |
| 731 | if ((first <= WM_SYSTIMER) && (last >= WM_SYSTIMER)) mask |= QS_TIMER; |
| 732 | if ((first <= WM_PAINT) && (last >= WM_PAINT)) mask |= QS_PAINT; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 733 | } |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 734 | else mask |= QS_MOUSE | QS_KEY | QS_TIMER | QS_PAINT; |
| 735 | |
| 736 | if (IsTaskLocked()) flags |= PM_NOYIELD; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 737 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 738 | /* Never yield on Win32 threads */ |
| 739 | if (!THREAD_IsWin16(THREAD_Current())) flags |= PM_NOYIELD; |
| 740 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 741 | while(1) |
| 742 | { |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 743 | hQueue = GetTaskQueue(0); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 744 | msgQueue = (MESSAGEQUEUE *)GlobalLock16( hQueue ); |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 745 | if (!msgQueue) return FALSE; |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 746 | msgQueue->changeBits = 0; |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 747 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 748 | /* First handle a message put by SendMessage() */ |
| 749 | |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 750 | while (msgQueue->wakeBits & QS_SENDMESSAGE) |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 751 | QUEUE_ReceiveMessage( msgQueue ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 752 | |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 753 | /* Now handle a WM_QUIT message */ |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 754 | |
| 755 | if (msgQueue->wPostQMsg && |
| 756 | (!first || WM_QUIT >= first) && |
| 757 | (!last || WM_QUIT <= last) ) |
| 758 | { |
| 759 | msg->hwnd = hwnd; |
| 760 | msg->message = WM_QUIT; |
| 761 | msg->wParam = msgQueue->wExitCode; |
| 762 | msg->lParam = 0; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 763 | if (flags & PM_REMOVE) msgQueue->wPostQMsg = 0; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 764 | break; |
| 765 | } |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 766 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 767 | /* Now find a normal message */ |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 768 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 769 | if (((msgQueue->wakeBits & mask) & QS_POSTMESSAGE) && |
| 770 | ((pos = QUEUE_FindMsg( msgQueue, hwnd, first, last )) != -1)) |
| 771 | { |
| 772 | QMSG *qmsg = &msgQueue->messages[pos]; |
| 773 | *msg = qmsg->msg; |
| 774 | msgQueue->GetMessageTimeVal = msg->time; |
| 775 | msgQueue->GetMessagePosVal = *(DWORD *)&msg->pt; |
| 776 | msgQueue->GetMessageExtraInfoVal = qmsg->extraInfo; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 777 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 778 | if (flags & PM_REMOVE) QUEUE_RemoveMsg( msgQueue, pos ); |
| 779 | break; |
| 780 | } |
| 781 | |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 782 | msgQueue->changeBits |= MSG_JournalPlayBackMsg(); |
| 783 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 784 | /* Now find a hardware event */ |
| 785 | |
| 786 | if (((msgQueue->wakeBits & mask) & (QS_MOUSE | QS_KEY)) && |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 787 | MSG_PeekHardwareMsg( msg, hwnd, MAKELONG(first,last), flags & PM_REMOVE )) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 788 | { |
| 789 | /* Got one */ |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 790 | msgQueue->GetMessageTimeVal = msg->time; |
| 791 | msgQueue->GetMessagePosVal = *(DWORD *)&msg->pt; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 792 | msgQueue->GetMessageExtraInfoVal = 0; /* Always 0 for now */ |
| 793 | break; |
| 794 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 795 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 796 | /* Check again for SendMessage */ |
| 797 | |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 798 | while (msgQueue->wakeBits & QS_SENDMESSAGE) |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 799 | QUEUE_ReceiveMessage( msgQueue ); |
| 800 | |
| 801 | /* Now find a WM_PAINT message */ |
| 802 | |
| 803 | if ((msgQueue->wakeBits & mask) & QS_PAINT) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 804 | { |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 805 | WND* wndPtr; |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 806 | msg->hwnd = WIN_FindWinToRepaint( hwnd , hQueue ); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 807 | msg->message = WM_PAINT; |
| 808 | msg->wParam = 0; |
| 809 | msg->lParam = 0; |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 810 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 811 | if ((wndPtr = WIN_FindWndPtr(msg->hwnd))) |
| 812 | { |
| 813 | if( wndPtr->dwStyle & WS_MINIMIZE && |
| 814 | wndPtr->class->hIcon ) |
| 815 | { |
| 816 | msg->message = WM_PAINTICON; |
| 817 | msg->wParam = 1; |
| 818 | } |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 819 | |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 820 | if( !hwnd || msg->hwnd == hwnd || IsChild16(hwnd,msg->hwnd) ) |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 821 | { |
| 822 | if( wndPtr->flags & WIN_INTERNAL_PAINT && !wndPtr->hrgnUpdate) |
| 823 | { |
| 824 | wndPtr->flags &= ~WIN_INTERNAL_PAINT; |
| 825 | QUEUE_DecPaintCount( hQueue ); |
| 826 | } |
| 827 | break; |
| 828 | } |
| 829 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 830 | } |
| 831 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 832 | /* Check for timer messages, but yield first */ |
| 833 | |
| 834 | if (!(flags & PM_NOYIELD)) |
| 835 | { |
| 836 | UserYield(); |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 837 | while (msgQueue->wakeBits & QS_SENDMESSAGE) |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 838 | QUEUE_ReceiveMessage( msgQueue ); |
| 839 | } |
| 840 | if ((msgQueue->wakeBits & mask) & QS_TIMER) |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 841 | { |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 842 | if (TIMER_GetTimerMsg(msg, hwnd, hQueue, flags & PM_REMOVE)) break; |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 843 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 844 | |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 845 | if (peek) |
| 846 | { |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 847 | if (!(flags & PM_NOYIELD)) UserYield(); |
| 848 | return FALSE; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 849 | } |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 850 | msgQueue->wakeMask = mask; |
| 851 | QUEUE_WaitBits( mask ); |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 852 | } |
| 853 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 854 | /* We got a message */ |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 855 | if (flags & PM_REMOVE) |
| 856 | { |
| 857 | WORD message = msg->message; |
| 858 | |
| 859 | if (message == WM_KEYDOWN || message == WM_SYSKEYDOWN) |
| 860 | { |
| 861 | BYTE *p = &QueueKeyStateTable[msg->wParam & 0xff]; |
| 862 | |
| 863 | if (!(*p & 0x80)) |
| 864 | *p ^= 0x01; |
| 865 | *p |= 0x80; |
| 866 | } |
| 867 | else if (message == WM_KEYUP || message == WM_SYSKEYUP) |
| 868 | QueueKeyStateTable[msg->wParam & 0xff] &= ~0x80; |
| 869 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 870 | if (peek) return TRUE; |
| 871 | else return (msg->message != WM_QUIT); |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 872 | } |
| 873 | |
| 874 | |
| 875 | /*********************************************************************** |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 876 | * MSG_InternalGetMessage |
| 877 | * |
| 878 | * GetMessage() function for internal use. Behave like GetMessage(), |
| 879 | * but also call message filters and optionally send WM_ENTERIDLE messages. |
| 880 | * 'hwnd' must be the handle of the dialog or menu window. |
| 881 | * 'code' is the message filter value (MSGF_??? codes). |
| 882 | */ |
Alexandre Julliard | 8bbf818 | 1996-09-13 16:50:47 +0000 | [diff] [blame] | 883 | BOOL32 MSG_InternalGetMessage( MSG16 *msg, HWND32 hwnd, HWND32 hwndOwner, |
| 884 | WPARAM32 code, WORD flags, BOOL32 sendIdle ) |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 885 | { |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 886 | for (;;) |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 887 | { |
| 888 | if (sendIdle) |
| 889 | { |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 890 | if (!MSG_PeekMessage( msg, 0, 0, 0, flags, TRUE )) |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 891 | { |
| 892 | /* No message present -> send ENTERIDLE and wait */ |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 893 | if (IsWindow32(hwndOwner)) |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 894 | SendMessage16( hwndOwner, WM_ENTERIDLE, |
| 895 | code, (LPARAM)hwnd ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 896 | MSG_PeekMessage( msg, 0, 0, 0, flags, FALSE ); |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 897 | } |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 898 | } |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 899 | else /* Always wait for a message */ |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 900 | MSG_PeekMessage( msg, 0, 0, 0, flags, FALSE ); |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 901 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 902 | /* Call message filters */ |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 903 | |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 904 | if (HOOK_IsHooked( WH_SYSMSGFILTER ) || HOOK_IsHooked( WH_MSGFILTER )) |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 905 | { |
| 906 | MSG16 *pmsg = SEGPTR_NEW(MSG16); |
| 907 | if (pmsg) |
| 908 | { |
| 909 | BOOL32 ret; |
| 910 | *pmsg = *msg; |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 911 | ret = ((BOOL16)HOOK_CallHooks16( WH_SYSMSGFILTER, code, 0, |
| 912 | (LPARAM)SEGPTR_GET(pmsg) ) || |
| 913 | (BOOL16)HOOK_CallHooks16( WH_MSGFILTER, code, 0, |
| 914 | (LPARAM)SEGPTR_GET(pmsg) )); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 915 | SEGPTR_FREE(pmsg); |
| 916 | if (ret) |
| 917 | { |
| 918 | /* Message filtered -> remove it from the queue */ |
| 919 | /* if it's still there. */ |
| 920 | if (!(flags & PM_REMOVE)) |
| 921 | MSG_PeekMessage( msg, 0, 0, 0, PM_REMOVE, TRUE ); |
| 922 | continue; |
| 923 | } |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | return (msg->message != WM_QUIT); |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 928 | } |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | |
| 932 | /*********************************************************************** |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 933 | * PeekMessage16 (USER.109) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 934 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 935 | BOOL16 WINAPI PeekMessage16( LPMSG16 msg, HWND16 hwnd, UINT16 first, |
| 936 | UINT16 last, UINT16 flags ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 937 | { |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 938 | return MSG_PeekMessage( msg, hwnd, first, last, flags, TRUE ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 939 | } |
| 940 | |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 941 | /*********************************************************************** |
| 942 | * PeekMessageA |
| 943 | */ |
| 944 | BOOL32 WINAPI PeekMessage32A( LPMSG32 lpmsg, HWND32 hwnd, |
| 945 | UINT32 min,UINT32 max,UINT32 wRemoveMsg) |
| 946 | { |
| 947 | MSG16 msg; |
| 948 | BOOL32 ret; |
| 949 | ret=PeekMessage16(&msg,hwnd,min,max,wRemoveMsg); |
| 950 | /* FIXME: should translate the message to Win32 */ |
| 951 | STRUCT32_MSG16to32(&msg,lpmsg); |
| 952 | return ret; |
| 953 | } |
| 954 | |
| 955 | /*********************************************************************** |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 956 | * PeekMessageW Check queue for messages |
| 957 | * |
| 958 | * Checks for a message in the thread's queue, filtered as for |
| 959 | * GetMessage(). Returns immediately whether a message is available |
| 960 | * or not. |
| 961 | * |
| 962 | * Whether a retrieved message is removed from the queue is set by the |
| 963 | * _wRemoveMsg_ flags, which should be one of the following values: |
| 964 | * |
| 965 | * PM_NOREMOVE Do not remove the message from the queue. |
| 966 | * |
| 967 | * PM_REMOVE Remove the message from the queue. |
| 968 | * |
| 969 | * In addition, PM_NOYIELD may be combined into _wRemoveMsg_ to |
| 970 | * request that the system not yield control during PeekMessage(); |
| 971 | * however applications may not rely on scheduling behavior. |
| 972 | * |
| 973 | * RETURNS |
| 974 | * |
| 975 | * Nonzero if a message is available and is retrieved, zero otherwise. |
| 976 | * |
| 977 | * CONFORMANCE |
| 978 | * |
| 979 | * ECMA-234, Win32 |
| 980 | * |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 981 | */ |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 982 | BOOL32 WINAPI PeekMessage32W( |
| 983 | LPMSG32 lpmsg, /* buffer to receive message */ |
| 984 | HWND32 hwnd, /* restrict to messages for hwnd */ |
| 985 | UINT32 min, /* minimum message to receive */ |
| 986 | UINT32 max, /* maximum message to receive */ |
| 987 | UINT32 wRemoveMsg /* removal flags */ |
| 988 | ) { |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 989 | /* FIXME: Should perform Unicode translation on specific messages */ |
| 990 | return PeekMessage32A(lpmsg,hwnd,min,max,wRemoveMsg); |
| 991 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 992 | |
| 993 | /*********************************************************************** |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 994 | * GetMessage16 (USER.108) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 995 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 996 | BOOL16 WINAPI GetMessage16( SEGPTR msg, HWND16 hwnd, UINT16 first, UINT16 last) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 997 | { |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 998 | MSG16 *lpmsg = (MSG16 *)PTR_SEG_TO_LIN(msg); |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 999 | MSG_PeekMessage( lpmsg, |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1000 | hwnd, first, last, PM_REMOVE, FALSE ); |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1001 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1002 | TRACE(msg,"message %04x, hwnd %04x, filter(%04x - %04x)\n", lpmsg->message, |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1003 | hwnd, first, last ); |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1004 | HOOK_CallHooks16( WH_GETMESSAGE, HC_ACTION, 0, (LPARAM)msg ); |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1005 | return (lpmsg->message != WM_QUIT); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1006 | } |
| 1007 | |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 1008 | /*********************************************************************** |
| 1009 | * GetMessage32A (USER32.270) |
| 1010 | */ |
| 1011 | BOOL32 WINAPI GetMessage32A(MSG32* lpmsg,HWND32 hwnd,UINT32 min,UINT32 max) |
| 1012 | { |
| 1013 | BOOL32 ret; |
| 1014 | MSG16 *msg = SEGPTR_NEW(MSG16); |
| 1015 | if (!msg) return 0; |
| 1016 | ret=GetMessage16(SEGPTR_GET(msg),(HWND16)hwnd,min,max); |
| 1017 | /* FIXME */ |
| 1018 | STRUCT32_MSG16to32(msg,lpmsg); |
| 1019 | SEGPTR_FREE(msg); |
| 1020 | return ret; |
| 1021 | } |
| 1022 | |
| 1023 | /*********************************************************************** |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1024 | * GetMessage32W (USER32.274) Retrieve next message |
| 1025 | * |
| 1026 | * GetMessage retrieves the next event from the calling thread's |
| 1027 | * queue and deposits it in *lpmsg. |
| 1028 | * |
| 1029 | * If _hwnd_ is not NULL, only messages for window _hwnd_ and its |
| 1030 | * children as specified by IsChild() are retrieved. If _hwnd_ is NULL |
| 1031 | * all application messages are retrieved. |
| 1032 | * |
| 1033 | * _min_ and _max_ specify the range of messages of interest. If |
| 1034 | * min==max==0, no filtering is performed. Useful examples are |
| 1035 | * WM_KEYFIRST and WM_KEYLAST to retrieve keyboard input, and |
| 1036 | * WM_MOUSEFIRST and WM_MOUSELAST to retrieve mouse input. |
| 1037 | * |
| 1038 | * WM_PAINT messages are not removed from the queue; they remain until |
| 1039 | * processed. Other messages are removed from the queue. |
| 1040 | * |
| 1041 | * RETURNS |
| 1042 | * |
| 1043 | * -1 on error, 0 if message is WM_QUIT, nonzero otherwise. |
| 1044 | * |
| 1045 | * CONFORMANCE |
| 1046 | * |
| 1047 | * ECMA-234, Win32 |
| 1048 | * |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 1049 | */ |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1050 | BOOL32 WINAPI GetMessage32W( |
| 1051 | MSG32* lpmsg, /* buffer to receive message */ |
| 1052 | HWND32 hwnd, /* restrict to messages for hwnd */ |
| 1053 | UINT32 min, /* minimum message to receive */ |
| 1054 | UINT32 max /* maximum message to receive */ |
| 1055 | ) { |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 1056 | BOOL32 ret; |
| 1057 | MSG16 *msg = SEGPTR_NEW(MSG16); |
| 1058 | if (!msg) return 0; |
| 1059 | ret=GetMessage16(SEGPTR_GET(msg),(HWND16)hwnd,min,max); |
| 1060 | /* FIXME */ |
| 1061 | STRUCT32_MSG16to32(msg,lpmsg); |
| 1062 | SEGPTR_FREE(msg); |
| 1063 | return ret; |
| 1064 | } |
| 1065 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1066 | |
| 1067 | /*********************************************************************** |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1068 | * PostMessage16 (USER.110) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1069 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1070 | BOOL16 WINAPI PostMessage16( HWND16 hwnd, UINT16 message, WPARAM16 wParam, |
| 1071 | LPARAM lParam ) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1072 | { |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1073 | MSG16 msg; |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 1074 | WND *wndPtr; |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 1075 | |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1076 | msg.hwnd = hwnd; |
| 1077 | msg.message = message; |
| 1078 | msg.wParam = wParam; |
| 1079 | msg.lParam = lParam; |
| 1080 | msg.time = GetTickCount(); |
| 1081 | msg.pt.x = 0; |
| 1082 | msg.pt.y = 0; |
| 1083 | |
Alexandre Julliard | b7258be | 1995-09-01 15:57:28 +0000 | [diff] [blame] | 1084 | #ifdef CONFIG_IPC |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1085 | if (DDE_PostMessage(&msg)) |
| 1086 | return TRUE; |
Alexandre Julliard | b7258be | 1995-09-01 15:57:28 +0000 | [diff] [blame] | 1087 | #endif /* CONFIG_IPC */ |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1088 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1089 | if (hwnd == HWND_BROADCAST) |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1090 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1091 | TRACE(msg,"HWND_BROADCAST !\n"); |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1092 | for (wndPtr = WIN_GetDesktop()->child; wndPtr; wndPtr = wndPtr->next) |
| 1093 | { |
| 1094 | if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) |
| 1095 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1096 | TRACE(msg,"BROADCAST Message to hWnd=%04x m=%04X w=%04X l=%08lX !\n", |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1097 | wndPtr->hwndSelf, message, wParam, lParam); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1098 | PostMessage16( wndPtr->hwndSelf, message, wParam, lParam ); |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1099 | } |
| 1100 | } |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1101 | TRACE(msg,"End of HWND_BROADCAST !\n"); |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1102 | return TRUE; |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1103 | } |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 1104 | |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1105 | wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 1106 | if (!wndPtr || !wndPtr->hmemTaskQ) return FALSE; |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 1107 | |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 1108 | return QUEUE_AddMsg( wndPtr->hmemTaskQ, &msg, 0 ); |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1109 | } |
| 1110 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1111 | |
| 1112 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1113 | * PostMessage32A (USER32.419) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1114 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1115 | BOOL32 WINAPI PostMessage32A( HWND32 hwnd, UINT32 message, WPARAM32 wParam, |
| 1116 | LPARAM lParam ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1117 | { |
Kai Morich | 54ae473 | 1998-10-24 12:01:36 +0000 | [diff] [blame] | 1118 | /* FIXME */ |
| 1119 | if (message&0xffff0000) |
| 1120 | FIXME(msg,"message is truncated from %d to %d\n", message, message&0xffff); |
| 1121 | if (wParam&0xffff0000) |
| 1122 | FIXME(msg,"wParam is truncated from %d to %d\n", wParam, wParam&0xffff); |
| 1123 | return PostMessage16( hwnd, message, wParam, lParam ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1124 | } |
| 1125 | |
| 1126 | |
| 1127 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1128 | * PostMessage32W (USER32.420) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1129 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1130 | BOOL32 WINAPI PostMessage32W( HWND32 hwnd, UINT32 message, WPARAM32 wParam, |
| 1131 | LPARAM lParam ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1132 | { |
Kai Morich | 54ae473 | 1998-10-24 12:01:36 +0000 | [diff] [blame] | 1133 | /* FIXME */ |
| 1134 | if (message&0xffff0000) |
| 1135 | FIXME(msg,"message is truncated from %d to %d\n", message, message&0xffff); |
| 1136 | if (wParam&0xffff0000) |
| 1137 | FIXME(msg,"wParam is truncated from %d to %d\n", wParam, wParam&0xffff); |
| 1138 | return PostMessage16( hwnd, message, wParam, lParam ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1139 | } |
| 1140 | |
| 1141 | |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1142 | /*********************************************************************** |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 1143 | * PostAppMessage16 (USER.116) |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1144 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1145 | BOOL16 WINAPI PostAppMessage16( HTASK16 hTask, UINT16 message, WPARAM16 wParam, |
| 1146 | LPARAM lParam ) |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1147 | { |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1148 | MSG16 msg; |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1149 | |
| 1150 | if (GetTaskQueue(hTask) == 0) return FALSE; |
| 1151 | msg.hwnd = 0; |
| 1152 | msg.message = message; |
| 1153 | msg.wParam = wParam; |
| 1154 | msg.lParam = lParam; |
| 1155 | msg.time = GetTickCount(); |
| 1156 | msg.pt.x = 0; |
| 1157 | msg.pt.y = 0; |
| 1158 | |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 1159 | return QUEUE_AddMsg( GetTaskQueue(hTask), &msg, 0 ); |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1160 | } |
| 1161 | |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1162 | |
| 1163 | /*********************************************************************** |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1164 | * SendMessage16 (USER.111) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1165 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1166 | LRESULT WINAPI SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, |
| 1167 | LPARAM lParam) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1168 | { |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1169 | WND * wndPtr; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1170 | WND **list, **ppWnd; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1171 | LRESULT ret; |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1172 | |
Alexandre Julliard | b7258be | 1995-09-01 15:57:28 +0000 | [diff] [blame] | 1173 | #ifdef CONFIG_IPC |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 1174 | MSG16 DDE_msg = { hwnd, msg, wParam, lParam }; |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1175 | if (DDE_SendMessage(&DDE_msg)) return TRUE; |
Alexandre Julliard | b7258be | 1995-09-01 15:57:28 +0000 | [diff] [blame] | 1176 | #endif /* CONFIG_IPC */ |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1177 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1178 | if (hwnd == HWND_BROADCAST) |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1179 | { |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 1180 | if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL ))) |
| 1181 | return TRUE; |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1182 | TRACE(msg,"HWND_BROADCAST !\n"); |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1183 | for (ppWnd = list; *ppWnd; ppWnd++) |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1184 | { |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1185 | wndPtr = *ppWnd; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1186 | if (!IsWindow32(wndPtr->hwndSelf)) continue; |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1187 | if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) |
| 1188 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1189 | TRACE(msg,"BROADCAST Message to hWnd=%04x m=%04X w=%04lX l=%08lX !\n", |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1190 | wndPtr->hwndSelf, msg, (DWORD)wParam, lParam); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1191 | SendMessage16( wndPtr->hwndSelf, msg, wParam, lParam ); |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 1192 | } |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1193 | } |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 1194 | HeapFree( SystemHeap, 0, list ); |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1195 | TRACE(msg,"End of HWND_BROADCAST !\n"); |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1196 | return TRUE; |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 1197 | } |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1198 | |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1199 | if (HOOK_IsHooked( WH_CALLWNDPROC )) |
| 1200 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1201 | LPCWPSTRUCT16 pmsg; |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1202 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1203 | if ((pmsg = SEGPTR_NEW(CWPSTRUCT16))) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1204 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1205 | pmsg->hwnd = hwnd; |
| 1206 | pmsg->message= msg; |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1207 | pmsg->wParam = wParam; |
| 1208 | pmsg->lParam = lParam; |
| 1209 | HOOK_CallHooks16( WH_CALLWNDPROC, HC_ACTION, 1, |
| 1210 | (LPARAM)SEGPTR_GET(pmsg) ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1211 | hwnd = pmsg->hwnd; |
| 1212 | msg = pmsg->message; |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1213 | wParam = pmsg->wParam; |
| 1214 | lParam = pmsg->lParam; |
| 1215 | SEGPTR_FREE( pmsg ); |
| 1216 | } |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1217 | } |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 1218 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 1219 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 1220 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1221 | WARN(msg, "invalid hwnd %04x\n", hwnd ); |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 1222 | return 0; |
| 1223 | } |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 1224 | if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ)) |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 1225 | return 0; /* Don't send anything if the task is dying */ |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 1226 | |
| 1227 | SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1228 | |
| 1229 | if (wndPtr->hmemTaskQ != GetTaskQueue(0)) |
| 1230 | ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, |
| 1231 | wParam, lParam, 0 ); |
| 1232 | else |
| 1233 | ret = CallWindowProc16( (WNDPROC16)wndPtr->winproc, |
| 1234 | hwnd, msg, wParam, lParam ); |
| 1235 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1236 | SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg, ret ); |
| 1237 | return ret; |
| 1238 | } |
| 1239 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1240 | /************************************************************************ |
| 1241 | * MSG_CallWndProcHook32 |
| 1242 | */ |
| 1243 | static void MSG_CallWndProcHook32( LPMSG32 pmsg, BOOL32 bUnicode ) |
| 1244 | { |
| 1245 | CWPSTRUCT32 cwp; |
| 1246 | |
| 1247 | cwp.lParam = pmsg->lParam; |
| 1248 | cwp.wParam = pmsg->wParam; |
| 1249 | cwp.message = pmsg->message; |
| 1250 | cwp.hwnd = pmsg->hwnd; |
| 1251 | |
| 1252 | if (bUnicode) HOOK_CallHooks32W(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp); |
| 1253 | else HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp ); |
| 1254 | |
| 1255 | pmsg->lParam = cwp.lParam; |
| 1256 | pmsg->wParam = cwp.wParam; |
| 1257 | pmsg->message = cwp.message; |
| 1258 | pmsg->hwnd = cwp.hwnd; |
| 1259 | } |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1260 | |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1261 | /********************************************************************** |
| 1262 | * PostThreadMessage32A (USER32.422) |
Douglas Ridgway | efaa573 | 1998-10-25 09:20:30 +0000 | [diff] [blame] | 1263 | * |
| 1264 | * BUGS |
| 1265 | * |
| 1266 | * Thread-local message queues are not supported. |
| 1267 | * |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1268 | */ |
| 1269 | BOOL32 WINAPI PostThreadMessage32A(DWORD idThread , UINT32 message, |
| 1270 | WPARAM32 wParam, LPARAM lParam ) |
| 1271 | { |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 1272 | THDB *thdb = THREAD_ID_TO_THDB(idThread); |
| 1273 | if (!thdb || !thdb->process) return FALSE; |
| 1274 | |
| 1275 | FIXME(sendmsg, "(...): Should use thread-local message queue!\n"); |
| 1276 | return PostAppMessage16(thdb->process->task, message, wParam, lParam); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1277 | } |
| 1278 | |
Marcus Meissner | 9cfe2d5 | 1998-11-01 14:02:57 +0000 | [diff] [blame] | 1279 | /********************************************************************** |
| 1280 | * PostThreadMessage32W (USER32.423) |
| 1281 | * |
| 1282 | * BUGS |
| 1283 | * |
| 1284 | * Thread-local message queues are not supported. |
| 1285 | * |
| 1286 | */ |
| 1287 | BOOL32 WINAPI PostThreadMessage32W(DWORD idThread , UINT32 message, |
| 1288 | WPARAM32 wParam, LPARAM lParam ) |
| 1289 | { |
| 1290 | THDB *thdb = THREAD_ID_TO_THDB(idThread); |
| 1291 | if (!thdb || !thdb->process) return FALSE; |
| 1292 | |
| 1293 | FIXME(sendmsg, "(...): Should use thread-local message queue!\n"); |
| 1294 | return PostAppMessage16(thdb->process->task, message, wParam, lParam); |
| 1295 | } |
| 1296 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1297 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1298 | * SendMessage32A (USER32.454) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1299 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1300 | LRESULT WINAPI SendMessage32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, |
| 1301 | LPARAM lParam ) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1302 | { |
| 1303 | WND * wndPtr; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1304 | WND **list, **ppWnd; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1305 | LRESULT ret; |
| 1306 | |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1307 | if (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1308 | { |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 1309 | if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL ))) |
| 1310 | return TRUE; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1311 | for (ppWnd = list; *ppWnd; ppWnd++) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1312 | { |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1313 | wndPtr = *ppWnd; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1314 | if (!IsWindow32(wndPtr->hwndSelf)) continue; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1315 | if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) |
| 1316 | SendMessage32A( wndPtr->hwndSelf, msg, wParam, lParam ); |
| 1317 | } |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1318 | HeapFree( SystemHeap, 0, list ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1319 | return TRUE; |
| 1320 | } |
| 1321 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1322 | if (HOOK_IsHooked( WH_CALLWNDPROC )) |
| 1323 | MSG_CallWndProcHook32( (LPMSG32)&hwnd, FALSE); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1324 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 1325 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1326 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1327 | WARN(msg, "invalid hwnd %08x\n", hwnd ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1328 | return 0; |
| 1329 | } |
Alexandre Julliard | ca22b33 | 1996-07-12 19:02:39 +0000 | [diff] [blame] | 1330 | |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 1331 | if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ)) |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 1332 | return 0; /* Don't send anything if the task is dying */ |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1333 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 1334 | SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1335 | |
| 1336 | if (wndPtr->hmemTaskQ != GetTaskQueue(0)) |
| 1337 | ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam, |
| 1338 | QUEUE_SM_WIN32 ); |
| 1339 | else |
| 1340 | ret = CallWindowProc32A( (WNDPROC32)wndPtr->winproc, |
| 1341 | hwnd, msg, wParam, lParam ); |
| 1342 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1343 | SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret ); |
| 1344 | return ret; |
| 1345 | } |
| 1346 | |
| 1347 | |
| 1348 | /*********************************************************************** |
Douglas Ridgway | efaa573 | 1998-10-25 09:20:30 +0000 | [diff] [blame] | 1349 | * SendMessage32W (USER32.459) Send Window Message |
| 1350 | * |
| 1351 | * Sends a message to the window procedure of the specified window. |
| 1352 | * SendMessage() will not return until the called window procedure |
| 1353 | * either returns or calls ReplyMessage(). |
| 1354 | * |
| 1355 | * Use PostMessage() to send message and return immediately. A window |
| 1356 | * procedure may use InSendMessage() to detect |
| 1357 | * SendMessage()-originated messages. |
| 1358 | * |
| 1359 | * Applications which communicate via HWND_BROADCAST may use |
| 1360 | * RegisterWindowMessage() to obtain a unique message to avoid conflicts |
| 1361 | * with other applications. |
| 1362 | * |
| 1363 | * CONFORMANCE |
| 1364 | * |
| 1365 | * ECMA-234, Win32 |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1366 | */ |
Douglas Ridgway | efaa573 | 1998-10-25 09:20:30 +0000 | [diff] [blame] | 1367 | LRESULT WINAPI SendMessage32W( |
| 1368 | HWND32 hwnd, /* Window to send message to. If HWND_BROADCAST, |
| 1369 | the message will be sent to all top-level windows. */ |
| 1370 | |
| 1371 | UINT32 msg, /* message */ |
| 1372 | WPARAM32 wParam, /* message parameter */ |
| 1373 | LPARAM lParam /* additional message parameter */ |
| 1374 | ) { |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1375 | WND * wndPtr; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1376 | WND **list, **ppWnd; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1377 | LRESULT ret; |
| 1378 | |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1379 | if (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1380 | { |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 1381 | if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL ))) |
| 1382 | return TRUE; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1383 | for (ppWnd = list; *ppWnd; ppWnd++) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1384 | { |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1385 | wndPtr = *ppWnd; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1386 | if (!IsWindow32(wndPtr->hwndSelf)) continue; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1387 | if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) |
| 1388 | SendMessage32W( wndPtr->hwndSelf, msg, wParam, lParam ); |
| 1389 | } |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1390 | HeapFree( SystemHeap, 0, list ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1391 | return TRUE; |
| 1392 | } |
| 1393 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1394 | if (HOOK_IsHooked( WH_CALLWNDPROC )) |
| 1395 | MSG_CallWndProcHook32( (LPMSG32)&hwnd, TRUE); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1396 | |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 1397 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1398 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1399 | WARN(msg, "invalid hwnd %08x\n", hwnd ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1400 | return 0; |
| 1401 | } |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 1402 | if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ)) |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 1403 | return 0; /* Don't send anything if the task is dying */ |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 1404 | |
| 1405 | SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1406 | |
| 1407 | if (wndPtr->hmemTaskQ != GetTaskQueue(0)) |
| 1408 | ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam, |
| 1409 | QUEUE_SM_WIN32 | QUEUE_SM_UNICODE ); |
| 1410 | else |
| 1411 | ret = CallWindowProc32W( (WNDPROC32)wndPtr->winproc, |
| 1412 | hwnd, msg, wParam, lParam ); |
| 1413 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1414 | SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret ); |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1415 | return ret; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1416 | } |
| 1417 | |
| 1418 | |
| 1419 | /*********************************************************************** |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1420 | * SendMessageTimeout16 (not a WINAPI) |
| 1421 | */ |
| 1422 | LRESULT WINAPI SendMessageTimeout16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, |
| 1423 | LPARAM lParam, UINT16 flags, |
| 1424 | UINT16 timeout, LPWORD resultp) |
| 1425 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1426 | FIXME(sendmsg, "(...): semistub\n"); |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1427 | return SendMessage16 (hwnd, msg, wParam, lParam); |
| 1428 | } |
| 1429 | |
| 1430 | |
| 1431 | /*********************************************************************** |
| 1432 | * SendMessageTimeout32A (USER32.457) |
| 1433 | */ |
| 1434 | LRESULT WINAPI SendMessageTimeout32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, |
| 1435 | LPARAM lParam, UINT32 flags, |
| 1436 | UINT32 timeout, LPDWORD resultp) |
| 1437 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1438 | FIXME(sendmsg, "(...): semistub\n"); |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1439 | return SendMessage32A (hwnd, msg, wParam, lParam); |
| 1440 | } |
| 1441 | |
| 1442 | |
| 1443 | /*********************************************************************** |
| 1444 | * SendMessageTimeout32W (USER32.458) |
| 1445 | */ |
| 1446 | LRESULT WINAPI SendMessageTimeout32W( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, |
| 1447 | LPARAM lParam, UINT32 flags, |
| 1448 | UINT32 timeout, LPDWORD resultp) |
| 1449 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1450 | FIXME(sendmsg, "(...): semistub\n"); |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1451 | return SendMessage32W (hwnd, msg, wParam, lParam); |
| 1452 | } |
| 1453 | |
| 1454 | |
| 1455 | /*********************************************************************** |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1456 | * WaitMessage (USER.112) (USER32.578) Suspend thread pending messages |
| 1457 | * |
| 1458 | * WaitMessage() suspends a thread until events appear in the thread's |
| 1459 | * queue. |
| 1460 | * |
| 1461 | * BUGS |
| 1462 | * |
| 1463 | * Is supposed to return BOOL under Win32. |
| 1464 | * |
Douglas Ridgway | efaa573 | 1998-10-25 09:20:30 +0000 | [diff] [blame] | 1465 | * Thread-local message queues are not supported. |
| 1466 | * |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1467 | * CONFORMANCE |
| 1468 | * |
| 1469 | * ECMA-234, Win32 |
| 1470 | * |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 1471 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1472 | void WINAPI WaitMessage( void ) |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 1473 | { |
Alexandre Julliard | 8b91563 | 1996-06-16 16:16:05 +0000 | [diff] [blame] | 1474 | QUEUE_WaitBits( QS_ALLINPUT ); |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 1475 | } |
| 1476 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1477 | /*********************************************************************** |
| 1478 | * MsgWaitForMultipleObjects (USER32.400) |
| 1479 | */ |
| 1480 | DWORD WINAPI MsgWaitForMultipleObjects( DWORD nCount, HANDLE32 *pHandles, |
| 1481 | BOOL32 fWaitAll, DWORD dwMilliseconds, |
| 1482 | DWORD dwWakeMask ) |
| 1483 | { |
| 1484 | DWORD retv; |
| 1485 | |
| 1486 | TDB *currTask = (TDB *)GlobalLock16( GetCurrentTask() ); |
| 1487 | HQUEUE16 hQueue = currTask? currTask->hQueue : 0; |
| 1488 | MESSAGEQUEUE *msgQueue = (MESSAGEQUEUE *)GlobalLock16( hQueue ); |
| 1489 | if (!msgQueue) return 0xFFFFFFFF; |
| 1490 | |
| 1491 | msgQueue->changeBits = 0; |
| 1492 | msgQueue->wakeMask = dwWakeMask; |
| 1493 | |
| 1494 | retv = SYNC_DoWait( nCount, pHandles, fWaitAll, dwMilliseconds, FALSE, TRUE ); |
| 1495 | |
| 1496 | return retv; |
| 1497 | } |
| 1498 | |
| 1499 | |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 1500 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1501 | struct accent_char |
| 1502 | { |
| 1503 | BYTE ac_accent; |
| 1504 | BYTE ac_char; |
| 1505 | BYTE ac_result; |
| 1506 | }; |
| 1507 | |
| 1508 | static const struct accent_char accent_chars[] = |
| 1509 | { |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1510 | /* A good idea should be to read /usr/X11/lib/X11/locale/iso8859-x/Compose */ |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1511 | {'`', 'A', '\300'}, {'`', 'a', '\340'}, |
| 1512 | {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, |
| 1513 | {'^', 'A', '\302'}, {'^', 'a', '\342'}, |
| 1514 | {'~', 'A', '\303'}, {'~', 'a', '\343'}, |
| 1515 | {'"', 'A', '\304'}, {'"', 'a', '\344'}, |
| 1516 | {'O', 'A', '\305'}, {'o', 'a', '\345'}, |
| 1517 | {'0', 'A', '\305'}, {'0', 'a', '\345'}, |
| 1518 | {'A', 'A', '\305'}, {'a', 'a', '\345'}, |
| 1519 | {'A', 'E', '\306'}, {'a', 'e', '\346'}, |
| 1520 | {',', 'C', '\307'}, {',', 'c', '\347'}, |
| 1521 | {'`', 'E', '\310'}, {'`', 'e', '\350'}, |
| 1522 | {'\'', 'E', '\311'}, {'\'', 'e', '\351'}, |
| 1523 | {'^', 'E', '\312'}, {'^', 'e', '\352'}, |
| 1524 | {'"', 'E', '\313'}, {'"', 'e', '\353'}, |
| 1525 | {'`', 'I', '\314'}, {'`', 'i', '\354'}, |
| 1526 | {'\'', 'I', '\315'}, {'\'', 'i', '\355'}, |
| 1527 | {'^', 'I', '\316'}, {'^', 'i', '\356'}, |
| 1528 | {'"', 'I', '\317'}, {'"', 'i', '\357'}, |
| 1529 | {'-', 'D', '\320'}, {'-', 'd', '\360'}, |
| 1530 | {'~', 'N', '\321'}, {'~', 'n', '\361'}, |
| 1531 | {'`', 'O', '\322'}, {'`', 'o', '\362'}, |
| 1532 | {'\'', 'O', '\323'}, {'\'', 'o', '\363'}, |
| 1533 | {'^', 'O', '\324'}, {'^', 'o', '\364'}, |
| 1534 | {'~', 'O', '\325'}, {'~', 'o', '\365'}, |
| 1535 | {'"', 'O', '\326'}, {'"', 'o', '\366'}, |
| 1536 | {'/', 'O', '\330'}, {'/', 'o', '\370'}, |
| 1537 | {'`', 'U', '\331'}, {'`', 'u', '\371'}, |
| 1538 | {'\'', 'U', '\332'}, {'\'', 'u', '\372'}, |
| 1539 | {'^', 'U', '\333'}, {'^', 'u', '\373'}, |
| 1540 | {'"', 'U', '\334'}, {'"', 'u', '\374'}, |
| 1541 | {'\'', 'Y', '\335'}, {'\'', 'y', '\375'}, |
| 1542 | {'T', 'H', '\336'}, {'t', 'h', '\376'}, |
| 1543 | {'s', 's', '\337'}, {'"', 'y', '\377'}, |
| 1544 | {'s', 'z', '\337'}, {'i', 'j', '\377'}, |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1545 | /* iso-8859-2 uses this */ |
| 1546 | {'<', 'L', '\245'}, {'<', 'l', '\265'}, /* caron */ |
| 1547 | {'<', 'S', '\251'}, {'<', 's', '\271'}, |
| 1548 | {'<', 'T', '\253'}, {'<', 't', '\273'}, |
| 1549 | {'<', 'Z', '\256'}, {'<', 'z', '\276'}, |
| 1550 | {'<', 'C', '\310'}, {'<', 'c', '\350'}, |
| 1551 | {'<', 'E', '\314'}, {'<', 'e', '\354'}, |
| 1552 | {'<', 'D', '\317'}, {'<', 'd', '\357'}, |
| 1553 | {'<', 'N', '\322'}, {'<', 'n', '\362'}, |
| 1554 | {'<', 'R', '\330'}, {'<', 'r', '\370'}, |
| 1555 | {';', 'A', '\241'}, {';', 'a', '\261'}, /* ogonek */ |
| 1556 | {';', 'E', '\312'}, {';', 'e', '\332'}, |
| 1557 | {'\'', 'Z', '\254'}, {'\'', 'z', '\274'}, /* acute */ |
| 1558 | {'\'', 'R', '\300'}, {'\'', 'r', '\340'}, |
| 1559 | {'\'', 'L', '\305'}, {'\'', 'l', '\345'}, |
| 1560 | {'\'', 'C', '\306'}, {'\'', 'c', '\346'}, |
| 1561 | {'\'', 'N', '\321'}, {'\'', 'n', '\361'}, |
| 1562 | /* collision whith S, from iso-8859-9 !!! */ |
| 1563 | {',', 'S', '\252'}, {',', 's', '\272'}, /* cedilla */ |
| 1564 | {',', 'T', '\336'}, {',', 't', '\376'}, |
| 1565 | {'.', 'Z', '\257'}, {'.', 'z', '\277'}, /* dot above */ |
| 1566 | {'/', 'L', '\243'}, {'/', 'l', '\263'}, /* slash */ |
| 1567 | {'/', 'D', '\320'}, {'/', 'd', '\360'}, |
| 1568 | {'(', 'A', '\303'}, {'(', 'a', '\343'}, /* breve */ |
| 1569 | {'\275', 'O', '\325'}, {'\275', 'o', '\365'}, /* double acute */ |
| 1570 | {'\275', 'U', '\334'}, {'\275', 'u', '\374'}, |
| 1571 | {'0', 'U', '\332'}, {'0', 'u', '\372'}, /* ring above */ |
| 1572 | /* iso-8859-3 uses this */ |
| 1573 | {'/', 'H', '\241'}, {'/', 'h', '\261'}, /* slash */ |
| 1574 | {'>', 'H', '\246'}, {'>', 'h', '\266'}, /* circumflex */ |
| 1575 | {'>', 'J', '\254'}, {'>', 'j', '\274'}, |
| 1576 | {'>', 'C', '\306'}, {'>', 'c', '\346'}, |
| 1577 | {'>', 'G', '\330'}, {'>', 'g', '\370'}, |
| 1578 | {'>', 'S', '\336'}, {'>', 's', '\376'}, |
| 1579 | /* collision whith G( from iso-8859-9 !!! */ |
| 1580 | {'(', 'G', '\253'}, {'(', 'g', '\273'}, /* breve */ |
| 1581 | {'(', 'U', '\335'}, {'(', 'u', '\375'}, |
| 1582 | /* collision whith I. from iso-8859-3 !!! */ |
| 1583 | {'.', 'I', '\251'}, {'.', 'i', '\271'}, /* dot above */ |
| 1584 | {'.', 'C', '\305'}, {'.', 'c', '\345'}, |
| 1585 | {'.', 'G', '\325'}, {'.', 'g', '\365'}, |
| 1586 | /* iso-8859-4 uses this */ |
| 1587 | {',', 'R', '\243'}, {',', 'r', '\263'}, /* cedilla */ |
| 1588 | {',', 'L', '\246'}, {',', 'l', '\266'}, |
| 1589 | {',', 'G', '\253'}, {',', 'g', '\273'}, |
| 1590 | {',', 'N', '\321'}, {',', 'n', '\361'}, |
| 1591 | {',', 'K', '\323'}, {',', 'k', '\363'}, |
| 1592 | {'~', 'I', '\245'}, {'~', 'i', '\265'}, /* tilde */ |
| 1593 | {'-', 'E', '\252'}, {'-', 'e', '\272'}, /* macron */ |
| 1594 | {'-', 'A', '\300'}, {'-', 'a', '\340'}, |
| 1595 | {'-', 'I', '\317'}, {'-', 'i', '\357'}, |
| 1596 | {'-', 'O', '\322'}, {'-', 'o', '\362'}, |
| 1597 | {'-', 'U', '\336'}, {'-', 'u', '\376'}, |
| 1598 | {'/', 'T', '\254'}, {'/', 't', '\274'}, /* slash */ |
| 1599 | {'.', 'E', '\314'}, {'.', 'e', '\344'}, /* dot above */ |
| 1600 | {';', 'I', '\307'}, {';', 'i', '\347'}, /* ogonek */ |
| 1601 | {';', 'U', '\331'}, {';', 'u', '\371'}, |
| 1602 | /* iso-8859-9 uses this */ |
| 1603 | /* iso-8859-9 has really bad choosen G( S, and I. as they collide |
| 1604 | * whith the same letters on other iso-8859-x (that is they are on |
| 1605 | * different places :-( ), if you use turkish uncomment these and |
| 1606 | * comment out the lines in iso-8859-2 and iso-8859-3 sections |
| 1607 | * FIXME: should be dynamic according to chosen language |
| 1608 | * if/when Wine has turkish support. |
| 1609 | */ |
| 1610 | /* collision whith G( from iso-8859-3 !!! */ |
| 1611 | /* {'(', 'G', '\320'}, {'(', 'g', '\360'}, */ /* breve */ |
| 1612 | /* collision whith S, from iso-8859-2 !!! */ |
| 1613 | /* {',', 'S', '\336'}, {',', 's', '\376'}, */ /* cedilla */ |
| 1614 | /* collision whith I. from iso-8859-3 !!! */ |
| 1615 | /* {'.', 'I', '\335'}, {'.', 'i', '\375'}, */ /* dot above */ |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1616 | }; |
| 1617 | |
| 1618 | |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 1619 | /*********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1620 | * MSG_DoTranslateMessage |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1621 | * |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1622 | * Implementation of TranslateMessage. |
| 1623 | * |
| 1624 | * TranslateMessage translates virtual-key messages into character-messages, |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 1625 | * as follows : |
| 1626 | * WM_KEYDOWN/WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message. |
| 1627 | * ditto replacing WM_* with WM_SYS* |
| 1628 | * This produces WM_CHAR messages only for keys mapped to ASCII characters |
| 1629 | * by the keyboard driver. |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1630 | */ |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1631 | static BOOL32 MSG_DoTranslateMessage( UINT32 message, HWND32 hwnd, |
| 1632 | WPARAM32 wParam, LPARAM lParam ) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1633 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1634 | static int dead_char; |
| 1635 | BYTE wp[2]; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1636 | |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 1637 | if (message != WM_MOUSEMOVE && message != WM_TIMER) |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1638 | TRACE(msg, "(%s, %04X, %08lX)\n", |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 1639 | SPY_GetMsgName(message), wParam, lParam ); |
| 1640 | if(message >= WM_KEYFIRST && message <= WM_KEYLAST) |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1641 | TRACE(key, "(%s, %04X, %08lX)\n", |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 1642 | SPY_GetMsgName(message), wParam, lParam ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1643 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1644 | if ((message != WM_KEYDOWN) && (message != WM_SYSKEYDOWN)) return FALSE; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1645 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1646 | TRACE(key, "Translating key %04X, scancode %04X\n", |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1647 | wParam, HIWORD(lParam) ); |
| 1648 | |
| 1649 | /* FIXME : should handle ToAscii yielding 2 */ |
| 1650 | switch (ToAscii32(wParam, HIWORD(lParam), |
| 1651 | QueueKeyStateTable,(LPWORD)wp, 0)) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1652 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1653 | case 1 : |
| 1654 | message = (message == WM_KEYDOWN) ? WM_CHAR : WM_SYSCHAR; |
| 1655 | /* Should dead chars handling go in ToAscii ? */ |
| 1656 | if (dead_char) |
| 1657 | { |
| 1658 | int i; |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 1659 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1660 | if (wp[0] == ' ') wp[0] = dead_char; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1661 | if (dead_char == 0xa2) dead_char = '('; |
| 1662 | else if (dead_char == 0xa8) dead_char = '"'; |
| 1663 | else if (dead_char == 0xb2) dead_char = ';'; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1664 | else if (dead_char == 0xb4) dead_char = '\''; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1665 | else if (dead_char == 0xb7) dead_char = '<'; |
| 1666 | else if (dead_char == 0xb8) dead_char = ','; |
| 1667 | else if (dead_char == 0xff) dead_char = '.'; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1668 | for (i = 0; i < sizeof(accent_chars)/sizeof(accent_chars[0]); i++) |
| 1669 | if ((accent_chars[i].ac_accent == dead_char) && |
| 1670 | (accent_chars[i].ac_char == wp[0])) |
| 1671 | { |
| 1672 | wp[0] = accent_chars[i].ac_result; |
| 1673 | break; |
| 1674 | } |
| 1675 | dead_char = 0; |
| 1676 | } |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1677 | TRACE(key, "1 -> PostMessage(%s)\n", SPY_GetMsgName(message)); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1678 | PostMessage16( hwnd, message, wp[0], lParam ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1679 | return TRUE; |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1680 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1681 | case -1 : |
| 1682 | message = (message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR; |
| 1683 | dead_char = wp[0]; |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1684 | TRACE(key, "-1 -> PostMessage(%s)\n", |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1685 | SPY_GetMsgName(message)); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1686 | PostMessage16( hwnd, message, wp[0], lParam ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1687 | return TRUE; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1688 | } |
| 1689 | return FALSE; |
| 1690 | } |
| 1691 | |
| 1692 | |
| 1693 | /*********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1694 | * TranslateMessage16 (USER.113) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1695 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1696 | BOOL16 WINAPI TranslateMessage16( const MSG16 *msg ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1697 | { |
| 1698 | return MSG_DoTranslateMessage( msg->message, msg->hwnd, |
| 1699 | msg->wParam, msg->lParam ); |
| 1700 | } |
| 1701 | |
| 1702 | |
| 1703 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1704 | * TranslateMessage32 (USER32.556) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1705 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1706 | BOOL32 WINAPI TranslateMessage32( const MSG32 *msg ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1707 | { |
| 1708 | return MSG_DoTranslateMessage( msg->message, msg->hwnd, |
| 1709 | msg->wParam, msg->lParam ); |
| 1710 | } |
| 1711 | |
| 1712 | |
| 1713 | /*********************************************************************** |
| 1714 | * DispatchMessage16 (USER.114) |
| 1715 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1716 | LONG WINAPI DispatchMessage16( const MSG16* msg ) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1717 | { |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1718 | WND * wndPtr; |
| 1719 | LONG retval; |
| 1720 | int painting; |
| 1721 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1722 | /* Process timer messages */ |
| 1723 | if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) |
| 1724 | { |
| 1725 | if (msg->lParam) |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1726 | { |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1727 | return CallWindowProc16( (WNDPROC16)msg->lParam, msg->hwnd, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1728 | msg->message, msg->wParam, GetTickCount() ); |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 1729 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1730 | } |
| 1731 | |
| 1732 | if (!msg->hwnd) return 0; |
| 1733 | if (!(wndPtr = WIN_FindWndPtr( msg->hwnd ))) return 0; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 1734 | if (!wndPtr->winproc) return 0; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1735 | painting = (msg->message == WM_PAINT); |
| 1736 | if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1737 | |
| 1738 | SPY_EnterMessage( SPY_DISPATCHMESSAGE16, msg->hwnd, msg->message, |
| 1739 | msg->wParam, msg->lParam ); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1740 | retval = CallWindowProc16( (WNDPROC16)wndPtr->winproc, |
| 1741 | msg->hwnd, msg->message, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1742 | msg->wParam, msg->lParam ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1743 | SPY_ExitMessage( SPY_RESULT_OK16, msg->hwnd, msg->message, retval ); |
| 1744 | |
Alexandre Julliard | 4f8c37b | 1996-01-14 18:12:01 +0000 | [diff] [blame] | 1745 | if (painting && (wndPtr = WIN_FindWndPtr( msg->hwnd )) && |
| 1746 | (wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1747 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1748 | ERR(msg, "BeginPaint not called on WM_PAINT for hwnd %04x!\n", |
| 1749 | msg->hwnd); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1750 | wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; |
Alexandre Julliard | 4f8c37b | 1996-01-14 18:12:01 +0000 | [diff] [blame] | 1751 | /* Validate the update region to avoid infinite WM_PAINT loop */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1752 | ValidateRect32( msg->hwnd, NULL ); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1753 | } |
| 1754 | return retval; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1755 | } |
| 1756 | |
| 1757 | |
| 1758 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1759 | * DispatchMessage32A (USER32.141) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1760 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1761 | LONG WINAPI DispatchMessage32A( const MSG32* msg ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1762 | { |
| 1763 | WND * wndPtr; |
| 1764 | LONG retval; |
| 1765 | int painting; |
| 1766 | |
| 1767 | /* Process timer messages */ |
| 1768 | if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) |
| 1769 | { |
| 1770 | if (msg->lParam) |
| 1771 | { |
| 1772 | /* HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
| 1773 | return CallWindowProc32A( (WNDPROC32)msg->lParam, msg->hwnd, |
| 1774 | msg->message, msg->wParam, GetTickCount() ); |
| 1775 | } |
| 1776 | } |
| 1777 | |
| 1778 | if (!msg->hwnd) return 0; |
| 1779 | if (!(wndPtr = WIN_FindWndPtr( msg->hwnd ))) return 0; |
| 1780 | if (!wndPtr->winproc) return 0; |
| 1781 | painting = (msg->message == WM_PAINT); |
| 1782 | if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; |
| 1783 | /* HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
| 1784 | |
| 1785 | SPY_EnterMessage( SPY_DISPATCHMESSAGE32, msg->hwnd, msg->message, |
| 1786 | msg->wParam, msg->lParam ); |
| 1787 | retval = CallWindowProc32A( (WNDPROC32)wndPtr->winproc, |
| 1788 | msg->hwnd, msg->message, |
| 1789 | msg->wParam, msg->lParam ); |
| 1790 | SPY_ExitMessage( SPY_RESULT_OK32, msg->hwnd, msg->message, retval ); |
| 1791 | |
| 1792 | if (painting && (wndPtr = WIN_FindWndPtr( msg->hwnd )) && |
| 1793 | (wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate) |
| 1794 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1795 | ERR(msg, "BeginPaint not called on WM_PAINT for hwnd %04x!\n", |
| 1796 | msg->hwnd); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1797 | wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; |
| 1798 | /* Validate the update region to avoid infinite WM_PAINT loop */ |
| 1799 | ValidateRect32( msg->hwnd, NULL ); |
| 1800 | } |
| 1801 | return retval; |
| 1802 | } |
| 1803 | |
| 1804 | |
| 1805 | /*********************************************************************** |
Douglas Ridgway | efaa573 | 1998-10-25 09:20:30 +0000 | [diff] [blame] | 1806 | * DispatchMessage32W (USER32.142) Process Message |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1807 | * |
| 1808 | * Process the message specified in the structure *_msg_. |
| 1809 | * |
| 1810 | * If the lpMsg parameter points to a WM_TIMER message and the |
| 1811 | * parameter of the WM_TIMER message is not NULL, the lParam parameter |
| 1812 | * points to the function that is called instead of the window |
| 1813 | * procedure. |
| 1814 | * |
| 1815 | * The message must be valid. |
| 1816 | * |
| 1817 | * RETURNS |
| 1818 | * |
| 1819 | * DispatchMessage() returns the result of the window procedure invoked. |
| 1820 | * |
| 1821 | * CONFORMANCE |
| 1822 | * |
| 1823 | * ECMA-234, Win32 |
| 1824 | * |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1825 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1826 | LONG WINAPI DispatchMessage32W( const MSG32* msg ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1827 | { |
| 1828 | WND * wndPtr; |
| 1829 | LONG retval; |
| 1830 | int painting; |
| 1831 | |
| 1832 | /* Process timer messages */ |
| 1833 | if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) |
| 1834 | { |
| 1835 | if (msg->lParam) |
| 1836 | { |
| 1837 | /* HOOK_CallHooks32W( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
| 1838 | return CallWindowProc32W( (WNDPROC32)msg->lParam, msg->hwnd, |
| 1839 | msg->message, msg->wParam, GetTickCount() ); |
| 1840 | } |
| 1841 | } |
| 1842 | |
| 1843 | if (!msg->hwnd) return 0; |
| 1844 | if (!(wndPtr = WIN_FindWndPtr( msg->hwnd ))) return 0; |
| 1845 | if (!wndPtr->winproc) return 0; |
| 1846 | painting = (msg->message == WM_PAINT); |
| 1847 | if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; |
| 1848 | /* HOOK_CallHooks32W( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
| 1849 | |
| 1850 | SPY_EnterMessage( SPY_DISPATCHMESSAGE32, msg->hwnd, msg->message, |
| 1851 | msg->wParam, msg->lParam ); |
| 1852 | retval = CallWindowProc32W( (WNDPROC32)wndPtr->winproc, |
| 1853 | msg->hwnd, msg->message, |
| 1854 | msg->wParam, msg->lParam ); |
| 1855 | SPY_ExitMessage( SPY_RESULT_OK32, msg->hwnd, msg->message, retval ); |
| 1856 | |
| 1857 | if (painting && (wndPtr = WIN_FindWndPtr( msg->hwnd )) && |
| 1858 | (wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate) |
| 1859 | { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1860 | ERR(msg, "BeginPaint not called on WM_PAINT for hwnd %04x!\n", |
| 1861 | msg->hwnd); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1862 | wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; |
| 1863 | /* Validate the update region to avoid infinite WM_PAINT loop */ |
| 1864 | ValidateRect32( msg->hwnd, NULL ); |
| 1865 | } |
| 1866 | return retval; |
| 1867 | } |
| 1868 | |
| 1869 | |
| 1870 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1871 | * RegisterWindowMessage16 (USER.118) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1872 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1873 | WORD WINAPI RegisterWindowMessage16( SEGPTR str ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1874 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1875 | TRACE(msg, "%08lx\n", (DWORD)str ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1876 | return GlobalAddAtom16( str ); |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1877 | } |
| 1878 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1879 | |
| 1880 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1881 | * RegisterWindowMessage32A (USER32.437) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1882 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1883 | WORD WINAPI RegisterWindowMessage32A( LPCSTR str ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1884 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1885 | TRACE(msg, "%s\n", str ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1886 | return GlobalAddAtom32A( str ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1887 | } |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1888 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1889 | |
| 1890 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1891 | * RegisterWindowMessage32W (USER32.438) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1892 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1893 | WORD WINAPI RegisterWindowMessage32W( LPCWSTR str ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1894 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1895 | TRACE(msg, "%p\n", str ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1896 | return GlobalAddAtom32W( str ); |
| 1897 | } |
| 1898 | |
| 1899 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1900 | /*********************************************************************** |
Douglas Ridgway | efaa573 | 1998-10-25 09:20:30 +0000 | [diff] [blame] | 1901 | * GetTickCount (USER.13) (KERNEL32.299) System Time |
| 1902 | * Returns the number of milliseconds, modulo 2^32, since the start |
| 1903 | * of the current session. |
| 1904 | * |
| 1905 | * CONFORMANCE |
| 1906 | * |
| 1907 | * ECMA-234, Win32 |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1908 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1909 | DWORD WINAPI GetTickCount(void) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1910 | { |
| 1911 | struct timeval t; |
| 1912 | gettimeofday( &t, NULL ); |
Rein Klazes | 43daa7a | 1998-10-11 14:04:10 +0000 | [diff] [blame] | 1913 | /* make extremely compatible: granularity is 25 msec */ |
| 1914 | return ((t.tv_sec * 1000) + (t.tv_usec / 25000) * 25) - MSG_WineStartTicks; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1915 | } |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1916 | |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 1917 | |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1918 | /*********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1919 | * GetCurrentTime16 (USER.15) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 1920 | * |
| 1921 | * (effectively identical to GetTickCount) |
Alexandre Julliard | ade697e | 1995-11-26 13:59:11 +0000 | [diff] [blame] | 1922 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1923 | DWORD WINAPI GetCurrentTime16(void) |
Alexandre Julliard | ade697e | 1995-11-26 13:59:11 +0000 | [diff] [blame] | 1924 | { |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 1925 | return GetTickCount(); |
Alexandre Julliard | ade697e | 1995-11-26 13:59:11 +0000 | [diff] [blame] | 1926 | } |
| 1927 | |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 1928 | |
Alexandre Julliard | ade697e | 1995-11-26 13:59:11 +0000 | [diff] [blame] | 1929 | /*********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1930 | * InSendMessage16 (USER.192) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1931 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1932 | BOOL16 WINAPI InSendMessage16(void) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1933 | { |
| 1934 | return InSendMessage32(); |
| 1935 | } |
| 1936 | |
| 1937 | |
| 1938 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1939 | * InSendMessage32 (USER32.320) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1940 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1941 | BOOL32 WINAPI InSendMessage32(void) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1942 | { |
Alexandre Julliard | ef702d8 | 1996-05-28 18:54:58 +0000 | [diff] [blame] | 1943 | MESSAGEQUEUE *queue; |
| 1944 | |
| 1945 | if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) |
| 1946 | return 0; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1947 | return (BOOL32)queue->InSendMessageHandle; |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1948 | } |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1949 | |
| 1950 | /*********************************************************************** |
| 1951 | * BroadcastSystemMessage (USER32.12) |
| 1952 | */ |
| 1953 | LONG WINAPI BroadcastSystemMessage( |
| 1954 | DWORD dwFlags,LPDWORD recipients,UINT32 uMessage,WPARAM32 wParam, |
| 1955 | LPARAM lParam |
| 1956 | ) { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1957 | FIXME(sendmsg,"(%08lx,%08lx,%08x,%08x,%08lx): stub!\n", |
| 1958 | dwFlags,*recipients,uMessage,wParam,lParam |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1959 | ); |
| 1960 | return 0; |
| 1961 | } |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1962 | |
| 1963 | /*********************************************************************** |
| 1964 | * SendNotifyMessageA (USER32.460) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1965 | * FIXME |
| 1966 | * The message sended with PostMessage has to be put in the queue |
| 1967 | * with a higher priority as the other "Posted" messages. |
| 1968 | * QUEUE_AddMsg has to be modifyed. |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1969 | */ |
| 1970 | LONG WINAPI SendNotifyMessage32A(HWND32 hwnd,UINT32 msg,WPARAM32 wParam,LPARAM lParam) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1971 | { BOOL32 ret = TRUE; |
| 1972 | FIXME(msg,"(%04x,%08x,%08x,%08lx) not complete\n", |
| 1973 | hwnd, msg, wParam, lParam); |
| 1974 | |
| 1975 | if ( GetCurrentThreadId() == GetWindowThreadProcessId ( hwnd, NULL)) |
| 1976 | { ret=SendMessage32A ( hwnd, msg, wParam, lParam ); |
| 1977 | } |
| 1978 | else |
| 1979 | { PostMessage32A ( hwnd, msg, wParam, lParam ); |
| 1980 | } |
| 1981 | return ret; |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1982 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1983 | /*********************************************************************** |
| 1984 | * SendMessageCallBack32A |
| 1985 | * FIXME: It's like PostMessage. The callback gets called when the message |
| 1986 | * is processed. We have to modify the message processing for a exact |
| 1987 | * implementation... |
| 1988 | */ |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1989 | BOOL32 WINAPI SendMessageCallBack32A( |
| 1990 | HWND32 hWnd,UINT32 Msg,WPARAM32 wParam,LPARAM lParam, |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1991 | FARPROC32 lpResultCallBack,DWORD dwData) |
| 1992 | { |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1993 | FIXME(msg,"(0x%04x,0x%04x,0x%08x,0x%08lx,%p,0x%08lx),stub!\n", |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1994 | hWnd,Msg,wParam,lParam,lpResultCallBack,dwData); |
| 1995 | if ( hWnd == HWND_BROADCAST) |
| 1996 | { PostMessage32A( hWnd, Msg, wParam, lParam); |
| 1997 | FIXME(msg,"Broadcast: Callback will not be called!\n"); |
| 1998 | return TRUE; |
| 1999 | } |
| 2000 | (lpResultCallBack)( hWnd, Msg, dwData, SendMessage32A ( hWnd, Msg, wParam, lParam )); |
| 2001 | return TRUE; |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 2002 | } |