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