| 1 | /* $Id: oslibmsgtranslate.cpp,v 1.36 2000-07-20 18:08:12 sandervl Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Window message translation functions for OS/2
|
|---|
| 4 | *
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
|---|
| 7 | * Copyright 1999 Daniela Engert (dani@ngrt.de)
|
|---|
| 8 | * Copyright 1999 Rene Pronk (R.Pronk@twi.tudelft.nl)
|
|---|
| 9 | *
|
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 11 | *
|
|---|
| 12 | * TODO: Extra msgs: which messages must be put into the queue and which can be sent directly?
|
|---|
| 13 | * (According to the docs TranslateMessage really inserts a msg in the queue)
|
|---|
| 14 | * TODO: Filter translation isn't correct for posted messages
|
|---|
| 15 | *
|
|---|
| 16 | */
|
|---|
| 17 | #define INCL_WIN
|
|---|
| 18 | #define INCL_PM
|
|---|
| 19 | #define INCL_DOSPROCESS
|
|---|
| 20 | #include <os2wrap.h>
|
|---|
| 21 | #include <string.h>
|
|---|
| 22 | #include <misc.h>
|
|---|
| 23 | #include <winconst.h>
|
|---|
| 24 | #include "oslibmsg.h"
|
|---|
| 25 | #include "win32wnd.h"
|
|---|
| 26 | #include "win32wdesktop.h"
|
|---|
| 27 | #include "oslibutil.h"
|
|---|
| 28 | #include "timer.h"
|
|---|
| 29 | #include <thread.h>
|
|---|
| 30 | #include <wprocess.h>
|
|---|
| 31 | #include "pmwindow.h"
|
|---|
| 32 | #include "oslibwin.h"
|
|---|
| 33 | #include "winmouse.h"
|
|---|
| 34 |
|
|---|
| 35 | #define DBG_LOCALLOG DBG_oslibmsgtranslate
|
|---|
| 36 | #include "dbglocal.h"
|
|---|
| 37 |
|
|---|
| 38 | //Used for key translation while processing WM_CHAR message
|
|---|
| 39 | USHORT virtualKeyTable [66] = {
|
|---|
| 40 | 0x00, // OS/2 VK Win32 VK, Entry 0 is not used
|
|---|
| 41 | 0x01, // VK_BUTTON1 VK_LBUTTON
|
|---|
| 42 | 0x02, // VK_BUTTON2 VK_RBUTTON
|
|---|
| 43 | 0x04, // VK_BUTTON3 VK_MBUTTON
|
|---|
| 44 | 0x03, // VK_BREAK VK_CANCEL
|
|---|
| 45 | 0x08, // VK_BACKSPACE VK_BACK
|
|---|
| 46 | 0x09, // VK_TAB VK_TAB
|
|---|
| 47 | 0x00, // VK_BACKTAB No equivalent!
|
|---|
| 48 | 0x0D, // VK_NEWLINE VK_RETURN
|
|---|
| 49 | 0x10, // VK_SHIFT VK_SHIFT
|
|---|
| 50 | 0x11, // VK_CTRL VK_CONTROL
|
|---|
| 51 | 0x12, // VK_ALT VK_MENU, best match I guess
|
|---|
| 52 | 0x12, // VK_ALTGRAF VK_MENU, best match I guess
|
|---|
| 53 | 0x13, // VK_PAUSE VK_PAUSE
|
|---|
| 54 | 0x14, // VK_CAPSLOCK VK_CAPITAL
|
|---|
| 55 | 0x1B, // VK_ESC VK_ESCAPE
|
|---|
| 56 | 0x20, // VK_SPACE VK_SPACE
|
|---|
| 57 | 0x21, // VK_PAGEUP VK_PRIOR
|
|---|
| 58 | 0x22, // VK_PAGEDOWN VK_NEXT
|
|---|
| 59 | 0x23, // VK_END VK_END
|
|---|
| 60 | 0x24, // VK_HOME VK_HOME
|
|---|
| 61 | 0x25, // VK_LEFT VK_LEFT
|
|---|
| 62 | 0x26, // VK_UP VK_UP
|
|---|
| 63 | 0x27, // VK_RIGHT VK_RIGHT
|
|---|
| 64 | 0x28, // VK_DOWN VK_DOWN
|
|---|
| 65 | 0x2C, // VK_PRINTSCRN VK_SNAPSHOT
|
|---|
| 66 | 0x2D, // VK_INSERT VK_INSERT
|
|---|
| 67 | 0x2E, // VK_DELETE VK_DELETE
|
|---|
| 68 | 0x91, // VK_SCRLLOCK VK_SCROLL
|
|---|
| 69 | 0x90, // VK_NUMLOCK VK_NUMLOCK
|
|---|
| 70 | 0x0D, // VK_ENTER VK_RETURN
|
|---|
| 71 | 0x00, // VK_SYSRQ No equivalent!
|
|---|
| 72 | 0x70, // VK_F1 VK_F1
|
|---|
| 73 | 0x71, // VK_F2 VK_F2
|
|---|
| 74 | 0x72, // VK_F3 VK_F3
|
|---|
| 75 | 0x73, // VK_F4 VK_F4
|
|---|
| 76 | 0x74, // VK_F5 VK_F5
|
|---|
| 77 | 0x75, // VK_F6 VK_F6
|
|---|
| 78 | 0x76, // VK_F7 VK_F7
|
|---|
| 79 | 0x77, // VK_F8 VK_F8
|
|---|
| 80 | 0x78, // VK_F9 VK_F9
|
|---|
| 81 | 0x79, // VK_F10 VK_F10
|
|---|
| 82 | 0x7A, // VK_F11 VK_F11
|
|---|
| 83 | 0x7B, // VK_F12 VK_F12
|
|---|
| 84 | 0x7C, // VK_F13 VK_F13
|
|---|
| 85 | 0x7D, // VK_F14 VK_F14
|
|---|
| 86 | 0x7E, // VK_F15 VK_F15
|
|---|
| 87 | 0x7F, // VK_F16 VK_F16
|
|---|
| 88 | 0x80, // VK_F17 VK_F17
|
|---|
| 89 | 0x81, // VK_F18 VK_F18
|
|---|
| 90 | 0x82, // VK_F19 VK_F19
|
|---|
| 91 | 0x83, // VK_F20 VK_F20
|
|---|
| 92 | 0x84, // VK_F21 VK_F21
|
|---|
| 93 | 0x85, // VK_F22 VK_F22
|
|---|
| 94 | 0x86, // VK_F23 VK_F23
|
|---|
| 95 | 0x87, // VK_F24 VK_F24
|
|---|
| 96 | 0x00, // VK_ENDDRAG No equivalent!
|
|---|
| 97 | 0x0C, // VK_CLEAR VK_CLEAR
|
|---|
| 98 | 0xF9, // VK_EREOF VK_EREOF
|
|---|
| 99 | 0xFD, // VK_PA1 VK_PA1
|
|---|
| 100 | 0xF6, // VK_ATTN VK_ATTN
|
|---|
| 101 | 0xF7, // VK_CRSEL VK_CRSEL
|
|---|
| 102 | 0xF8, // VK_EXSEL VK_EXSEL
|
|---|
| 103 | 0x00, // VK_COPY No equivalent!
|
|---|
| 104 | 0x00, // VK_BLK1 No equivalent!
|
|---|
| 105 | 0x00}; // VK_BLK2 No equivalent!
|
|---|
| 106 |
|
|---|
| 107 | //******************************************************************************
|
|---|
| 108 | //******************************************************************************
|
|---|
| 109 | ULONG GetMouseKeyState()
|
|---|
| 110 | {
|
|---|
| 111 | ULONG keystate = 0;
|
|---|
| 112 |
|
|---|
| 113 | if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
|
|---|
| 114 | keystate |= MK_LBUTTON_W;
|
|---|
| 115 | if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
|
|---|
| 116 | keystate |= MK_RBUTTON_W;
|
|---|
| 117 | if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
|
|---|
| 118 | keystate |= MK_MBUTTON_W;
|
|---|
| 119 | if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
|
|---|
| 120 | keystate |= MK_SHIFT_W;
|
|---|
| 121 | if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
|
|---|
| 122 | keystate |= MK_CONTROL_W;
|
|---|
| 123 |
|
|---|
| 124 | return keystate;
|
|---|
| 125 | }
|
|---|
| 126 | //******************************************************************************
|
|---|
| 127 | //******************************************************************************
|
|---|
| 128 | LONG IsNCMouseMsg(Win32BaseWindow *win32wnd)
|
|---|
| 129 | {
|
|---|
| 130 | return ((win32wnd->getLastHitTestVal() != HTCLIENT_W) && (WinQueryCapture(HWND_DESKTOP) != win32wnd->getOS2WindowHandle()));
|
|---|
| 131 | }
|
|---|
| 132 | //******************************************************************************
|
|---|
| 133 | //******************************************************************************
|
|---|
| 134 | BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fMsgRemoved)
|
|---|
| 135 | {
|
|---|
| 136 | Win32BaseWindow *win32wnd = 0;
|
|---|
| 137 | OSLIBPOINT point, ClientPoint;
|
|---|
| 138 | POSTMSG_PACKET *packet;
|
|---|
| 139 | THDB *thdb = (THDB *)pThdb;
|
|---|
| 140 | BOOL fWasDisabled = FALSE;
|
|---|
| 141 | int i;
|
|---|
| 142 |
|
|---|
| 143 | memset(winMsg, 0, sizeof(MSG));
|
|---|
| 144 | win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(os2Msg->hwnd);
|
|---|
| 145 |
|
|---|
| 146 | //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle
|
|---|
| 147 | //Realplayer starts a timer with hwnd 0 & proc 0; check this here
|
|---|
| 148 | if(win32wnd == 0 && (os2Msg->msg != WM_CREATE && os2Msg->msg != WM_QUIT && os2Msg->msg != WM_TIMER && os2Msg->msg != WIN32APP_POSTMSG))
|
|---|
| 149 | {
|
|---|
| 150 | goto dummymessage; //not a win32 client window
|
|---|
| 151 | }
|
|---|
| 152 | winMsg->time = os2Msg->time;
|
|---|
| 153 | //CB: PM bug or undocumented feature? ptl.x highword is set!
|
|---|
| 154 | winMsg->pt.x = os2Msg->ptl.x & 0xFFFF;
|
|---|
| 155 | winMsg->pt.y = mapScreenY(os2Msg->ptl.y);
|
|---|
| 156 |
|
|---|
| 157 | if(win32wnd) //==0 for WM_CREATE/WM_QUIT
|
|---|
| 158 | winMsg->hwnd = win32wnd->getWindowHandle();
|
|---|
| 159 |
|
|---|
| 160 | switch(os2Msg->msg)
|
|---|
| 161 | {
|
|---|
| 162 | case WIN32APP_POSTMSG:
|
|---|
| 163 | {
|
|---|
| 164 | packet = (POSTMSG_PACKET *)os2Msg->mp2;
|
|---|
| 165 | if(packet && ((ULONG)os2Msg->mp1 == WIN32MSG_MAGICA || (ULONG)os2Msg->mp1 == WIN32MSG_MAGICW)) {
|
|---|
| 166 | winMsg->message = packet->Msg;
|
|---|
| 167 | winMsg->wParam = packet->wParam;
|
|---|
| 168 | winMsg->lParam = packet->lParam;
|
|---|
| 169 | if(fMsgRemoved == MSG_REMOVE) free(packet); //free the shared memory here
|
|---|
| 170 | break;
|
|---|
| 171 | }
|
|---|
| 172 | goto dummymessage;
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | //OS/2 msgs
|
|---|
| 176 | case WM_CREATE:
|
|---|
| 177 | {
|
|---|
| 178 | if(thdb->newWindow == 0) {
|
|---|
| 179 | DebugInt3();
|
|---|
| 180 | goto dummymessage;
|
|---|
| 181 | }
|
|---|
| 182 |
|
|---|
| 183 | win32wnd = (Win32BaseWindow *)thdb->newWindow;
|
|---|
| 184 |
|
|---|
| 185 | winMsg->message = WINWM_CREATE;
|
|---|
| 186 | winMsg->hwnd = win32wnd->getWindowHandle();
|
|---|
| 187 | winMsg->wParam = 0;
|
|---|
| 188 | winMsg->lParam = (LPARAM)win32wnd->tmpcs;
|
|---|
| 189 | break;
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | case WM_QUIT:
|
|---|
| 193 | winMsg->message = WINWM_QUIT;
|
|---|
| 194 | break;
|
|---|
| 195 |
|
|---|
| 196 | case WM_CLOSE:
|
|---|
| 197 | winMsg->message = WINWM_CLOSE;
|
|---|
| 198 | break;
|
|---|
| 199 |
|
|---|
| 200 | case WM_DESTROY:
|
|---|
| 201 | winMsg->message = WINWM_DESTROY;
|
|---|
| 202 | break;
|
|---|
| 203 |
|
|---|
| 204 | case WM_ENABLE:
|
|---|
| 205 | winMsg->message = WINWM_ENABLE;
|
|---|
| 206 | winMsg->wParam = SHORT1FROMMP(os2Msg->mp1);
|
|---|
| 207 | break;
|
|---|
| 208 |
|
|---|
| 209 | case WM_SHOW:
|
|---|
| 210 | winMsg->message = WINWM_SHOWWINDOW;
|
|---|
| 211 | winMsg->wParam = SHORT1FROMMP(os2Msg->mp1);
|
|---|
| 212 | break;
|
|---|
| 213 |
|
|---|
| 214 | case WM_WINDOWPOSCHANGED:
|
|---|
| 215 | {
|
|---|
| 216 | PSWP pswp = (PSWP)os2Msg->mp1;
|
|---|
| 217 | SWP swpOld = *(pswp + 1);
|
|---|
| 218 | HWND hParent = NULLHANDLE;
|
|---|
| 219 | LONG yDelta = pswp->cy - swpOld.cy;
|
|---|
| 220 | LONG xDelta = pswp->cx - swpOld.cx;
|
|---|
| 221 |
|
|---|
| 222 | dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
|
|---|
| 223 |
|
|---|
| 224 | if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) goto dummymessage;
|
|---|
| 225 |
|
|---|
| 226 | if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
|
|---|
| 227 | if (win32wnd->isChild()) {
|
|---|
| 228 | if(win32wnd->getParent()) {
|
|---|
| 229 | hParent = win32wnd->getParent()->getOS2WindowHandle();
|
|---|
| 230 | }
|
|---|
| 231 | else goto dummymessage; //parent has just been destroyed
|
|---|
| 232 | }
|
|---|
| 233 | }
|
|---|
| 234 | if(win32wnd->getParent()) {
|
|---|
| 235 | OSLibMapSWPtoWINDOWPOS(pswp, &thdb->wp, &swpOld, win32wnd->getParent()->getWindowHeight(),
|
|---|
| 236 | win32wnd->getParent()->getClientRectPtr()->left,
|
|---|
| 237 | win32wnd->getParent()->getClientRectPtr()->top,
|
|---|
| 238 | win32wnd->getOS2WindowHandle());
|
|---|
| 239 | }
|
|---|
| 240 | else OSLibMapSWPtoWINDOWPOS(pswp, &thdb->wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, win32wnd->getOS2WindowHandle());
|
|---|
| 241 |
|
|---|
| 242 | if (!win32wnd->CanReceiveSizeMsgs()) goto dummymessage;
|
|---|
| 243 |
|
|---|
| 244 | if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
|
|---|
| 245 | dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy));
|
|---|
| 246 | ///// win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
|
|---|
| 247 |
|
|---|
| 248 | thdb->wp.hwnd = win32wnd->getWindowHandle();
|
|---|
| 249 | if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
|
|---|
| 250 | {
|
|---|
| 251 | Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
|
|---|
| 252 | if(wndAfter)
|
|---|
| 253 | thdb->wp.hwndInsertAfter = wndAfter->getWindowHandle();
|
|---|
| 254 | else thdb->wp.hwndInsertAfter = HWND_TOP_W;
|
|---|
| 255 | }
|
|---|
| 256 | }
|
|---|
| 257 | winMsg->message = WINWM_WINDOWPOSCHANGED;
|
|---|
| 258 | winMsg->lParam = (LPARAM)&thdb->wp;
|
|---|
| 259 | break;
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | case WM_ACTIVATE:
|
|---|
| 263 | {
|
|---|
| 264 | HWND hwndActivate = (HWND)os2Msg->mp2;
|
|---|
| 265 | BOOL fMinimized = FALSE;
|
|---|
| 266 |
|
|---|
| 267 | hwndActivate = Win32BaseWindow::OS2ToWin32Handle(hwndActivate);
|
|---|
| 268 | if(hwndActivate == 0) {
|
|---|
| 269 | //another (non-win32) application's window
|
|---|
| 270 | //set to desktop window handle
|
|---|
| 271 | hwndActivate = windowDesktop->getWindowHandle();
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | if(win32wnd->getStyle() & WS_MINIMIZE_W)
|
|---|
| 275 | {
|
|---|
| 276 | fMinimized = TRUE;
|
|---|
| 277 | }
|
|---|
| 278 |
|
|---|
| 279 | winMsg->message = WINWM_ACTIVATE;
|
|---|
| 280 | winMsg->wParam = MAKELONG((SHORT1FROMMP(os2Msg->mp1)) ? WA_ACTIVE_W : WA_INACTIVE_W, fMinimized);
|
|---|
| 281 | winMsg->lParam = (LPARAM)hwndActivate;
|
|---|
| 282 | break;
|
|---|
| 283 | }
|
|---|
| 284 |
|
|---|
| 285 | case WM_SETFOCUS:
|
|---|
| 286 | {
|
|---|
| 287 | HWND hwndFocus = (HWND)os2Msg->mp1;
|
|---|
| 288 |
|
|---|
| 289 | if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
|
|---|
| 290 | //another (non-win32) application's window
|
|---|
| 291 | //set to NULL (allowed according to win32 SDK) to avoid problems
|
|---|
| 292 | hwndFocus = NULL;
|
|---|
| 293 | }
|
|---|
| 294 | else hwndFocus = Win32BaseWindow::OS2ToWin32Handle(hwndFocus);
|
|---|
| 295 |
|
|---|
| 296 | if((ULONG)os2Msg->mp2 == TRUE) {
|
|---|
| 297 | winMsg->message = WINWM_SETFOCUS;
|
|---|
| 298 | winMsg->wParam = (WPARAM)hwndFocus;
|
|---|
| 299 | }
|
|---|
| 300 | else {
|
|---|
| 301 | winMsg->message = WINWM_KILLFOCUS;
|
|---|
| 302 | winMsg->wParam = (WPARAM)hwndFocus;
|
|---|
| 303 | }
|
|---|
| 304 | break;
|
|---|
| 305 | }
|
|---|
| 306 |
|
|---|
| 307 | //**************************************************************************
|
|---|
| 308 | //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen
|
|---|
| 309 | //**************************************************************************
|
|---|
| 310 | case WM_HITTEST:
|
|---|
| 311 | winMsg->message = WINWM_NCHITTEST;
|
|---|
| 312 | winMsg->wParam = 0;
|
|---|
| 313 | winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
|
|---|
| 314 | if(!win32wnd->IsWindowEnabled()) {
|
|---|
| 315 | if(win32wnd->getParent()) {
|
|---|
| 316 | winMsg->hwnd = win32wnd->getParent()->getWindowHandle();
|
|---|
| 317 | }
|
|---|
| 318 | else goto dummymessage; //don't send mouse messages to disabled windows
|
|---|
| 319 | }
|
|---|
| 320 | break;
|
|---|
| 321 |
|
|---|
| 322 | case WM_BUTTON1DOWN:
|
|---|
| 323 | case WM_BUTTON1UP:
|
|---|
| 324 | case WM_BUTTON1DBLCLK:
|
|---|
| 325 | case WM_BUTTON2DOWN:
|
|---|
| 326 | case WM_BUTTON2UP:
|
|---|
| 327 | case WM_BUTTON2DBLCLK:
|
|---|
| 328 | case WM_BUTTON3DOWN:
|
|---|
| 329 | case WM_BUTTON3UP:
|
|---|
| 330 | case WM_BUTTON3DBLCLK:
|
|---|
| 331 | //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
|
|---|
| 332 |
|
|---|
| 333 | #ifdef ODIN_HITTEST
|
|---|
| 334 | //Send WM_HITTEST message
|
|---|
| 335 | win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
|
|---|
| 336 | #endif
|
|---|
| 337 | win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
|
|---|
| 338 |
|
|---|
| 339 | //if a window is disabled, it's parent receives the mouse messages
|
|---|
| 340 | if(!win32wnd->IsWindowEnabled()) {
|
|---|
| 341 | if(win32wnd->getParent()) {
|
|---|
| 342 | win32wnd = win32wnd->getParent();
|
|---|
| 343 | }
|
|---|
| 344 | fWasDisabled = TRUE;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | if(IsNCMouseMsg(win32wnd)) {
|
|---|
| 348 | winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
|
|---|
| 349 | winMsg->wParam = win32wnd->getLastHitTestVal();
|
|---|
| 350 | winMsg->lParam = MAKELONG(winMsg->pt.x, winMsg->pt.y); //screen coordinates
|
|---|
| 351 | }
|
|---|
| 352 | else {
|
|---|
| 353 | point.x = (*(POINTS *)&os2Msg->mp1).x;
|
|---|
| 354 | point.y = (*(POINTS *)&os2Msg->mp1).y;
|
|---|
| 355 | ClientPoint.x = mapOS2ToWin32X(win32wnd, point.x);
|
|---|
| 356 | ClientPoint.y = mapOS2ToWin32Y(win32wnd, point.y);
|
|---|
| 357 |
|
|---|
| 358 | winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
|
|---|
| 359 | winMsg->wParam = GetMouseKeyState();
|
|---|
| 360 | winMsg->lParam = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
|
|---|
| 361 | }
|
|---|
| 362 | if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED())
|
|---|
| 363 | {
|
|---|
| 364 | if(DInputMouseHandler(win32wnd->getWindowHandle(), winMsg->message, winMsg->pt.x, winMsg->pt.y)) {
|
|---|
| 365 | goto dummymessage; //dinput swallowed message
|
|---|
| 366 | }
|
|---|
| 367 | }
|
|---|
| 368 |
|
|---|
| 369 | if(fWasDisabled) {
|
|---|
| 370 | if(win32wnd) {
|
|---|
| 371 | winMsg->hwnd = win32wnd->getWindowHandle();
|
|---|
| 372 | }
|
|---|
| 373 | else goto dummymessage; //don't send mouse messages to disabled windows
|
|---|
| 374 | }
|
|---|
| 375 | break;
|
|---|
| 376 |
|
|---|
| 377 | case WM_BUTTON2MOTIONSTART:
|
|---|
| 378 | case WM_BUTTON2MOTIONEND:
|
|---|
| 379 | case WM_BUTTON2CLICK:
|
|---|
| 380 | case WM_BUTTON1MOTIONSTART:
|
|---|
| 381 | case WM_BUTTON1MOTIONEND:
|
|---|
| 382 | case WM_BUTTON1CLICK:
|
|---|
| 383 | case WM_BUTTON3MOTIONSTART:
|
|---|
| 384 | case WM_BUTTON3MOTIONEND:
|
|---|
| 385 | case WM_BUTTON3CLICK:
|
|---|
| 386 | goto dummymessage;
|
|---|
| 387 |
|
|---|
| 388 | case WM_MOUSEMOVE:
|
|---|
| 389 | {
|
|---|
| 390 | //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
|
|---|
| 391 |
|
|---|
| 392 | #ifdef ODIN_HITTEST
|
|---|
| 393 | //Send WM_HITTEST message
|
|---|
| 394 | win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
|
|---|
| 395 | #endif
|
|---|
| 396 |
|
|---|
| 397 | //if a window is disabled, it's parent receives the mouse messages
|
|---|
| 398 | if(!win32wnd->IsWindowEnabled()) {
|
|---|
| 399 | if(win32wnd->getParent()) {
|
|---|
| 400 | win32wnd = win32wnd->getParent();
|
|---|
| 401 | }
|
|---|
| 402 | fWasDisabled = TRUE;
|
|---|
| 403 | }
|
|---|
| 404 | if(IsNCMouseMsg(win32wnd))
|
|---|
| 405 | {
|
|---|
| 406 | winMsg->message = WINWM_NCMOUSEMOVE;
|
|---|
| 407 | winMsg->wParam = (WPARAM)win32wnd->getLastHitTestVal();
|
|---|
| 408 | winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
|
|---|
| 409 | }
|
|---|
| 410 | else
|
|---|
| 411 | {
|
|---|
| 412 | point.x = (*(POINTS *)&os2Msg->mp1).x;
|
|---|
| 413 | point.y = (*(POINTS *)&os2Msg->mp1).y;
|
|---|
| 414 | ClientPoint.x = mapOS2ToWin32X(win32wnd, point.x);
|
|---|
| 415 | ClientPoint.y = mapOS2ToWin32Y(win32wnd, point.y);
|
|---|
| 416 |
|
|---|
| 417 | winMsg->message = WINWM_MOUSEMOVE;
|
|---|
| 418 | winMsg->wParam = GetMouseKeyState();
|
|---|
| 419 | winMsg->lParam = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
|
|---|
| 420 | }
|
|---|
| 421 | if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED())
|
|---|
| 422 | {
|
|---|
| 423 | if(DInputMouseHandler(win32wnd->getWindowHandle(), winMsg->message, winMsg->pt.x, winMsg->pt.y)) {
|
|---|
| 424 | goto dummymessage; //dinput swallowed message
|
|---|
| 425 | }
|
|---|
| 426 | }
|
|---|
| 427 | if(fWasDisabled) {
|
|---|
| 428 | if(win32wnd) {
|
|---|
| 429 | winMsg->hwnd = win32wnd->getWindowHandle();
|
|---|
| 430 | }
|
|---|
| 431 | else goto dummymessage; //don't send mouse messages to disabled windows
|
|---|
| 432 | }
|
|---|
| 433 | //OS/2 Window coordinates -> Win32 Window coordinates
|
|---|
| 434 | break;
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 | case WM_CONTROL:
|
|---|
| 438 | goto dummymessage;
|
|---|
| 439 |
|
|---|
| 440 | case WM_COMMAND:
|
|---|
| 441 | if(SHORT1FROMMP(os2Msg->mp2) == CMDSRC_MENU) {
|
|---|
| 442 | winMsg->message = WINWM_COMMAND;
|
|---|
| 443 | winMsg->wParam = (WPARAM)SHORT1FROMMP(os2Msg->mp1); //id
|
|---|
| 444 | break;
|
|---|
| 445 | }
|
|---|
| 446 | //todo controls
|
|---|
| 447 | goto dummymessage;
|
|---|
| 448 |
|
|---|
| 449 | case WM_SYSCOMMAND:
|
|---|
| 450 | {
|
|---|
| 451 | ULONG x = 0, y = 0;
|
|---|
| 452 | ULONG win32sc;
|
|---|
| 453 |
|
|---|
| 454 | if(SHORT2FROMMP(os2Msg->mp2) == TRUE) {//syscommand caused by mouse action
|
|---|
| 455 | POINTL pointl;
|
|---|
| 456 | WinQueryPointerPos(HWND_DESKTOP, &pointl);
|
|---|
| 457 | x = pointl.x;
|
|---|
| 458 | y = mapScreenY(y);
|
|---|
| 459 | }
|
|---|
| 460 | switch(SHORT1FROMMP(os2Msg->mp1)) {
|
|---|
| 461 | case SC_MOVE:
|
|---|
| 462 | win32sc = SC_MOVE_W;
|
|---|
| 463 | break;
|
|---|
| 464 | case SC_CLOSE:
|
|---|
| 465 | win32sc = SC_CLOSE_W;
|
|---|
| 466 | break;
|
|---|
| 467 | case SC_MAXIMIZE:
|
|---|
| 468 | win32sc = SC_MAXIMIZE_W;
|
|---|
| 469 | break;
|
|---|
| 470 | case SC_MINIMIZE:
|
|---|
| 471 | win32sc = SC_MINIMIZE_W;
|
|---|
| 472 | break;
|
|---|
| 473 | case SC_NEXTFRAME:
|
|---|
| 474 | case SC_NEXTWINDOW:
|
|---|
| 475 | win32sc = SC_NEXTWINDOW_W;
|
|---|
| 476 | break;
|
|---|
| 477 | case SC_RESTORE:
|
|---|
| 478 | win32sc = SC_RESTORE_W;
|
|---|
| 479 | break;
|
|---|
| 480 | case SC_TASKMANAGER:
|
|---|
| 481 | win32sc = SC_TASKLIST_W;
|
|---|
| 482 | break;
|
|---|
| 483 | default:
|
|---|
| 484 | goto dummymessage;
|
|---|
| 485 | }
|
|---|
| 486 | winMsg->message = WINWM_SYSCOMMAND;
|
|---|
| 487 | winMsg->wParam = (WPARAM)win32sc;
|
|---|
| 488 | winMsg->lParam = MAKELONG((USHORT)x, (USHORT)y);
|
|---|
| 489 | break;
|
|---|
| 490 | }
|
|---|
| 491 | case WM_CHAR:
|
|---|
| 492 | {
|
|---|
| 493 | ULONG repeatCount=0, virtualKey=0, keyFlags=0, scanCode=0;
|
|---|
| 494 | ULONG flags = SHORT1FROMMP(os2Msg->mp1);
|
|---|
| 495 | BOOL keyWasPressed;
|
|---|
| 496 | char c;
|
|---|
| 497 |
|
|---|
| 498 | thdb->fTranslated = FALSE;
|
|---|
| 499 | repeatCount = CHAR3FROMMP(os2Msg->mp1);
|
|---|
| 500 | scanCode = CHAR4FROMMP(os2Msg->mp1);
|
|---|
| 501 | keyWasPressed = ((SHORT1FROMMP (os2Msg->mp1) & KC_PREVDOWN) == KC_PREVDOWN);
|
|---|
| 502 |
|
|---|
| 503 | dprintf(("PM: WM_CHAR: %x %x %d %x", SHORT1FROMMP(os2Msg->mp2), SHORT2FROMMP(os2Msg->mp2), repeatCount, scanCode));
|
|---|
| 504 | dprintf(("PM: WM_CHAR: hwnd %x flags %x", win32wnd->getWindowHandle(), flags));
|
|---|
| 505 |
|
|---|
| 506 | // vitali add begin
|
|---|
| 507 | if ( ( SHORT1FROMMP(os2Msg->mp2) & 0x0FF ) == 0x0E0 )
|
|---|
| 508 | {
|
|---|
| 509 | // an extended key ( arrows, ins, del and so on )
|
|---|
| 510 | // get "virtual" scancode from character code cause
|
|---|
| 511 | // for "regular" keys they are equal
|
|---|
| 512 | scanCode = ( SHORT1FROMMP(os2Msg->mp2) >> 8) & 0x0FF;
|
|---|
| 513 | }
|
|---|
| 514 | // vitali add end
|
|---|
| 515 |
|
|---|
| 516 | // both WM_KEYUP & WM_KEYDOWN want a virtual key, find the right Win32 virtual key
|
|---|
| 517 | // given the OS/2 virtual key and OS/2 character
|
|---|
| 518 |
|
|---|
| 519 | //if (((SHORT1FROMMP (mp1) & KC_CHAR) == KC_CHAR) ||
|
|---|
| 520 | // ((SHORT1FROMMP (mp1) & KC_LONEKEY) == KC_LONEKEY))
|
|---|
| 521 | c = 0;
|
|---|
| 522 | if ((SHORT1FROMMP (os2Msg->mp1) & 0xFF) != 0)
|
|---|
| 523 | {
|
|---|
| 524 | c = SHORT1FROMMP (os2Msg->mp2);
|
|---|
| 525 | if ((c >= 'A') && (c <= 'Z')) {
|
|---|
| 526 | virtualKey = c;
|
|---|
| 527 | goto VirtualKeyFound;
|
|---|
| 528 | }
|
|---|
| 529 | if ((c >='a') && (c <= 'z')) {
|
|---|
| 530 | virtualKey = c - 32; // make it uppercase
|
|---|
| 531 | goto VirtualKeyFound;
|
|---|
| 532 | }
|
|---|
| 533 | if ((c >= '0') && (c <= '9')) {
|
|---|
| 534 | virtualKey = c;
|
|---|
| 535 | goto VirtualKeyFound;
|
|---|
| 536 | }
|
|---|
| 537 | }
|
|---|
| 538 |
|
|---|
| 539 | // convert OS/2 virtual keys to Win32 virtual key
|
|---|
| 540 | if (SHORT2FROMMP (os2Msg->mp2) <= VK_BLK2)
|
|---|
| 541 | virtualKey = virtualKeyTable [SHORT2FROMMP (os2Msg->mp2)];
|
|---|
| 542 |
|
|---|
| 543 | VirtualKeyFound:
|
|---|
| 544 | dprintf (("VIRTUALKEYFOUND:(%x)", virtualKey));
|
|---|
| 545 |
|
|---|
| 546 | winMsg->wParam = virtualKey;
|
|---|
| 547 | winMsg->lParam = repeatCount & 0x0FFFF; // bit 0-15, repeatcount
|
|---|
| 548 | winMsg->lParam |= (scanCode & 0x0FF) << 16; // bit 16-23, scancode
|
|---|
| 549 |
|
|---|
| 550 | //TODO: Is this correct and complete? (how does PM differentiate between
|
|---|
| 551 | // i.e numeric pad pgdn & 'normal' pgdn??)
|
|---|
| 552 | //Check if it's an extended key
|
|---|
| 553 | switch(virtualKey) {
|
|---|
| 554 | case VK_RETURN_W:
|
|---|
| 555 | //The enter key on the numeric keypad is an extended key
|
|---|
| 556 | if(SHORT2FROMMP(os2Msg->mp2) != VK_NEWLINE)
|
|---|
| 557 | break;
|
|---|
| 558 | //no break
|
|---|
| 559 | case VK_LEFT_W:
|
|---|
| 560 | case VK_RIGHT_W:
|
|---|
| 561 | case VK_DOWN_W:
|
|---|
| 562 | case VK_UP_W:
|
|---|
| 563 | case VK_PRIOR_W:
|
|---|
| 564 | case VK_NEXT_W:
|
|---|
| 565 | case VK_END_W:
|
|---|
| 566 | case VK_DIVIDE_W:
|
|---|
| 567 | case VK_DELETE_W:
|
|---|
| 568 | case VK_HOME_W:
|
|---|
| 569 | case VK_INSERT_W:
|
|---|
| 570 | case VK_RCONTROL_W:
|
|---|
| 571 | case VK_RMENU_W: //is this the right alt???
|
|---|
| 572 | winMsg->lParam = winMsg->lParam | (1<<24);
|
|---|
| 573 | break;
|
|---|
| 574 | }
|
|---|
| 575 |
|
|---|
| 576 | if(!(SHORT1FROMMP(os2Msg->mp1) & KC_ALT))
|
|---|
| 577 | {
|
|---|
| 578 | //
|
|---|
| 579 | // the Alt key is not pressed
|
|---|
| 580 | //
|
|---|
| 581 | if ((flags & KC_KEYUP) == KC_KEYUP) {
|
|---|
| 582 | // send WM_KEYUP message
|
|---|
| 583 |
|
|---|
| 584 | winMsg->message = WINWM_KEYUP;
|
|---|
| 585 | winMsg->lParam |= 1 << 30; // bit 30, previous state, always 1 for a WM_KEYUP message
|
|---|
| 586 | winMsg->lParam |= 1 << 31; // bit 31, transition state, always 1 for WM_KEYUP
|
|---|
| 587 | }
|
|---|
| 588 | else {
|
|---|
| 589 | // send WM_KEYDOWN message
|
|---|
| 590 | winMsg->message = WINWM_KEYDOWN;
|
|---|
| 591 | if (keyWasPressed)
|
|---|
| 592 | winMsg->lParam |= 1 << 30; // bit 30, previous state, 1 means key was pressed
|
|---|
| 593 | }
|
|---|
| 594 | }
|
|---|
| 595 | else {
|
|---|
| 596 | //
|
|---|
| 597 | // the Alt key is pressed
|
|---|
| 598 | //
|
|---|
| 599 | if ((flags & KC_KEYUP) == KC_KEYUP) {
|
|---|
| 600 | // send WM_SYSKEYUP message
|
|---|
| 601 |
|
|---|
| 602 | winMsg->message = WINWM_SYSKEYUP;
|
|---|
| 603 | winMsg->lParam |= 1 << 30; // bit 30, previous state, always 1 for a WM_KEYUP message
|
|---|
| 604 | winMsg->lParam |= 1 << 31; // bit 31, transition state, always 1 for WM_KEYUP
|
|---|
| 605 | }
|
|---|
| 606 | else {
|
|---|
| 607 | // send WM_SYSKEYDOWN message
|
|---|
| 608 | winMsg->message = WINWM_SYSKEYDOWN;
|
|---|
| 609 | if (keyWasPressed)
|
|---|
| 610 | winMsg->lParam |= 1 << 30; // bit 30, previous state, 1 means key was pressed
|
|---|
| 611 | }
|
|---|
| 612 | if(winMsg->wParam == VK_MENU_W) {
|
|---|
| 613 | winMsg->message = 0; //WM_SYS* already implies Alt
|
|---|
| 614 | }
|
|---|
| 615 | }
|
|---|
| 616 | if(ISKDB_CAPTURED())
|
|---|
| 617 | {
|
|---|
| 618 | if(DInputKeyBoardHandler(winMsg)) {
|
|---|
| 619 | goto dummymessage; //dinput swallowed message
|
|---|
| 620 | }
|
|---|
| 621 | }
|
|---|
| 622 | break;
|
|---|
| 623 | }
|
|---|
| 624 |
|
|---|
| 625 | case WM_TIMER:
|
|---|
| 626 | if (os2Msg->mp2)
|
|---|
| 627 | {
|
|---|
| 628 | BOOL sys;
|
|---|
| 629 | ULONG id;
|
|---|
| 630 |
|
|---|
| 631 | if (TIMER_GetTimerInfo(os2Msg->hwnd,(ULONG)os2Msg->mp1,&sys,&id))
|
|---|
| 632 | {
|
|---|
| 633 | winMsg->wParam = (WPARAM)id;
|
|---|
| 634 | winMsg->message= (sys) ? WINWM_SYSTIMER : WINWM_TIMER;
|
|---|
| 635 | break;
|
|---|
| 636 | }
|
|---|
| 637 | }
|
|---|
| 638 | goto dummymessage; //for caret blinking
|
|---|
| 639 |
|
|---|
| 640 | case WM_SETWINDOWPARAMS:
|
|---|
| 641 | {
|
|---|
| 642 | WNDPARAMS *wndParams = (WNDPARAMS *)os2Msg->mp1;
|
|---|
| 643 |
|
|---|
| 644 | if(wndParams->fsStatus & WPM_TEXT) {
|
|---|
| 645 | winMsg->message = WINWM_SETTEXT;
|
|---|
| 646 | winMsg->lParam = (LPARAM)wndParams->pszText;
|
|---|
| 647 | break;
|
|---|
| 648 | }
|
|---|
| 649 | goto dummymessage;
|
|---|
| 650 | }
|
|---|
| 651 |
|
|---|
| 652 | #if 0
|
|---|
| 653 | case WM_QUERYWINDOWPARAMS:
|
|---|
| 654 | {
|
|---|
| 655 | PWNDPARAMS wndpars = (PWNDPARAMS)mp1;
|
|---|
| 656 | ULONG textlen;
|
|---|
| 657 | PSZ wintext;
|
|---|
| 658 |
|
|---|
| 659 | if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT))
|
|---|
| 660 | {
|
|---|
| 661 | if(wndpars->fsStatus & WPM_CCHTEXT)
|
|---|
| 662 | wndpars->cchText = win32wnd->MsgGetTextLength();
|
|---|
| 663 | if(wndpars->fsStatus & WPM_TEXT)
|
|---|
| 664 | wndpars->pszText = win32wnd->MsgGetText();
|
|---|
| 665 |
|
|---|
| 666 | wndpars->fsStatus = 0;
|
|---|
| 667 | wndpars->cbCtlData = 0;
|
|---|
| 668 | wndpars->cbPresParams = 0;
|
|---|
| 669 | goto dummymessage;
|
|---|
| 670 | }
|
|---|
| 671 | }
|
|---|
| 672 | #endif
|
|---|
| 673 |
|
|---|
| 674 | case WM_PAINT:
|
|---|
| 675 | {
|
|---|
| 676 | if(win32wnd->IsWindowIconic()) {
|
|---|
| 677 | winMsg->message = WINWM_PAINTICON;
|
|---|
| 678 | }
|
|---|
| 679 | else winMsg->message = WINWM_PAINT;
|
|---|
| 680 | break;
|
|---|
| 681 | }
|
|---|
| 682 |
|
|---|
| 683 | case WM_CONTEXTMENU:
|
|---|
| 684 | winMsg->message = WINWM_CONTEXTMENU;
|
|---|
| 685 | winMsg->wParam = win32wnd->getWindowHandle();
|
|---|
| 686 | winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
|
|---|
| 687 | break;
|
|---|
| 688 |
|
|---|
| 689 | case WM_INITMENU:
|
|---|
| 690 | case WM_MENUSELECT:
|
|---|
| 691 | case WM_MENUEND:
|
|---|
| 692 | case WM_NEXTMENU:
|
|---|
| 693 | case WM_SYSCOLORCHANGE:
|
|---|
| 694 | case WM_SYSVALUECHANGED:
|
|---|
| 695 | case WM_SETSELECTION:
|
|---|
| 696 | case WM_PPAINT:
|
|---|
| 697 | case WM_PSETFOCUS:
|
|---|
| 698 | case WM_PSYSCOLORCHANGE:
|
|---|
| 699 | case WM_PSIZE:
|
|---|
| 700 | case WM_PACTIVATE:
|
|---|
| 701 | case WM_PCONTROL:
|
|---|
| 702 | case WM_HELP:
|
|---|
| 703 | case WM_APPTERMINATENOTIFY:
|
|---|
| 704 | case WM_PRESPARAMCHANGED:
|
|---|
| 705 | case WM_DRAWITEM:
|
|---|
| 706 | case WM_MEASUREITEM:
|
|---|
| 707 | case WM_CONTROLPOINTER:
|
|---|
| 708 | case WM_QUERYDLGCODE:
|
|---|
| 709 | case WM_SUBSTITUTESTRING:
|
|---|
| 710 | case WM_MATCHMNEMONIC:
|
|---|
| 711 | case WM_SAVEAPPLICATION:
|
|---|
| 712 | case WM_SEMANTICEVENT:
|
|---|
| 713 | default:
|
|---|
| 714 | dummymessage:
|
|---|
| 715 | winMsg->message = 0;
|
|---|
| 716 | winMsg->wParam = 0;
|
|---|
| 717 | winMsg->lParam = 0;
|
|---|
| 718 | return FALSE;
|
|---|
| 719 | }
|
|---|
| 720 | return TRUE;
|
|---|
| 721 | }
|
|---|
| 722 | //******************************************************************************
|
|---|
| 723 | //******************************************************************************
|
|---|
| 724 | BOOL OSLibWinTranslateMessage(MSG *msg)
|
|---|
| 725 | {
|
|---|
| 726 | THDB *thdb;
|
|---|
| 727 |
|
|---|
| 728 | thdb = GetThreadTHDB();
|
|---|
| 729 | if(!thdb) {
|
|---|
| 730 | return FALSE;
|
|---|
| 731 | }
|
|---|
| 732 | //NOTE: These actually need to be posted so that the next message retrieved by GetMessage contains
|
|---|
| 733 | // the newly generated WM_CHAR message.
|
|---|
| 734 | if(!thdb->fTranslated && thdb->os2msg.msg == WM_CHAR && !((SHORT1FROMMP(thdb->os2msg.mp1) & KC_KEYUP) == KC_KEYUP))
|
|---|
| 735 | {//TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message
|
|---|
| 736 | ULONG fl = SHORT1FROMMP(thdb->os2msg.mp1);
|
|---|
| 737 | MSG extramsg;
|
|---|
| 738 |
|
|---|
| 739 | memcpy(&extramsg, msg, sizeof(MSG));
|
|---|
| 740 | extramsg.wParam = SHORT1FROMMP(thdb->os2msg.mp2);
|
|---|
| 741 | extramsg.lParam = 0;
|
|---|
| 742 |
|
|---|
| 743 | if(!(fl & KC_CHAR) && msg->message < WINWM_SYSKEYDOWN) {
|
|---|
| 744 | return FALSE;
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 | if(fl & KC_VIRTUALKEY) {
|
|---|
| 748 | if(msg->wParam)
|
|---|
| 749 | extramsg.wParam = msg->wParam;
|
|---|
| 750 | else extramsg.wParam = SHORT2FROMMP(thdb->os2msg.mp2);
|
|---|
| 751 | }
|
|---|
| 752 |
|
|---|
| 753 |
|
|---|
| 754 | if(msg->message >= WINWM_SYSKEYDOWN) {
|
|---|
| 755 | extramsg.message = WINWM_SYSCHAR;
|
|---|
| 756 | }
|
|---|
| 757 | else extramsg.message = WINWM_CHAR;
|
|---|
| 758 |
|
|---|
| 759 | if(fl & KC_DEADKEY) {
|
|---|
| 760 | extramsg.message++; //WM_DEADCHAR/WM_SYSDEADCHAR
|
|---|
| 761 | }
|
|---|
| 762 |
|
|---|
| 763 | extramsg.lParam = msg->lParam & 0x00FFFFFF;
|
|---|
| 764 | if(fl & KC_ALT)
|
|---|
| 765 | extramsg.lParam |= (1<<29);
|
|---|
| 766 | if(fl & KC_PREVDOWN)
|
|---|
| 767 | extramsg.lParam |= (1<<30);
|
|---|
| 768 | if(fl & KC_KEYUP)
|
|---|
| 769 | extramsg.lParam |= (1<<31);
|
|---|
| 770 |
|
|---|
| 771 | thdb->fTranslated = TRUE;
|
|---|
| 772 | memcpy(&thdb->msgWCHAR, &extramsg, sizeof(MSG));
|
|---|
| 773 | return TRUE;
|
|---|
| 774 | }
|
|---|
| 775 | return FALSE;
|
|---|
| 776 | }
|
|---|
| 777 | //******************************************************************************
|
|---|
| 778 | //******************************************************************************
|
|---|
| 779 |
|
|---|