Changeset 9814 for trunk/src


Ignore:
Timestamp:
Feb 16, 2003, 7:29:27 PM (23 years ago)
Author:
sandervl
Message:

Do not translate WM_KEYUP to WM_SYSKEYUP if AltGr released and KC_LONEKEY flag is set. (only for Alt); GetKeyboardState, GetKeyState, GetAsyncKeyState: pretend left Ctrl key is pressed if AltGr down

Location:
trunk/src/user32
Files:
2 edited

Legend:

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

    r9792 r9814  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.101 2003-02-13 10:34:48 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.102 2003-02-16 18:29:26 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    602602        break;
    603603    }
     604
     605    case WM_CHAR_SPECIAL_ALTGRCONTROL:
     606    {
     607        // special char message from the keyboard hook
     608        dprintf(("PM: WM_CHAR_SPECIAL_ALTGRCONTROL"));
     609       
     610      // NO BREAK! FALLTHRU CASE!
     611    }
    604612     
    605613    case WM_CHAR_SPECIAL:
     
    607615        // @@@PH
    608616        // special char message from the keyboard hook
    609         dprintf(("PM: WM_CHAR_SPECIAL\n"));
     617        if(os2Msg->msg == WM_CHAR_SPECIAL) {
     618            dprintf(("PM: WM_CHAR_SPECIAL"));
     619        }
    610620       
    611621      // NO BREAK! FALLTHRU CASE!
     
    689699          {
    690700            // check for a lonesome ALT key ...
     701            // SvL: Only Left Alt; AltGr generates a WM_KEYUP when released
    691702            if ( (flags & KC_LONEKEY) &&
    692                 ((winMsg->wParam == VK_LMENU_W) || (winMsg->wParam == VK_RMENU_W)) )
     703                (winMsg->wParam == VK_LMENU_W) )
    693704            {
    694705              winMsg->message = WINWM_SYSKEYUP;
     
    751762          }
    752763          // if right alt is down, then we need to set the alt down bit too
    753           if (WinGetKeyState(HWND_DESKTOP, VK_ALTGRAF) & 0x8000) {
     764          // except for the fake Ctrl WM_CHAR sent for AltGr emulation
     765          if (os2Msg->msg != WM_CHAR_SPECIAL_ALTGRCONTROL &&
     766              (WinGetKeyState(HWND_DESKTOP, VK_ALTGRAF) & 0x8000))
     767          {
    754768              winMsg->lParam |= WIN_KEY_ALTHELD;           
    755769          }
     
    781795          }
    782796        }
     797#if 0
     798        //
     799        // AltGr needs special handling
     800        //
     801        // AltGr -> WM_KEYDOWN (VK_CONTROL), WM_KEYDOWN (VK_MENU)
     802        //          WM_SYSKEYUP (VK_CONTROL)
     803        //          WM_KEYUP (VK_MENU)
     804        //
     805        // Ctrl+AltGr -> WM_KEYDOWN (VK_CONTROL), WM_KEYUP (VK_CONTROL)
     806        //               WM_KEYDOWN (VK_MENU)
     807        //               WM_KEYUP (VK_MENU)
     808        //               WM_KEYUP (VK_CONTROL)
     809        //
     810        // AltGr+Ctrl -> WM_KEYDOWN (VK_CONTROL), WM_KEYDOWN (VK_MENU)
     811        //               WM_KEYDOWN (VK_CONTROL)
     812        //               WM_SYSKEYUP (VK_CONTROL)
     813        //               WM_SYSKEYUP (VK_CONTROL)
     814        //               WM_KEYUP (VK_MENU)
     815        //
     816        // AltGr down -> if Ctrl down, send WM_KEYUP (VK_CONTROL)
     817        //               endif
     818        //               Send WM_KEYDOWN (VK_CONTROL)
     819        //               Send WM_KEYDOWN (VK_MENU)
     820        // AltGr up ->   if !(Ctrl down before AltGr was pressed || Ctrl up)
     821        //                   Send WM_SYSKEYUP (VK_CONTROL)
     822        //               endif
     823        //               Send WM_KEYDOWN (VK_MENU)
     824        //
     825        if(winMsg->wParam == VK_MENU_W && (winMsg->lParam & WIN_KEY_EXTENDED))
     826        {//AltGr
     827            if(GetKeyState(VK_CONTROL_W) & 0x8000)
     828            {//Ctrl key pressed, send WM_KEYUP
     829           
     830            }
     831        }
     832#endif
     833
    783834        //After SetFocus(0), all keystrokes are converted in WM_SYS*
    784835        if(fIgnoreKeystrokes) {
  • trunk/src/user32/winkeyboard.cpp

    r9810 r9814  
    1 /* $Id: winkeyboard.cpp,v 1.39 2003-02-16 15:31:12 sandervl Exp $ */
     1/* $Id: winkeyboard.cpp,v 1.40 2003-02-16 18:29:27 sandervl Exp $ */
    22/*
    33 * Win32 <-> PM key translation
     
    985985{
    986986#if 1
     987   //temporary solution until we find out why OSLibWinGetScanStateTable always
     988   //fails
    987989   int state;
    988990   for(int i=0;i<256;i++) {
     
    993995       }
    994996   }
    995    return TRUE;
    996 #if 1
    997997#else
    998998   BYTE PMScanState[256];
     
    10221022       }
    10231023   }
     1024#endif
     1025
     1026   //VK_LCONTROL needs special handling due to AltGr
     1027   state = GetKeyState(VK_RMENU);
     1028   if (state & 0x8000)
     1029   {//if AltGr is down, then pretend VK_LCONTROL is down too
     1030       lpKeyState[VK_LCONTROL] = ((state & 0x8000) >> 8) | (state & 1);
     1031       lpKeyState[VK_CONTROL]  = ((state & 0x8000) >> 8) | (state & 1);
     1032   }
     1033
    10241034   //now process the mouse buttons (left, middle, right)
    10251035   state = GetKeyState(VK_LBUTTON);
     
    10411051#endif
    10421052   return TRUE;
    1043 #endif
    1044 #else
    1045  BYTE   PMKeyState[256];
    1046  BOOL   rc;
    1047 
    1048   memset(PMKeyState, 0, sizeof(PMKeyState));
    1049   memset(lpKeyState, 0, 256);
    1050   rc = OSLibWinGetKeyboardStateTable((PBYTE)&PMKeyState[0] );
    1051 ////  rc = O32_GetKeyboardState(lpKeyState);
    1052   if(rc == TRUE)
    1053   {
    1054     KeyTranslatePMToWinBuf((BYTE *)&PMKeyState[0], lpKeyState, 256);
    1055    
    1056     // @@@PH
    1057     // Note: we'd have to check the key state overlay array here, too!
    1058    
    1059 #ifdef DEBUG
    1060         for(int i=0;i<256;i++) {
    1061             if(PMKeyState[i] & 0x80) {
    1062                 dprintf2(("PM  key 0x%0x = %x", i, PMKeyState[i]));
    1063             }
    1064         }
    1065         for(i=0;i<256;i++) {
    1066             if(lpKeyState[i]) {
    1067                 dprintf2(("Win key 0x%0x = %x", i, lpKeyState[i]));
    1068             }
    1069         }
    1070 #endif
    1071         return TRUE;
    1072   }
    1073   return FALSE;
    1074 #endif
    10751053}
    10761054//******************************************************************************
     
    14771455      WORD result;
    14781456
     1457      if (nVirtKey == VK_CONTROL || nVirtKey == VK_LCONTROL)
     1458      {//if AltGr is down, then pretend VK_LCONTROL is down too
     1459          result = OSLibWinGetScanState(abWinVKeyToPMScan[VK_RMENU].bPMScanCode);
     1460          if(result & 0x8000) {
     1461              return result;
     1462          }
     1463          //not down, check the control keys
     1464      }
     1465
    14791466      if (nVirtKey == VK_MENU)  {
    14801467          nVirtKey  = VK_LMENU;
     
    15281515      WORD result;
    15291516
     1517      if (nVirtKey == VK_CONTROL || nVirtKey == VK_LCONTROL)
     1518      {//if AltGr is down, then pretend VK_LCONTROL is down too
     1519          result = OSLibWinGetPhysKeyState(abWinVKeyToPMScan[VK_RMENU].bPMScanCode);
     1520          if(result & 0x8000) {
     1521              return result;
     1522          }
     1523          //not down, check the control keys
     1524      }
    15301525      if (nVirtKey == VK_MENU)  {
    15311526          nVirtKey  = VK_LMENU;
Note: See TracChangeset for help on using the changeset viewer.