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 | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 21 | #include <stdlib.h> |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 22 | #include <string.h> |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 23 | #include <ctype.h> |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 24 | #include <sys/time.h> |
| 25 | #include <sys/types.h> |
Alexandre Julliard | f41aeca | 1993-09-14 16:47:10 +0000 | [diff] [blame] | 26 | |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 27 | #include "winbase.h" |
| 28 | #include "wingdi.h" |
| 29 | #include "winuser.h" |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 30 | #include "message.h" |
Alexandre Julliard | dbf2bf0 | 1999-01-01 17:05:53 +0000 | [diff] [blame] | 31 | #include "winerror.h" |
Alexandre Julliard | 37e9503 | 2001-07-19 00:39:09 +0000 | [diff] [blame] | 32 | #include "wine/server.h" |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 33 | #include "win.h" |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 34 | #include "heap.h" |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 35 | #include "hook.h" |
Ulrich Weigand | a11ce32 | 1998-11-08 12:27:26 +0000 | [diff] [blame] | 36 | #include "input.h" |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 37 | #include "spy.h" |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 38 | #include "winpos.h" |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 39 | #include "dde.h" |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 40 | #include "queue.h" |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 41 | #include "winproc.h" |
Alexandre Julliard | 4323004 | 2001-05-16 19:52:29 +0000 | [diff] [blame] | 42 | #include "user.h" |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 43 | #include "thread.h" |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 44 | #include "task.h" |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 45 | #include "controls.h" |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 46 | #include "wine/debug.h" |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 47 | |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 48 | WINE_DEFAULT_DEBUG_CHANNEL(msg); |
| 49 | WINE_DECLARE_DEBUG_CHANNEL(key); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 50 | |
Alexandre Julliard | ac9c9b0 | 1996-07-28 18:50:11 +0000 | [diff] [blame] | 51 | #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE |
| 52 | #define WM_NCMOUSELAST WM_NCMBUTTONDBLCLK |
| 53 | |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 54 | static BYTE QueueKeyStateTable[256]; |
Stephane Lussier | 2c86dab | 1999-02-18 17:34:09 +0000 | [diff] [blame] | 55 | |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 56 | |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 57 | /*********************************************************************** |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 58 | * is_keyboard_message |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 59 | */ |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 60 | inline static BOOL is_keyboard_message( UINT message ) |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 61 | { |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 62 | return (message >= WM_KEYFIRST && message <= WM_KEYLAST); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 63 | } |
| 64 | |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 65 | |
| 66 | /*********************************************************************** |
| 67 | * is_mouse_message |
| 68 | */ |
| 69 | inline static BOOL is_mouse_message( UINT message ) |
| 70 | { |
| 71 | return ((message >= WM_NCMOUSEFIRST && message <= WM_NCMOUSELAST) || |
| 72 | (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST)); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /*********************************************************************** |
| 77 | * check_message_filter |
| 78 | */ |
| 79 | inline static BOOL check_message_filter( const MSG *msg, HWND hwnd, UINT first, UINT last ) |
| 80 | { |
| 81 | if (hwnd) |
| 82 | { |
| 83 | if (msg->hwnd != hwnd && !IsChild( hwnd, msg->hwnd )) return FALSE; |
| 84 | } |
| 85 | if (first || last) |
| 86 | { |
| 87 | return (msg->message >= first && msg->message <= last); |
| 88 | } |
| 89 | return TRUE; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | /*********************************************************************** |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 94 | * process_sent_messages |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 95 | * |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 96 | * Process all pending sent messages. |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 97 | */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 98 | inline static void process_sent_messages(void) |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 99 | { |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 100 | MSG msg; |
| 101 | MSG_peek_message( &msg, 0, 0, 0, GET_MSG_REMOVE | GET_MSG_SENT_ONLY ); |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | |
| 105 | /*********************************************************************** |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 106 | * queue_hardware_message |
| 107 | * |
| 108 | * store a hardware message in the thread queue |
| 109 | */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 110 | static void queue_hardware_message( MSG *msg, ULONG_PTR extra_info, enum message_type type ) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 111 | { |
| 112 | SERVER_START_REQ( send_message ) |
| 113 | { |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 114 | req->type = type; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 115 | req->id = (void *)GetWindowThreadProcessId( msg->hwnd, NULL ); |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 116 | req->win = msg->hwnd; |
| 117 | req->msg = msg->message; |
| 118 | req->wparam = msg->wParam; |
| 119 | req->lparam = msg->lParam; |
| 120 | req->x = msg->pt.x; |
| 121 | req->y = msg->pt.y; |
| 122 | req->time = msg->time; |
| 123 | req->info = extra_info; |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 124 | req->timeout = 0; |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 125 | wine_server_call( req ); |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 126 | } |
| 127 | SERVER_END_REQ; |
| 128 | } |
| 129 | |
| 130 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 131 | /*********************************************************************** |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 132 | * update_queue_key_state |
| 133 | */ |
| 134 | static void update_queue_key_state( UINT msg, WPARAM wp ) |
| 135 | { |
| 136 | BOOL down = FALSE; |
| 137 | |
| 138 | switch (msg) |
| 139 | { |
| 140 | case WM_LBUTTONDOWN: |
| 141 | down = TRUE; |
| 142 | /* fall through */ |
| 143 | case WM_LBUTTONUP: |
| 144 | wp = VK_LBUTTON; |
| 145 | break; |
| 146 | case WM_MBUTTONDOWN: |
| 147 | down = TRUE; |
| 148 | /* fall through */ |
| 149 | case WM_MBUTTONUP: |
| 150 | wp = VK_MBUTTON; |
| 151 | break; |
| 152 | case WM_RBUTTONDOWN: |
| 153 | down = TRUE; |
| 154 | /* fall through */ |
| 155 | case WM_RBUTTONUP: |
| 156 | wp = VK_RBUTTON; |
| 157 | break; |
| 158 | case WM_KEYDOWN: |
| 159 | case WM_SYSKEYDOWN: |
| 160 | down = TRUE; |
| 161 | /* fall through */ |
| 162 | case WM_KEYUP: |
| 163 | case WM_SYSKEYUP: |
| 164 | wp = wp & 0xff; |
| 165 | break; |
| 166 | } |
| 167 | if (down) |
| 168 | { |
| 169 | BYTE *p = &QueueKeyStateTable[wp]; |
| 170 | if (!(*p & 0x80)) *p ^= 0x01; |
| 171 | *p |= 0x80; |
| 172 | } |
| 173 | else QueueKeyStateTable[wp] &= ~0x80; |
| 174 | } |
| 175 | |
| 176 | |
| 177 | /*********************************************************************** |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 178 | * MSG_SendParentNotify |
| 179 | * |
| 180 | * Send a WM_PARENTNOTIFY to all ancestors of the given window, unless |
| 181 | * the window has the WS_EX_NOPARENTNOTIFY style. |
| 182 | */ |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 183 | static void MSG_SendParentNotify( HWND hwnd, WORD event, WORD idChild, POINT pt ) |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 184 | { |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 185 | /* pt has to be in the client coordinates of the parent window */ |
Alexandre Julliard | 4ff32c8 | 2001-08-18 18:08:26 +0000 | [diff] [blame] | 186 | MapWindowPoints( 0, hwnd, &pt, 1 ); |
| 187 | for (;;) |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 188 | { |
Alexandre Julliard | 4ff32c8 | 2001-08-18 18:08:26 +0000 | [diff] [blame] | 189 | HWND parent; |
| 190 | |
| 191 | if (!(GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD)) break; |
| 192 | if (GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) break; |
| 193 | if (!(parent = GetParent(hwnd))) break; |
| 194 | MapWindowPoints( hwnd, parent, &pt, 1 ); |
| 195 | hwnd = parent; |
| 196 | SendMessageA( hwnd, WM_PARENTNOTIFY, |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 197 | MAKEWPARAM( event, idChild ), MAKELPARAM( pt.x, pt.y ) ); |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 198 | } |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | |
| 202 | /*********************************************************************** |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 203 | * MSG_JournalPlayBackMsg |
| 204 | * |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 205 | * Get an EVENTMSG struct via call JOURNALPLAYBACK hook function |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 206 | */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 207 | void MSG_JournalPlayBackMsg(void) |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 208 | { |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 209 | EVENTMSG tmpMsg; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 210 | MSG msg; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 211 | LRESULT wtime; |
| 212 | int keyDown,i; |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 213 | |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 214 | if (!HOOK_IsHooked( WH_JOURNALPLAYBACK )) return; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 215 | |
| 216 | wtime=HOOK_CallHooksA( WH_JOURNALPLAYBACK, HC_GETNEXT, 0, (LPARAM)&tmpMsg ); |
| 217 | /* TRACE(msg,"Playback wait time =%ld\n",wtime); */ |
| 218 | if (wtime<=0) |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 219 | { |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 220 | wtime=0; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 221 | msg.message = tmpMsg.message; |
| 222 | msg.hwnd = tmpMsg.hwnd; |
| 223 | msg.time = tmpMsg.time; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 224 | if ((tmpMsg.message >= WM_KEYFIRST) && (tmpMsg.message <= WM_KEYLAST)) |
| 225 | { |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 226 | msg.wParam = tmpMsg.paramL & 0xFF; |
| 227 | msg.lParam = MAKELONG(tmpMsg.paramH&0x7ffff,tmpMsg.paramL>>8); |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 228 | if (tmpMsg.message == WM_KEYDOWN || tmpMsg.message == WM_SYSKEYDOWN) |
| 229 | { |
| 230 | for (keyDown=i=0; i<256 && !keyDown; i++) |
| 231 | if (InputKeyStateTable[i] & 0x80) |
| 232 | keyDown++; |
| 233 | if (!keyDown) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 234 | msg.lParam |= 0x40000000; |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 235 | InputKeyStateTable[msg.wParam] |= 0x80; |
| 236 | AsyncKeyStateTable[msg.wParam] |= 0x80; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 237 | } |
| 238 | else /* WM_KEYUP, WM_SYSKEYUP */ |
| 239 | { |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 240 | msg.lParam |= 0xC0000000; |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 241 | InputKeyStateTable[msg.wParam] &= ~0x80; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 242 | } |
| 243 | if (InputKeyStateTable[VK_MENU] & 0x80) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 244 | msg.lParam |= 0x20000000; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 245 | if (tmpMsg.paramH & 0x8000) /*special_key bit*/ |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 246 | msg.lParam |= 0x01000000; |
| 247 | |
| 248 | msg.pt.x = msg.pt.y = 0; |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 249 | queue_hardware_message( &msg, 0, MSG_HARDWARE_RAW ); |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 250 | } |
| 251 | else if ((tmpMsg.message>= WM_MOUSEFIRST) && (tmpMsg.message <= WM_MOUSELAST)) |
| 252 | { |
| 253 | switch (tmpMsg.message) |
| 254 | { |
| 255 | case WM_LBUTTONDOWN: |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 256 | InputKeyStateTable[VK_LBUTTON] |= 0x80; |
| 257 | AsyncKeyStateTable[VK_LBUTTON] |= 0x80; |
| 258 | break; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 259 | case WM_LBUTTONUP: |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 260 | InputKeyStateTable[VK_LBUTTON] &= ~0x80; |
| 261 | break; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 262 | case WM_MBUTTONDOWN: |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 263 | InputKeyStateTable[VK_MBUTTON] |= 0x80; |
| 264 | AsyncKeyStateTable[VK_MBUTTON] |= 0x80; |
| 265 | break; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 266 | case WM_MBUTTONUP: |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 267 | InputKeyStateTable[VK_MBUTTON] &= ~0x80; |
| 268 | break; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 269 | case WM_RBUTTONDOWN: |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 270 | InputKeyStateTable[VK_RBUTTON] |= 0x80; |
| 271 | AsyncKeyStateTable[VK_RBUTTON] |= 0x80; |
| 272 | break; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 273 | case WM_RBUTTONUP: |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 274 | InputKeyStateTable[VK_RBUTTON] &= ~0x80; |
| 275 | break; |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 276 | } |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 277 | SetCursorPos(tmpMsg.paramL,tmpMsg.paramH); |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 278 | msg.lParam=MAKELONG(tmpMsg.paramL,tmpMsg.paramH); |
| 279 | msg.wParam=0; |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 280 | if (InputKeyStateTable[VK_LBUTTON] & 0x80) msg.wParam |= MK_LBUTTON; |
| 281 | if (InputKeyStateTable[VK_MBUTTON] & 0x80) msg.wParam |= MK_MBUTTON; |
| 282 | if (InputKeyStateTable[VK_RBUTTON] & 0x80) msg.wParam |= MK_RBUTTON; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 283 | |
| 284 | msg.pt.x = tmpMsg.paramL; |
| 285 | msg.pt.y = tmpMsg.paramH; |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 286 | queue_hardware_message( &msg, 0, MSG_HARDWARE_RAW ); |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 287 | } |
| 288 | HOOK_CallHooksA( WH_JOURNALPLAYBACK, HC_SKIP, 0, (LPARAM)&tmpMsg); |
Alexandre Julliard | d1ce8b2 | 1996-09-02 16:46:30 +0000 | [diff] [blame] | 289 | } |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 290 | else |
| 291 | { |
| 292 | if( tmpMsg.message == WM_QUEUESYNC ) |
| 293 | if (HOOK_IsHooked( WH_CBT )) |
| 294 | HOOK_CallHooksA( WH_CBT, HCBT_QS, 0, 0L); |
Alexandre Julliard | da2892c | 2001-02-23 01:13:42 +0000 | [diff] [blame] | 295 | } |
| 296 | } |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 297 | |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 298 | |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 299 | /*********************************************************************** |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 300 | * process_raw_keyboard_message |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 301 | * |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 302 | * returns TRUE if the contents of 'msg' should be passed to the application |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 303 | */ |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 304 | static BOOL process_raw_keyboard_message( MSG *msg, ULONG_PTR extra_info ) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 305 | { |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 306 | if (!(msg->hwnd = GetFocus())) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 307 | { |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 308 | /* Send the message to the active window instead, */ |
| 309 | /* translating messages to their WM_SYS equivalent */ |
| 310 | msg->hwnd = GetActiveWindow(); |
| 311 | if (msg->message < WM_SYSKEYDOWN) msg->message += WM_SYSKEYDOWN - WM_KEYDOWN; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 312 | } |
Noel Borthwick | c90243b | 1999-05-14 08:09:13 +0000 | [diff] [blame] | 313 | |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 314 | if (HOOK_IsHooked( WH_JOURNALRECORD )) |
| 315 | { |
| 316 | EVENTMSG event; |
| 317 | |
| 318 | event.message = msg->message; |
| 319 | event.hwnd = msg->hwnd; |
| 320 | event.time = msg->time; |
| 321 | event.paramL = (msg->wParam & 0xFF) | (HIWORD(msg->lParam) << 8); |
| 322 | event.paramH = msg->lParam & 0x7FFF; |
| 323 | if (HIWORD(msg->lParam) & 0x0100) event.paramH |= 0x8000; /* special_key - bit */ |
| 324 | HOOK_CallHooksA( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event ); |
| 325 | } |
| 326 | |
| 327 | return (msg->hwnd != 0); |
| 328 | } |
| 329 | |
| 330 | |
| 331 | /*********************************************************************** |
| 332 | * process_cooked_keyboard_message |
| 333 | * |
| 334 | * returns TRUE if the contents of 'msg' should be passed to the application |
| 335 | */ |
| 336 | static BOOL process_cooked_keyboard_message( MSG *msg, BOOL remove ) |
| 337 | { |
| 338 | if (remove) |
| 339 | { |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 340 | update_queue_key_state( msg->message, msg->wParam ); |
| 341 | |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 342 | /* Handle F1 key by sending out WM_HELP message */ |
| 343 | if ((msg->message == WM_KEYUP) && |
| 344 | (msg->wParam == VK_F1) && |
| 345 | (msg->hwnd != GetDesktopWindow()) && |
| 346 | !MENU_IsMenuActive()) |
| 347 | { |
| 348 | HELPINFO hi; |
| 349 | hi.cbSize = sizeof(HELPINFO); |
| 350 | hi.iContextType = HELPINFO_WINDOW; |
| 351 | hi.iCtrlId = GetWindowLongA( msg->hwnd, GWL_ID ); |
| 352 | hi.hItemHandle = msg->hwnd; |
| 353 | hi.dwContextId = GetWindowContextHelpId( msg->hwnd ); |
| 354 | hi.MousePos = msg->pt; |
| 355 | SendMessageA(msg->hwnd, WM_HELP, 0, (LPARAM)&hi); |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | if (HOOK_CallHooksA( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE, |
| 360 | LOWORD(msg->wParam), msg->lParam )) |
| 361 | { |
| 362 | /* skip this message */ |
| 363 | HOOK_CallHooksA( WH_CBT, HCBT_KEYSKIPPED, LOWORD(msg->wParam), msg->lParam ); |
| 364 | return FALSE; |
| 365 | } |
| 366 | return TRUE; |
| 367 | } |
| 368 | |
| 369 | |
| 370 | /*********************************************************************** |
| 371 | * process_raw_mouse_message |
| 372 | * |
| 373 | * returns TRUE if the contents of 'msg' should be passed to the application |
| 374 | */ |
| 375 | static BOOL process_raw_mouse_message( MSG *msg, ULONG_PTR extra_info ) |
| 376 | { |
| 377 | static MSG clk_msg; |
| 378 | |
| 379 | POINT pt; |
| 380 | INT ht, hittest; |
| 381 | |
| 382 | /* find the window to dispatch this mouse message to */ |
| 383 | |
Alexandre Julliard | ee8ab7a | 2001-06-20 23:16:34 +0000 | [diff] [blame] | 384 | hittest = HTCLIENT; |
| 385 | if (!(msg->hwnd = PERQDATA_GetCaptureWnd( &ht ))) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 386 | { |
| 387 | /* If no capture HWND, find window which contains the mouse position. |
| 388 | * Also find the position of the cursor hot spot (hittest) */ |
| 389 | HWND hWndScope = (HWND)extra_info; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 390 | |
Alexandre Julliard | ee8ab7a | 2001-06-20 23:16:34 +0000 | [diff] [blame] | 391 | if (!IsWindow(hWndScope)) hWndScope = 0; |
| 392 | if (!(msg->hwnd = WINPOS_WindowFromPoint( hWndScope, msg->pt, &hittest ))) |
| 393 | msg->hwnd = GetDesktopWindow(); |
| 394 | ht = hittest; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | if (HOOK_IsHooked( WH_JOURNALRECORD )) |
| 398 | { |
| 399 | EVENTMSG event; |
| 400 | event.message = msg->message; |
| 401 | event.time = msg->time; |
| 402 | event.hwnd = msg->hwnd; |
| 403 | event.paramL = msg->pt.x; |
| 404 | event.paramH = msg->pt.y; |
| 405 | HOOK_CallHooksA( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event ); |
| 406 | } |
| 407 | |
| 408 | /* translate double clicks */ |
| 409 | |
| 410 | if ((msg->message == WM_LBUTTONDOWN) || |
| 411 | (msg->message == WM_RBUTTONDOWN) || |
| 412 | (msg->message == WM_MBUTTONDOWN)) |
| 413 | { |
| 414 | BOOL update = TRUE; |
| 415 | /* translate double clicks - |
| 416 | * note that ...MOUSEMOVEs can slip in between |
| 417 | * ...BUTTONDOWN and ...BUTTONDBLCLK messages */ |
| 418 | |
| 419 | if (GetClassLongA( msg->hwnd, GCL_STYLE ) & CS_DBLCLKS || ht != HTCLIENT ) |
| 420 | { |
| 421 | if ((msg->message == clk_msg.message) && |
| 422 | (msg->hwnd == clk_msg.hwnd) && |
Andriy Palamarchuk | 2489dc9 | 2001-12-06 22:28:43 +0000 | [diff] [blame] | 423 | (msg->time - clk_msg.time < GetDoubleClickTime()) && |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 424 | (abs(msg->pt.x - clk_msg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK)/2) && |
| 425 | (abs(msg->pt.y - clk_msg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK)/2)) |
| 426 | { |
| 427 | msg->message += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); |
| 428 | clk_msg.message = 0; |
| 429 | update = FALSE; |
| 430 | } |
| 431 | } |
| 432 | /* update static double click conditions */ |
| 433 | if (update) clk_msg = *msg; |
| 434 | } |
| 435 | |
| 436 | pt = msg->pt; |
Travis Michielsen | b9bd3f8 | 2001-06-29 01:17:55 +0000 | [diff] [blame] | 437 | /* Note: windows has no concept of a non-client wheel message */ |
| 438 | if (hittest != HTCLIENT && msg->message != WM_MOUSEWHEEL) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 439 | { |
| 440 | msg->message += WM_NCMOUSEMOVE - WM_MOUSEMOVE; |
| 441 | msg->wParam = hittest; |
| 442 | } |
| 443 | else ScreenToClient( msg->hwnd, &pt ); |
| 444 | msg->lParam = MAKELONG( pt.x, pt.y ); |
| 445 | return TRUE; |
| 446 | } |
| 447 | |
| 448 | |
| 449 | /*********************************************************************** |
| 450 | * process_cooked_mouse_message |
| 451 | * |
| 452 | * returns TRUE if the contents of 'msg' should be passed to the application |
| 453 | */ |
Alexandre Julliard | 516e40e | 2001-10-17 17:48:49 +0000 | [diff] [blame] | 454 | static BOOL process_cooked_mouse_message( MSG *msg, ULONG_PTR extra_info, BOOL remove ) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 455 | { |
| 456 | INT hittest = HTCLIENT; |
| 457 | UINT raw_message = msg->message; |
| 458 | BOOL eatMsg; |
| 459 | |
| 460 | if (msg->message >= WM_NCMOUSEFIRST && msg->message <= WM_NCMOUSELAST) |
| 461 | { |
| 462 | raw_message += WM_MOUSEFIRST - WM_NCMOUSEFIRST; |
| 463 | hittest = msg->wParam; |
| 464 | } |
| 465 | if (raw_message == WM_LBUTTONDBLCLK || |
| 466 | raw_message == WM_RBUTTONDBLCLK || |
| 467 | raw_message == WM_MBUTTONDBLCLK) |
| 468 | { |
| 469 | raw_message += WM_LBUTTONDOWN - WM_LBUTTONDBLCLK; |
| 470 | } |
| 471 | |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 472 | if (remove) update_queue_key_state( raw_message, 0 ); |
| 473 | |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 474 | if (HOOK_IsHooked( WH_MOUSE )) |
| 475 | { |
| 476 | MOUSEHOOKSTRUCT hook; |
| 477 | hook.pt = msg->pt; |
| 478 | hook.hwnd = msg->hwnd; |
| 479 | hook.wHitTestCode = hittest; |
Alexandre Julliard | 516e40e | 2001-10-17 17:48:49 +0000 | [diff] [blame] | 480 | hook.dwExtraInfo = extra_info; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 481 | if (HOOK_CallHooksA( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE, |
| 482 | msg->message, (LPARAM)&hook )) |
| 483 | { |
| 484 | hook.pt = msg->pt; |
| 485 | hook.hwnd = msg->hwnd; |
| 486 | hook.wHitTestCode = hittest; |
Alexandre Julliard | 516e40e | 2001-10-17 17:48:49 +0000 | [diff] [blame] | 487 | hook.dwExtraInfo = extra_info; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 488 | HOOK_CallHooksA( WH_CBT, HCBT_CLICKSKIPPED, msg->message, (LPARAM)&hook ); |
| 489 | return FALSE; |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | if ((hittest == HTERROR) || (hittest == HTNOWHERE)) |
| 494 | { |
| 495 | SendMessageA( msg->hwnd, WM_SETCURSOR, msg->hwnd, MAKELONG( hittest, raw_message )); |
| 496 | return FALSE; |
| 497 | } |
| 498 | |
| 499 | if (!remove || GetCapture()) return TRUE; |
| 500 | |
| 501 | eatMsg = FALSE; |
| 502 | |
| 503 | if ((raw_message == WM_LBUTTONDOWN) || |
| 504 | (raw_message == WM_RBUTTONDOWN) || |
| 505 | (raw_message == WM_MBUTTONDOWN)) |
| 506 | { |
Alexandre Julliard | 0801ffc | 2001-08-24 00:26:59 +0000 | [diff] [blame] | 507 | HWND hwndTop = GetAncestor( msg->hwnd, GA_ROOT ); |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 508 | |
| 509 | /* Send the WM_PARENTNOTIFY, |
| 510 | * note that even for double/nonclient clicks |
| 511 | * notification message is still WM_L/M/RBUTTONDOWN. |
| 512 | */ |
| 513 | MSG_SendParentNotify( msg->hwnd, raw_message, 0, msg->pt ); |
| 514 | |
| 515 | /* Activate the window if needed */ |
| 516 | |
| 517 | if (msg->hwnd != GetActiveWindow() && hwndTop != GetDesktopWindow()) |
| 518 | { |
| 519 | LONG ret = SendMessageA( msg->hwnd, WM_MOUSEACTIVATE, hwndTop, |
| 520 | MAKELONG( hittest, raw_message ) ); |
| 521 | |
| 522 | switch(ret) |
| 523 | { |
| 524 | case MA_NOACTIVATEANDEAT: |
| 525 | eatMsg = TRUE; |
| 526 | /* fall through */ |
| 527 | case MA_NOACTIVATE: |
| 528 | break; |
| 529 | case MA_ACTIVATEANDEAT: |
| 530 | eatMsg = TRUE; |
| 531 | /* fall through */ |
| 532 | case MA_ACTIVATE: |
Alexandre Julliard | 03e07b5 | 2001-11-06 22:28:18 +0000 | [diff] [blame] | 533 | case 0: |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 534 | if (hwndTop != GetForegroundWindow() ) |
| 535 | { |
| 536 | if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE )) |
| 537 | eatMsg = TRUE; |
| 538 | } |
| 539 | break; |
| 540 | default: |
| 541 | WARN( "unknown WM_MOUSEACTIVATE code %ld\n", ret ); |
| 542 | break; |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | /* send the WM_SETCURSOR message */ |
| 548 | |
| 549 | /* Windows sends the normal mouse message as the message parameter |
| 550 | in the WM_SETCURSOR message even if it's non-client mouse message */ |
| 551 | SendMessageA( msg->hwnd, WM_SETCURSOR, msg->hwnd, MAKELONG( hittest, raw_message )); |
| 552 | |
| 553 | return !eatMsg; |
| 554 | } |
| 555 | |
| 556 | |
| 557 | /*********************************************************************** |
| 558 | * process_hardware_message |
| 559 | * |
| 560 | * returns TRUE if the contents of 'msg' should be passed to the application |
| 561 | */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 562 | BOOL MSG_process_raw_hardware_message( MSG *msg, ULONG_PTR extra_info, HWND hwnd_filter, |
| 563 | UINT first, UINT last, BOOL remove ) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 564 | { |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 565 | if (is_keyboard_message( msg->message )) |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 566 | { |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 567 | if (!process_raw_keyboard_message( msg, extra_info )) return FALSE; |
| 568 | } |
| 569 | else if (is_mouse_message( msg->message )) |
| 570 | { |
| 571 | if (!process_raw_mouse_message( msg, extra_info )) return FALSE; |
| 572 | } |
| 573 | else |
| 574 | { |
| 575 | ERR( "unknown message type %x\n", msg->message ); |
| 576 | return FALSE; |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 577 | } |
| 578 | |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 579 | /* check destination thread and filters */ |
| 580 | if (!check_message_filter( msg, hwnd_filter, first, last ) || |
Alexandre Julliard | 7695d69 | 2001-09-24 01:19:59 +0000 | [diff] [blame] | 581 | !WIN_IsCurrentThread( msg->hwnd )) |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 582 | { |
| 583 | /* queue it for later, or for another thread */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 584 | queue_hardware_message( msg, extra_info, MSG_HARDWARE_COOKED ); |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 585 | return FALSE; |
| 586 | } |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 587 | |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 588 | /* save the message in the cooked queue if we didn't want to remove it */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 589 | if (!remove) queue_hardware_message( msg, extra_info, MSG_HARDWARE_COOKED ); |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 590 | return TRUE; |
| 591 | } |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 592 | |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 593 | |
| 594 | /*********************************************************************** |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 595 | * MSG_process_cooked_hardware_message |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 596 | * |
| 597 | * returns TRUE if the contents of 'msg' should be passed to the application |
| 598 | */ |
Alexandre Julliard | 516e40e | 2001-10-17 17:48:49 +0000 | [diff] [blame] | 599 | BOOL MSG_process_cooked_hardware_message( MSG *msg, ULONG_PTR extra_info, BOOL remove ) |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 600 | { |
| 601 | if (is_keyboard_message( msg->message )) |
| 602 | return process_cooked_keyboard_message( msg, remove ); |
| 603 | |
| 604 | if (is_mouse_message( msg->message )) |
Alexandre Julliard | 516e40e | 2001-10-17 17:48:49 +0000 | [diff] [blame] | 605 | return process_cooked_mouse_message( msg, extra_info, remove ); |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 606 | |
| 607 | ERR( "unknown message type %x\n", msg->message ); |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 608 | return FALSE; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 609 | } |
| 610 | |
| 611 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 612 | /********************************************************************** |
Alexandre Julliard | a21672e | 2001-10-02 18:53:59 +0000 | [diff] [blame] | 613 | * GetKeyState (USER.106) |
| 614 | */ |
| 615 | INT16 WINAPI GetKeyState16(INT16 vkey) |
| 616 | { |
| 617 | return GetKeyState(vkey); |
| 618 | } |
| 619 | |
| 620 | |
| 621 | /********************************************************************** |
| 622 | * GetKeyState (USER32.@) |
| 623 | * |
| 624 | * An application calls the GetKeyState function in response to a |
| 625 | * keyboard-input message. This function retrieves the state of the key |
| 626 | * at the time the input message was generated. (SDK 3.1 Vol 2. p 390) |
| 627 | */ |
| 628 | SHORT WINAPI GetKeyState(INT vkey) |
| 629 | { |
| 630 | INT retval; |
| 631 | |
| 632 | if (vkey >= 'a' && vkey <= 'z') vkey += 'A' - 'a'; |
| 633 | retval = ((WORD)(QueueKeyStateTable[vkey] & 0x80) << 8 ) | (QueueKeyStateTable[vkey] & 0x01); |
| 634 | /* TRACE(key, "(0x%x) -> %x\n", vkey, retval); */ |
| 635 | return retval; |
| 636 | } |
| 637 | |
| 638 | |
| 639 | /********************************************************************** |
| 640 | * GetKeyboardState (USER.222) |
| 641 | * GetKeyboardState (USER32.@) |
| 642 | * |
| 643 | * An application calls the GetKeyboardState function in response to a |
| 644 | * keyboard-input message. This function retrieves the state of the keyboard |
| 645 | * at the time the input message was generated. (SDK 3.1 Vol 2. p 387) |
| 646 | */ |
| 647 | BOOL WINAPI GetKeyboardState(LPBYTE lpKeyState) |
| 648 | { |
| 649 | TRACE_(key)("(%p)\n", lpKeyState); |
| 650 | if (lpKeyState) memcpy(lpKeyState, QueueKeyStateTable, 256); |
| 651 | return TRUE; |
| 652 | } |
| 653 | |
| 654 | |
| 655 | /********************************************************************** |
| 656 | * SetKeyboardState (USER.223) |
| 657 | * SetKeyboardState (USER32.@) |
| 658 | */ |
| 659 | BOOL WINAPI SetKeyboardState(LPBYTE lpKeyState) |
| 660 | { |
| 661 | TRACE_(key)("(%p)\n", lpKeyState); |
| 662 | if (lpKeyState) memcpy(QueueKeyStateTable, lpKeyState, 256); |
| 663 | return TRUE; |
| 664 | } |
| 665 | |
| 666 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 667 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 668 | * WaitMessage (USER.112) Suspend thread pending messages |
| 669 | * WaitMessage (USER32.@) Suspend thread pending messages |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 670 | * |
| 671 | * WaitMessage() suspends a thread until events appear in the thread's |
| 672 | * queue. |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 673 | */ |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 674 | BOOL WINAPI WaitMessage(void) |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 675 | { |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 676 | return (MsgWaitForMultipleObjectsEx( 0, NULL, INFINITE, QS_ALLINPUT, 0 ) != WAIT_FAILED); |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 677 | } |
| 678 | |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 679 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 680 | /*********************************************************************** |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 681 | * MsgWaitForMultipleObjectsEx (USER32.@) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 682 | */ |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 683 | DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles, |
| 684 | DWORD timeout, DWORD mask, DWORD flags ) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 685 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 686 | HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 687 | DWORD i, ret; |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 688 | MESSAGEQUEUE *msgQueue; |
Alexandre Julliard | dbf2bf0 | 1999-01-01 17:05:53 +0000 | [diff] [blame] | 689 | |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 690 | if (count > MAXIMUM_WAIT_OBJECTS-1) |
Alexandre Julliard | dbf2bf0 | 1999-01-01 17:05:53 +0000 | [diff] [blame] | 691 | { |
| 692 | SetLastError( ERROR_INVALID_PARAMETER ); |
| 693 | return WAIT_FAILED; |
| 694 | } |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 695 | |
Alexandre Julliard | 8afe662 | 2001-07-26 20:12:22 +0000 | [diff] [blame] | 696 | if (!(msgQueue = QUEUE_Current())) return WAIT_FAILED; |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 697 | |
| 698 | /* set the queue mask */ |
| 699 | SERVER_START_REQ( set_queue_mask ) |
| 700 | { |
| 701 | req->wake_mask = (flags & MWMO_INPUTAVAILABLE) ? mask : 0; |
| 702 | req->changed_mask = mask; |
| 703 | req->skip_wait = 0; |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 704 | wine_server_call( req ); |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 705 | } |
| 706 | SERVER_END_REQ; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 707 | |
Alexandre Julliard | dbf2bf0 | 1999-01-01 17:05:53 +0000 | [diff] [blame] | 708 | /* Add the thread event to the handle list */ |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 709 | for (i = 0; i < count; i++) handles[i] = pHandles[i]; |
| 710 | handles[count] = msgQueue->server_queue; |
| 711 | |
| 712 | |
| 713 | if (USER_Driver.pMsgWaitForMultipleObjectsEx) |
Alexandre Julliard | 4323004 | 2001-05-16 19:52:29 +0000 | [diff] [blame] | 714 | { |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 715 | ret = USER_Driver.pMsgWaitForMultipleObjectsEx( count+1, handles, timeout, mask, flags ); |
| 716 | if (ret == count+1) ret = count; /* pretend the msg queue is ready */ |
Alexandre Julliard | 4323004 | 2001-05-16 19:52:29 +0000 | [diff] [blame] | 717 | } |
| 718 | else |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 719 | ret = WaitForMultipleObjectsEx( count+1, handles, flags & MWMO_WAITALL, |
| 720 | timeout, flags & MWMO_ALERTABLE ); |
Stephane Lussier | b3a99de | 1999-02-09 15:35:12 +0000 | [diff] [blame] | 721 | return ret; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 722 | } |
| 723 | |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 724 | |
Eric Pouech | 982e0ce | 2001-01-28 23:44:56 +0000 | [diff] [blame] | 725 | /*********************************************************************** |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 726 | * MsgWaitForMultipleObjects (USER32.@) |
Eric Pouech | 982e0ce | 2001-01-28 23:44:56 +0000 | [diff] [blame] | 727 | */ |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 728 | DWORD WINAPI MsgWaitForMultipleObjects( DWORD count, CONST HANDLE *handles, |
| 729 | BOOL wait_all, DWORD timeout, DWORD mask ) |
Eric Pouech | 982e0ce | 2001-01-28 23:44:56 +0000 | [diff] [blame] | 730 | { |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 731 | return MsgWaitForMultipleObjectsEx( count, handles, timeout, mask, |
| 732 | wait_all ? MWMO_WAITALL : 0 ); |
Eric Pouech | 982e0ce | 2001-01-28 23:44:56 +0000 | [diff] [blame] | 733 | } |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 734 | |
Alexandre Julliard | 51ab43b | 2001-05-18 22:51:56 +0000 | [diff] [blame] | 735 | |
| 736 | /*********************************************************************** |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 737 | * WaitForInputIdle (USER32.@) |
| 738 | */ |
| 739 | DWORD WINAPI WaitForInputIdle( HANDLE hProcess, DWORD dwTimeOut ) |
| 740 | { |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 741 | DWORD start_time, elapsed, ret; |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 742 | HANDLE idle_event = -1; |
| 743 | |
| 744 | SERVER_START_REQ( wait_input_idle ) |
| 745 | { |
| 746 | req->handle = hProcess; |
| 747 | req->timeout = dwTimeOut; |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 748 | if (!(ret = wine_server_call_err( req ))) idle_event = reply->event; |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 749 | } |
| 750 | SERVER_END_REQ; |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 751 | if (ret) return WAIT_FAILED; /* error */ |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 752 | if (!idle_event) return 0; /* no event to wait on */ |
| 753 | |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 754 | start_time = GetTickCount(); |
| 755 | elapsed = 0; |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 756 | |
| 757 | TRACE("waiting for %x\n", idle_event ); |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 758 | do |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 759 | { |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 760 | ret = MsgWaitForMultipleObjects ( 1, &idle_event, FALSE, dwTimeOut - elapsed, QS_SENDMESSAGE ); |
| 761 | switch (ret) |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 762 | { |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 763 | case WAIT_OBJECT_0+1: |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 764 | process_sent_messages(); |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 765 | break; |
| 766 | case WAIT_TIMEOUT: |
| 767 | case WAIT_FAILED: |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 768 | TRACE("timeout or error\n"); |
| 769 | return ret; |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 770 | default: |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 771 | TRACE("finished\n"); |
| 772 | return 0; |
| 773 | } |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 774 | if (dwTimeOut != INFINITE) |
| 775 | { |
| 776 | elapsed = GetTickCount() - start_time; |
| 777 | if (elapsed > dwTimeOut) |
| 778 | break; |
| 779 | } |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 780 | } |
Francois Gouget | 671a2ee | 2001-10-08 20:28:12 +0000 | [diff] [blame] | 781 | while (1); |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 782 | |
| 783 | return WAIT_TIMEOUT; |
| 784 | } |
| 785 | |
| 786 | |
| 787 | /*********************************************************************** |
| 788 | * UserYield (USER.332) |
| 789 | * UserYield16 (USER32.@) |
| 790 | */ |
| 791 | void WINAPI UserYield16(void) |
| 792 | { |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 793 | DWORD count; |
| 794 | |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 795 | /* Handle sent messages */ |
| 796 | process_sent_messages(); |
| 797 | |
| 798 | /* Yield */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 799 | ReleaseThunkLock(&count); |
| 800 | if (count) |
| 801 | { |
| 802 | RestoreThunkLock(count); |
| 803 | /* Handle sent messages again */ |
| 804 | process_sent_messages(); |
| 805 | } |
Alexandre Julliard | 9f55ae6 | 2001-06-28 04:37:22 +0000 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 809 | struct accent_char |
| 810 | { |
| 811 | BYTE ac_accent; |
| 812 | BYTE ac_char; |
| 813 | BYTE ac_result; |
| 814 | }; |
| 815 | |
| 816 | static const struct accent_char accent_chars[] = |
| 817 | { |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 818 | /* 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] | 819 | {'`', 'A', '\300'}, {'`', 'a', '\340'}, |
| 820 | {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, |
| 821 | {'^', 'A', '\302'}, {'^', 'a', '\342'}, |
| 822 | {'~', 'A', '\303'}, {'~', 'a', '\343'}, |
| 823 | {'"', 'A', '\304'}, {'"', 'a', '\344'}, |
| 824 | {'O', 'A', '\305'}, {'o', 'a', '\345'}, |
| 825 | {'0', 'A', '\305'}, {'0', 'a', '\345'}, |
| 826 | {'A', 'A', '\305'}, {'a', 'a', '\345'}, |
| 827 | {'A', 'E', '\306'}, {'a', 'e', '\346'}, |
| 828 | {',', 'C', '\307'}, {',', 'c', '\347'}, |
| 829 | {'`', 'E', '\310'}, {'`', 'e', '\350'}, |
| 830 | {'\'', 'E', '\311'}, {'\'', 'e', '\351'}, |
| 831 | {'^', 'E', '\312'}, {'^', 'e', '\352'}, |
| 832 | {'"', 'E', '\313'}, {'"', 'e', '\353'}, |
| 833 | {'`', 'I', '\314'}, {'`', 'i', '\354'}, |
| 834 | {'\'', 'I', '\315'}, {'\'', 'i', '\355'}, |
| 835 | {'^', 'I', '\316'}, {'^', 'i', '\356'}, |
| 836 | {'"', 'I', '\317'}, {'"', 'i', '\357'}, |
| 837 | {'-', 'D', '\320'}, {'-', 'd', '\360'}, |
| 838 | {'~', 'N', '\321'}, {'~', 'n', '\361'}, |
| 839 | {'`', 'O', '\322'}, {'`', 'o', '\362'}, |
| 840 | {'\'', 'O', '\323'}, {'\'', 'o', '\363'}, |
| 841 | {'^', 'O', '\324'}, {'^', 'o', '\364'}, |
| 842 | {'~', 'O', '\325'}, {'~', 'o', '\365'}, |
| 843 | {'"', 'O', '\326'}, {'"', 'o', '\366'}, |
| 844 | {'/', 'O', '\330'}, {'/', 'o', '\370'}, |
| 845 | {'`', 'U', '\331'}, {'`', 'u', '\371'}, |
| 846 | {'\'', 'U', '\332'}, {'\'', 'u', '\372'}, |
| 847 | {'^', 'U', '\333'}, {'^', 'u', '\373'}, |
| 848 | {'"', 'U', '\334'}, {'"', 'u', '\374'}, |
| 849 | {'\'', 'Y', '\335'}, {'\'', 'y', '\375'}, |
| 850 | {'T', 'H', '\336'}, {'t', 'h', '\376'}, |
| 851 | {'s', 's', '\337'}, {'"', 'y', '\377'}, |
| 852 | {'s', 'z', '\337'}, {'i', 'j', '\377'}, |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 853 | /* iso-8859-2 uses this */ |
| 854 | {'<', 'L', '\245'}, {'<', 'l', '\265'}, /* caron */ |
| 855 | {'<', 'S', '\251'}, {'<', 's', '\271'}, |
| 856 | {'<', 'T', '\253'}, {'<', 't', '\273'}, |
| 857 | {'<', 'Z', '\256'}, {'<', 'z', '\276'}, |
| 858 | {'<', 'C', '\310'}, {'<', 'c', '\350'}, |
| 859 | {'<', 'E', '\314'}, {'<', 'e', '\354'}, |
| 860 | {'<', 'D', '\317'}, {'<', 'd', '\357'}, |
| 861 | {'<', 'N', '\322'}, {'<', 'n', '\362'}, |
| 862 | {'<', 'R', '\330'}, {'<', 'r', '\370'}, |
| 863 | {';', 'A', '\241'}, {';', 'a', '\261'}, /* ogonek */ |
| 864 | {';', 'E', '\312'}, {';', 'e', '\332'}, |
| 865 | {'\'', 'Z', '\254'}, {'\'', 'z', '\274'}, /* acute */ |
| 866 | {'\'', 'R', '\300'}, {'\'', 'r', '\340'}, |
| 867 | {'\'', 'L', '\305'}, {'\'', 'l', '\345'}, |
| 868 | {'\'', 'C', '\306'}, {'\'', 'c', '\346'}, |
| 869 | {'\'', 'N', '\321'}, {'\'', 'n', '\361'}, |
| 870 | /* collision whith S, from iso-8859-9 !!! */ |
| 871 | {',', 'S', '\252'}, {',', 's', '\272'}, /* cedilla */ |
| 872 | {',', 'T', '\336'}, {',', 't', '\376'}, |
| 873 | {'.', 'Z', '\257'}, {'.', 'z', '\277'}, /* dot above */ |
| 874 | {'/', 'L', '\243'}, {'/', 'l', '\263'}, /* slash */ |
| 875 | {'/', 'D', '\320'}, {'/', 'd', '\360'}, |
| 876 | {'(', 'A', '\303'}, {'(', 'a', '\343'}, /* breve */ |
| 877 | {'\275', 'O', '\325'}, {'\275', 'o', '\365'}, /* double acute */ |
| 878 | {'\275', 'U', '\334'}, {'\275', 'u', '\374'}, |
| 879 | {'0', 'U', '\332'}, {'0', 'u', '\372'}, /* ring above */ |
| 880 | /* iso-8859-3 uses this */ |
| 881 | {'/', 'H', '\241'}, {'/', 'h', '\261'}, /* slash */ |
| 882 | {'>', 'H', '\246'}, {'>', 'h', '\266'}, /* circumflex */ |
| 883 | {'>', 'J', '\254'}, {'>', 'j', '\274'}, |
| 884 | {'>', 'C', '\306'}, {'>', 'c', '\346'}, |
| 885 | {'>', 'G', '\330'}, {'>', 'g', '\370'}, |
| 886 | {'>', 'S', '\336'}, {'>', 's', '\376'}, |
| 887 | /* collision whith G( from iso-8859-9 !!! */ |
| 888 | {'(', 'G', '\253'}, {'(', 'g', '\273'}, /* breve */ |
| 889 | {'(', 'U', '\335'}, {'(', 'u', '\375'}, |
| 890 | /* collision whith I. from iso-8859-3 !!! */ |
| 891 | {'.', 'I', '\251'}, {'.', 'i', '\271'}, /* dot above */ |
| 892 | {'.', 'C', '\305'}, {'.', 'c', '\345'}, |
| 893 | {'.', 'G', '\325'}, {'.', 'g', '\365'}, |
| 894 | /* iso-8859-4 uses this */ |
| 895 | {',', 'R', '\243'}, {',', 'r', '\263'}, /* cedilla */ |
| 896 | {',', 'L', '\246'}, {',', 'l', '\266'}, |
| 897 | {',', 'G', '\253'}, {',', 'g', '\273'}, |
| 898 | {',', 'N', '\321'}, {',', 'n', '\361'}, |
| 899 | {',', 'K', '\323'}, {',', 'k', '\363'}, |
| 900 | {'~', 'I', '\245'}, {'~', 'i', '\265'}, /* tilde */ |
| 901 | {'-', 'E', '\252'}, {'-', 'e', '\272'}, /* macron */ |
| 902 | {'-', 'A', '\300'}, {'-', 'a', '\340'}, |
| 903 | {'-', 'I', '\317'}, {'-', 'i', '\357'}, |
| 904 | {'-', 'O', '\322'}, {'-', 'o', '\362'}, |
| 905 | {'-', 'U', '\336'}, {'-', 'u', '\376'}, |
| 906 | {'/', 'T', '\254'}, {'/', 't', '\274'}, /* slash */ |
| 907 | {'.', 'E', '\314'}, {'.', 'e', '\344'}, /* dot above */ |
| 908 | {';', 'I', '\307'}, {';', 'i', '\347'}, /* ogonek */ |
| 909 | {';', 'U', '\331'}, {';', 'u', '\371'}, |
| 910 | /* iso-8859-9 uses this */ |
| 911 | /* iso-8859-9 has really bad choosen G( S, and I. as they collide |
| 912 | * whith the same letters on other iso-8859-x (that is they are on |
| 913 | * different places :-( ), if you use turkish uncomment these and |
| 914 | * comment out the lines in iso-8859-2 and iso-8859-3 sections |
| 915 | * FIXME: should be dynamic according to chosen language |
| 916 | * if/when Wine has turkish support. |
| 917 | */ |
| 918 | /* collision whith G( from iso-8859-3 !!! */ |
| 919 | /* {'(', 'G', '\320'}, {'(', 'g', '\360'}, */ /* breve */ |
| 920 | /* collision whith S, from iso-8859-2 !!! */ |
| 921 | /* {',', 'S', '\336'}, {',', 's', '\376'}, */ /* cedilla */ |
| 922 | /* collision whith I. from iso-8859-3 !!! */ |
| 923 | /* {'.', 'I', '\335'}, {'.', 'i', '\375'}, */ /* dot above */ |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 924 | }; |
| 925 | |
| 926 | |
Alexandre Julliard | 7e50df3 | 1994-08-06 11:22:41 +0000 | [diff] [blame] | 927 | /*********************************************************************** |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 928 | * TranslateMessage (USER32.@) |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 929 | * |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 930 | * Implementation of TranslateMessage. |
| 931 | * |
| 932 | * TranslateMessage translates virtual-key messages into character-messages, |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 933 | * as follows : |
| 934 | * WM_KEYDOWN/WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message. |
| 935 | * ditto replacing WM_* with WM_SYS* |
| 936 | * This produces WM_CHAR messages only for keys mapped to ASCII characters |
| 937 | * by the keyboard driver. |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 938 | */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 939 | BOOL WINAPI TranslateMessage( const MSG *msg ) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 940 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 941 | static int dead_char; |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 942 | UINT message; |
Dmitry Timoshkov | 2fa0c66 | 2000-11-25 02:09:45 +0000 | [diff] [blame] | 943 | WCHAR wp[2]; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 944 | |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 945 | if (msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST) |
| 946 | TRACE_(key)("(%s, %04X, %08lX)\n", |
Guy L. Albertelli | db9b549 | 2001-09-07 18:38:57 +0000 | [diff] [blame] | 947 | SPY_GetMsgName(msg->message, msg->hwnd), msg->wParam, msg->lParam ); |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 948 | |
| 949 | if ((msg->message != WM_KEYDOWN) && (msg->message != WM_SYSKEYDOWN)) return FALSE; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 950 | |
Dmitry Timoshkov | 740bb92 | 2000-11-05 20:07:59 +0000 | [diff] [blame] | 951 | TRACE_(key)("Translating key %s (%04x), scancode %02x\n", |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 952 | SPY_GetVKeyName(msg->wParam), msg->wParam, LOBYTE(HIWORD(msg->lParam))); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 953 | |
Dmitry Timoshkov | 2fa0c66 | 2000-11-25 02:09:45 +0000 | [diff] [blame] | 954 | /* FIXME : should handle ToUnicode yielding 2 */ |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 955 | switch (ToUnicode(msg->wParam, HIWORD(msg->lParam), QueueKeyStateTable, wp, 2, 0)) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 956 | { |
Andreas Mohr | 1af53cb | 2000-12-09 03:15:32 +0000 | [diff] [blame] | 957 | case 1: |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 958 | message = (msg->message == WM_KEYDOWN) ? WM_CHAR : WM_SYSCHAR; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 959 | /* Should dead chars handling go in ToAscii ? */ |
| 960 | if (dead_char) |
| 961 | { |
| 962 | int i; |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 963 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 964 | if (wp[0] == ' ') wp[0] = dead_char; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 965 | if (dead_char == 0xa2) dead_char = '('; |
| 966 | else if (dead_char == 0xa8) dead_char = '"'; |
| 967 | else if (dead_char == 0xb2) dead_char = ';'; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 968 | else if (dead_char == 0xb4) dead_char = '\''; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 969 | else if (dead_char == 0xb7) dead_char = '<'; |
| 970 | else if (dead_char == 0xb8) dead_char = ','; |
| 971 | else if (dead_char == 0xff) dead_char = '.'; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 972 | for (i = 0; i < sizeof(accent_chars)/sizeof(accent_chars[0]); i++) |
| 973 | if ((accent_chars[i].ac_accent == dead_char) && |
| 974 | (accent_chars[i].ac_char == wp[0])) |
| 975 | { |
| 976 | wp[0] = accent_chars[i].ac_result; |
| 977 | break; |
| 978 | } |
| 979 | dead_char = 0; |
| 980 | } |
Guy L. Albertelli | db9b549 | 2001-09-07 18:38:57 +0000 | [diff] [blame] | 981 | TRACE_(key)("1 -> PostMessage(%s)\n", SPY_GetMsgName(message, msg->hwnd)); |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 982 | PostMessageW( msg->hwnd, message, wp[0], msg->lParam ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 983 | return TRUE; |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 984 | |
Andreas Mohr | 1af53cb | 2000-12-09 03:15:32 +0000 | [diff] [blame] | 985 | case -1: |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 986 | message = (msg->message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR; |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 987 | dead_char = wp[0]; |
Guy L. Albertelli | db9b549 | 2001-09-07 18:38:57 +0000 | [diff] [blame] | 988 | TRACE_(key)("-1 -> PostMessage(%s)\n", SPY_GetMsgName(message, msg->hwnd)); |
Alexandre Julliard | d253c58 | 2001-08-07 19:19:08 +0000 | [diff] [blame] | 989 | PostMessageW( msg->hwnd, message, wp[0], msg->lParam ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 990 | return TRUE; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 991 | } |
| 992 | return FALSE; |
| 993 | } |
| 994 | |
| 995 | |
| 996 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 997 | * DispatchMessageA (USER32.@) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 998 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 999 | LONG WINAPI DispatchMessageA( const MSG* msg ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1000 | { |
| 1001 | WND * wndPtr; |
| 1002 | LONG retval; |
| 1003 | int painting; |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1004 | WNDPROC winproc; |
| 1005 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1006 | /* Process timer messages */ |
| 1007 | if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) |
| 1008 | { |
| 1009 | if (msg->lParam) |
| 1010 | { |
| 1011 | /* HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
Stephane Lussier | 6bac4f2 | 2000-09-29 00:56:05 +0000 | [diff] [blame] | 1012 | |
Andreas Mohr | 1af53cb | 2000-12-09 03:15:32 +0000 | [diff] [blame] | 1013 | /* before calling window proc, verify whether timer is still valid; |
| 1014 | there's a slim chance that the application kills the timer |
| 1015 | between GetMessage and DispatchMessage API calls */ |
Stephane Lussier | 6bac4f2 | 2000-09-29 00:56:05 +0000 | [diff] [blame] | 1016 | if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam)) |
| 1017 | return 0; /* invalid winproc */ |
| 1018 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1019 | return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1020 | msg->message, msg->wParam, GetTickCount() ); |
| 1021 | } |
| 1022 | } |
| 1023 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1024 | if (!(wndPtr = WIN_GetPtr( msg->hwnd ))) |
Francois Boisvert | 3a3cd9f | 1999-03-28 12:42:52 +0000 | [diff] [blame] | 1025 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1026 | if (msg->hwnd) SetLastError( ERROR_INVALID_WINDOW_HANDLE ); |
| 1027 | return 0; |
| 1028 | } |
| 1029 | if (wndPtr == WND_OTHER_PROCESS) |
| 1030 | { |
| 1031 | if (IsWindow( msg->hwnd )) |
| 1032 | ERR( "cannot dispatch msg to other process window %x\n", msg->hwnd ); |
| 1033 | SetLastError( ERROR_INVALID_WINDOW_HANDLE ); |
| 1034 | return 0; |
| 1035 | } |
| 1036 | if (!(winproc = wndPtr->winproc)) |
| 1037 | { |
| 1038 | WIN_ReleasePtr( wndPtr ); |
| 1039 | return 0; |
Francois Boisvert | 3a3cd9f | 1999-03-28 12:42:52 +0000 | [diff] [blame] | 1040 | } |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1041 | painting = (msg->message == WM_PAINT); |
| 1042 | if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1043 | WIN_ReleasePtr( wndPtr ); |
| 1044 | /* hook_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1045 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1046 | SPY_EnterMessage( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1047 | msg->wParam, msg->lParam ); |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1048 | retval = CallWindowProcA( winproc, msg->hwnd, msg->message, |
| 1049 | msg->wParam, msg->lParam ); |
Guy L. Albertelli | 936c6c4 | 2000-10-22 23:52:47 +0000 | [diff] [blame] | 1050 | SPY_ExitMessage( SPY_RESULT_OK, msg->hwnd, msg->message, retval, |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1051 | msg->wParam, msg->lParam ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1052 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1053 | if (painting && (wndPtr = WIN_GetPtr( msg->hwnd )) && (wndPtr != WND_OTHER_PROCESS)) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1054 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1055 | BOOL validate = ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate); |
| 1056 | wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; |
| 1057 | WIN_ReleasePtr( wndPtr ); |
| 1058 | if (validate) |
| 1059 | { |
| 1060 | ERR( "BeginPaint not called on WM_PAINT for hwnd %04x!\n", msg->hwnd ); |
| 1061 | /* Validate the update region to avoid infinite WM_PAINT loop */ |
| 1062 | RedrawWindow( msg->hwnd, NULL, 0, |
| 1063 | RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT ); |
| 1064 | } |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1065 | } |
| 1066 | return retval; |
| 1067 | } |
| 1068 | |
| 1069 | |
| 1070 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1071 | * DispatchMessageW (USER32.@) Process Message |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1072 | * |
| 1073 | * Process the message specified in the structure *_msg_. |
| 1074 | * |
| 1075 | * If the lpMsg parameter points to a WM_TIMER message and the |
| 1076 | * parameter of the WM_TIMER message is not NULL, the lParam parameter |
| 1077 | * points to the function that is called instead of the window |
| 1078 | * procedure. |
| 1079 | * |
| 1080 | * The message must be valid. |
| 1081 | * |
| 1082 | * RETURNS |
| 1083 | * |
| 1084 | * DispatchMessage() returns the result of the window procedure invoked. |
| 1085 | * |
| 1086 | * CONFORMANCE |
| 1087 | * |
| 1088 | * ECMA-234, Win32 |
| 1089 | * |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1090 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1091 | LONG WINAPI DispatchMessageW( const MSG* msg ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1092 | { |
| 1093 | WND * wndPtr; |
| 1094 | LONG retval; |
| 1095 | int painting; |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1096 | WNDPROC winproc; |
| 1097 | |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1098 | /* Process timer messages */ |
| 1099 | if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) |
| 1100 | { |
| 1101 | if (msg->lParam) |
| 1102 | { |
| 1103 | /* HOOK_CallHooks32W( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
Stephane Lussier | 6bac4f2 | 2000-09-29 00:56:05 +0000 | [diff] [blame] | 1104 | |
Andreas Mohr | 1af53cb | 2000-12-09 03:15:32 +0000 | [diff] [blame] | 1105 | /* before calling window proc, verify whether timer is still valid; |
| 1106 | there's a slim chance that the application kills the timer |
| 1107 | between GetMessage and DispatchMessage API calls */ |
Stephane Lussier | 6bac4f2 | 2000-09-29 00:56:05 +0000 | [diff] [blame] | 1108 | if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam)) |
| 1109 | return 0; /* invalid winproc */ |
| 1110 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1111 | return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd, |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1112 | msg->message, msg->wParam, GetTickCount() ); |
| 1113 | } |
| 1114 | } |
| 1115 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1116 | if (!(wndPtr = WIN_GetPtr( msg->hwnd ))) |
Francois Boisvert | 3a3cd9f | 1999-03-28 12:42:52 +0000 | [diff] [blame] | 1117 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1118 | if (msg->hwnd) SetLastError( ERROR_INVALID_WINDOW_HANDLE ); |
| 1119 | return 0; |
| 1120 | } |
| 1121 | if (wndPtr == WND_OTHER_PROCESS) |
| 1122 | { |
| 1123 | if (IsWindow( msg->hwnd )) |
| 1124 | ERR( "cannot dispatch msg to other process window %x\n", msg->hwnd ); |
| 1125 | SetLastError( ERROR_INVALID_WINDOW_HANDLE ); |
| 1126 | return 0; |
| 1127 | } |
| 1128 | if (!(winproc = wndPtr->winproc)) |
| 1129 | { |
| 1130 | WIN_ReleasePtr( wndPtr ); |
| 1131 | return 0; |
Francois Boisvert | 3a3cd9f | 1999-03-28 12:42:52 +0000 | [diff] [blame] | 1132 | } |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1133 | painting = (msg->message == WM_PAINT); |
| 1134 | if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1135 | WIN_ReleasePtr( wndPtr ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1136 | /* HOOK_CallHooks32W( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ |
| 1137 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1138 | SPY_EnterMessage( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1139 | msg->wParam, msg->lParam ); |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1140 | retval = CallWindowProcW( winproc, msg->hwnd, msg->message, |
| 1141 | msg->wParam, msg->lParam ); |
Guy L. Albertelli | 936c6c4 | 2000-10-22 23:52:47 +0000 | [diff] [blame] | 1142 | SPY_ExitMessage( SPY_RESULT_OK, msg->hwnd, msg->message, retval, |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1143 | msg->wParam, msg->lParam ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1144 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1145 | if (painting && (wndPtr = WIN_GetPtr( msg->hwnd )) && (wndPtr != WND_OTHER_PROCESS)) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1146 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1147 | BOOL validate = ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate); |
| 1148 | wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; |
| 1149 | WIN_ReleasePtr( wndPtr ); |
| 1150 | if (validate) |
| 1151 | { |
| 1152 | ERR( "BeginPaint not called on WM_PAINT for hwnd %04x!\n", msg->hwnd ); |
| 1153 | /* Validate the update region to avoid infinite WM_PAINT loop */ |
| 1154 | RedrawWindow( msg->hwnd, NULL, 0, |
| 1155 | RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT ); |
| 1156 | } |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1157 | } |
| 1158 | return retval; |
| 1159 | } |
| 1160 | |
| 1161 | |
| 1162 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1163 | * RegisterWindowMessage (USER.118) |
| 1164 | * RegisterWindowMessageA (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1165 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1166 | WORD WINAPI RegisterWindowMessageA( LPCSTR str ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1167 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1168 | TRACE("%s\n", str ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1169 | return GlobalAddAtomA( str ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1170 | } |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1171 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1172 | |
| 1173 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1174 | * RegisterWindowMessageW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1175 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1176 | WORD WINAPI RegisterWindowMessageW( LPCWSTR str ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1177 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1178 | TRACE("%p\n", str ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1179 | return GlobalAddAtomW( str ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1180 | } |
| 1181 | |
| 1182 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1183 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1184 | * BroadcastSystemMessage (USER32.@) |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1185 | */ |
| 1186 | LONG WINAPI BroadcastSystemMessage( |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1187 | DWORD dwFlags,LPDWORD recipients,UINT uMessage,WPARAM wParam, |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1188 | LPARAM lParam |
| 1189 | ) { |
Alexandre Julliard | 838d65a | 2001-06-19 19:16:41 +0000 | [diff] [blame] | 1190 | FIXME("(%08lx,%08lx,%08x,%08x,%08lx): stub!\n", |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1191 | dwFlags,*recipients,uMessage,wParam,lParam |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1192 | ); |
| 1193 | return 0; |
| 1194 | } |