Ignore:
Timestamp:
Oct 23, 2001, 8:00:45 AM (24 years ago)
Author:
phaller
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/oslibmsgtranslate.cpp

    r7163 r7164  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.62 2001-10-23 04:25:39 phaller Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.63 2001-10-23 06:00:45 phaller Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    101101    0x10, 0x36,     // 0x36 RShift
    102102    0x6A, 0x37,     // 0x37 * Pad
    103     0x12, 0x38,     // 0x38 LAlt
     103//  0x12, 0x38,     // 0x38 LAlt
     104    VK_LMENU_W, 0x38,     // 0x38 LAlt
    104105    0x20, 0x39,     // 0x39 Space
    105106    0x14, 0x3A,     // 0x3A CapsLk
     
    120121    0x21, 0x49,     // 0x49 9 Pad
    121122    0x6D, 0x4A,     // 0x4A - Pad
    122     0x25, 0x4B,     // 0x4B 4 Pad
     123    VK_LEFT_W, 0x4B,  // 0x4B Left Arrow (depends on NumLock State)
    123124    0x0C, 0x4C,     // 0x4C 5 Pad
    124125    0x27, 0x4D,     // 0x4D 6 Pad
     
    603604     
    604605    case WM_CHAR_SPECIAL:
     606      {
    605607        // @@@PH
    606608        // special char message from the keyboard hook
    607609        dprintf(("PM: WM_CHAR_SPECIAL\n"));
     610       
     611        // AltGr is a very, very strange key!
     612        UCHAR ucPMScanCode = CHAR4FROMMP(os2Msg->mp1);
     613        if (PMSCAN_ALTRIGHT == ucPMScanCode)
     614        {
     615          ULONG flags = SHORT1FROMMP(os2Msg->mp1);
     616         
     617          // we need very special treatment here for the
     618          // poor, crippled AltGr key
     619         
     620          if (flags & KC_KEYUP)
     621          {
     622            // key up
     623            // 1 - generate a virtual LCONTROL-keypress
     624            // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-Alt!)
     625          }
     626          else
     627          {
     628            // key down:
     629            // 1 - generate a virtual LCONTROL-keypress
     630            // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-Alt!)
     631          }
     632        }
     633      }
    608634        // NO BREAK! FALLTHRU CASE!
    609635     
     
    620646        keyWasPressed = ((SHORT1FROMMP (os2Msg->mp1) & KC_PREVDOWN) == KC_PREVDOWN);
    621647
    622         dprintf(("PM: WM_CHAR: %x %x %d %x", SHORT1FROMMP(os2Msg->mp2), SHORT2FROMMP(os2Msg->mp2), repeatCount, scanCode));
     648        dprintf(("PM: WM_CHAR: %x %x rep=%d scancode=%x", SHORT1FROMMP(os2Msg->mp2), SHORT2FROMMP(os2Msg->mp2), repeatCount, scanCode));
    623649        dprintf(("PM: WM_CHAR: hwnd %x flags %x mp1 %x, mp2 %x", win32wnd->getWindowHandle(), flags, os2Msg->mp1, os2Msg->mp2));
    624650
     
    680706        if (!(flags & KC_ALT))
    681707        {
    682             //
    683             // the Alt key is not pressed
    684             //
    685             if ((flags & KC_KEYUP) == KC_KEYUP) {
    686                 // send WM_KEYUP message
    687 
    688                 winMsg->message = WINWM_KEYUP;
    689                 winMsg->lParam |= 1 << 30;                              // bit 30, previous state, always 1 for a WM_KEYUP message
    690                 winMsg->lParam |= 1 << 31;                              // bit 31, transition state, always 1 for WM_KEYUP
    691             }
    692             else {
    693                 // send WM_KEYDOWN message
    694                 winMsg->message = WINWM_KEYDOWN;
    695                 if (keyWasPressed)
    696                     winMsg->lParam |= 1 << 30;                          // bit 30, previous state, 1 means key was pressed
    697             }
    698         }
    699         else {
    700             //
    701             // the Alt key is pressed
    702             //
    703             if ((flags & KC_KEYUP) == KC_KEYUP) {
    704                 // send WM_SYSKEYUP message
    705 
    706                 winMsg->message = WINWM_SYSKEYUP;
    707                 winMsg->lParam |= 1 << 30;                              // bit 30, previous state, always 1 for a WM_KEYUP message
    708                 winMsg->lParam |= 1 << 31;                              // bit 31, transition state, always 1 for WM_KEYUP
    709             }
    710             else {
    711                 // send WM_SYSKEYDOWN message
    712                 winMsg->message = WINWM_SYSKEYDOWN;
    713                 if (keyWasPressed)
    714                     winMsg->lParam |= 1 << 30;                          // bit 30, previous state, 1 means key was pressed
    715             }
    716 //NT sends WM_SYSKEYDOWN for single Alt key
    717 #if 0
    718             if(winMsg->wParam == VK_MENU_W) {
    719                 winMsg->message = 0; //WM_SYS* already implies Alt
    720             }
    721 #endif
    722         }
     708          //
     709          // the Alt key is not pressed
     710          // or no more pressed
     711          //
     712          if (flags & KC_KEYUP)
     713          {
     714            // check for a lonesome ALT key ...
     715            if ( (flags & KC_LONEKEY) &&
     716                (winMsg->wParam == VK_LMENU_W) )
     717            {
     718              winMsg->message = WINWM_SYSKEYUP;
     719             
     720              // held ALT-key when current key is released
     721              // generates additional flag 0x2000000
     722              // Note: PM seems to do this differently,
     723              // KC_ALT is already reset
     724            }
     725            else
     726            {
     727              // send WM_KEYUP message
     728              winMsg->message = WINWM_KEYUP;
     729            }
     730           
     731            winMsg->lParam |= 1 << 30;                              // bit 30, previous state, always 1 for a WM_KEYUP message
     732            winMsg->lParam |= 1 << 31;                              // bit 31, transition state, always 1 for WM_KEYUP
     733          }
     734          else
     735          {
     736            // send WM_KEYDOWN message
     737            winMsg->message = WINWM_KEYDOWN;
     738            if (keyWasPressed)
     739              winMsg->lParam |= 1 << 30;                          // bit 30, previous state, 1 means key was pressed
     740          }
     741        }
     742        else
     743        {
     744          //
     745          // the Alt key is pressed
     746          //
     747          if (flags & KC_KEYUP)
     748          {
     749            // send WM_SYSKEYUP message
     750            winMsg->message = WINWM_SYSKEYUP;
     751            winMsg->lParam |= 1 << 30;                              // bit 30, previous state, always 1 for a WM_KEYUP message
     752            winMsg->lParam |= 1 << 31;                              // bit 31, transition state, always 1 for WM_KEYUP
     753          }
     754          else
     755          {
     756            // send WM_SYSKEYDOWN message
     757            winMsg->message = WINWM_SYSKEYDOWN;
     758            if (keyWasPressed)
     759              winMsg->lParam |= 1 << 30;                          // bit 30, previous state, 1 means key was pressed
     760
     761            // pressed ALT-key generates additional flag 0x2000000
     762            // if the current window has keyboard focus
     763            winMsg->lParam |= 1 << 29;
     764          }
     765        }
     766     
     767     
    723768        if (ISKDB_CAPTURED())
    724769        {
Note: See TracChangeset for help on using the changeset viewer.