Changeset 7211 for trunk/src


Ignore:
Timestamp:
Oct 26, 2001, 11:10:57 AM (24 years ago)
Author:
phaller
Message:

.

Location:
trunk/src/user32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/HOOK.CPP

    r7190 r7211  
    1 /* $Id: HOOK.CPP,v 1.29 2001-10-24 12:26:56 phaller Exp $ */
     1/* $Id: HOOK.CPP,v 1.30 2001-10-26 09:10:12 phaller Exp $ */
    22
    33/*
     
    818818        }
    819819    }
    820 
     820 
     821    // this undoc (don't care) bit isn't passed through to this hook
     822    DWORD lParam = msg->lParam & ~0x02000000;
     823 
    821824    return (HOOK_CallHooksA( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE,
    822                              LOWORD (msg->wParam), msg->lParam )
     825                             LOWORD (msg->wParam), lParam )
    823826                             ? TRUE : FALSE);
    824827}
     
    845848 
    846849  kbhs.vkCode      = msg->wParam;
    847   kbhs.scanCode    = ( (msg->lParam & 0x00ff0000) >> 16);
     850  kbhs.scanCode    = ( (msg->lParam & 0x03ff0000) >> 16);
    848851 
    849852  BOOL fKeyUp      = (msg->message == WM_KEYUP) ||
  • trunk/src/user32/oslibmsg.cpp

    r7205 r7211  
    1 /* $Id: oslibmsg.cpp,v 1.46 2001-10-25 15:35:53 phaller Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.47 2001-10-26 09:10:12 phaller Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    2121#define  INCL_DOSPROCESS
    2222#include <os2wrap.h>
     23#include <odinwrap.h>
    2324#include <string.h>
    2425#include <misc.h>
     
    3738#define DBG_LOCALLOG    DBG_oslibmsg
    3839#include "dbglocal.h"
     40
     41
     42ODINDEBUGCHANNEL(USER32-OSLIBMSG)
    3943
    4044
     
    116120void WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode)
    117121{
     122  dprintf(("WinToOS2MsgTranslate not implemented"));
    118123//  memcpy(os2Msg, winMsg, sizeof(MSG));
    119124//  os2Msg->hwnd = Win32ToOS2Handle(winMsg->hwnd);
     
    201206//******************************************************************************
    202207//******************************************************************************
    203 BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
     208BOOL i_OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
    204209                    BOOL isUnicode)
    205210{
     
    239244        teb->o.odin.os2msg.msg  = 0;
    240245        teb->o.odin.os2msg.hwnd = 0;
     246   
     247        // @@@PH verify this
     248        // if this is a keyup or keydown message, we've got to
     249        // call the keyboard hook here
     250        if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN)
     251        {
     252          ProcessKbdHook(pMsg, TRUE);
     253        }
     254   
    241255        return (pMsg->message != WINWM_QUIT);
    242256  }
     
    288302  if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN)
    289303  {
    290 //    if(ProcessKbdHookLL(pMsg, TRUE))
    291 //      goto continuegetmsg;
    292    
    293     // @@@PH
    294304    // only supposed to be called upon WM_KEYDOWN
    295305    // and WM_KEYUP according to docs.
     
    299309  return rc;
    300310}
     311BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
     312                    BOOL isUnicode)
     313{
     314  dprintf(("OSLibWinGetMsg enter"));
     315  BOOL fRes = i_OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, isUnicode);
     316  dprintf(("OSLibWinGetMsg leave"));
     317  return fRes;
     318}
     319
     320
    301321//******************************************************************************
    302322//PeekMessage retrieves only messages associated with the window identified by the
     
    311331//TODO: Not working as specified right now!
    312332//******************************************************************************
    313 BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
     333BOOL i_OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
    314334                     DWORD fRemove, BOOL isUnicode)
    315335{
     
    350370        }
    351371        memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG));
     372   
     373        // @@@PH verify this
     374        // if this is a keyup or keydown message, we've got to
     375        // call the keyboard hook here
     376        if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN)
     377        {
     378          ProcessKbdHook(pMsg, fRemove);
     379        }
    352380        return TRUE;
    353381  }
     
    393421  if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN)
    394422  {
    395 //    if(ProcessKbdHookLL(pMsg, fRemove))
    396 //      goto continuepeekmsg;
    397 
    398     // @@@PH
    399423    // only supposed to be called upon WM_KEYDOWN
    400424    // and WM_KEYUP according to docs.
     
    405429  return rc;
    406430}
     431BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
     432                    BOOL fRemove, BOOL isUnicode)
     433{
     434  dprintf(("OSLibWinPeekMsg enter"));
     435  BOOL fRes = i_OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, fRemove, isUnicode);
     436  dprintf(("OSLibWinPeekMsg leave"));
     437  return fRes;
     438}
     439
    407440//******************************************************************************
    408441//******************************************************************************
  • trunk/src/user32/oslibmsgtranslate.cpp

    r7205 r7211  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.68 2001-10-25 15:35:53 phaller Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.69 2001-10-26 09:10:12 phaller Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    166166
    167167
     168// Note:
     169// For a "lonekey"-press of AltGr, we only receive WM_KEYUP
     170// messages. If the key is pressed longer and starts to repeat,
     171// WM_KEYDOWN messages come in properly.
     172static BOOL fKeyAltGrDown = FALSE;
     173
    168174//******************************************************************************
    169175//******************************************************************************
     
    684690
    685691        dprintf(("PM: WM_CHAR: %x %x rep=%d scancode=%x", SHORT1FROMMP(os2Msg->mp2), SHORT2FROMMP(os2Msg->mp2), repeatCount, scanCode));
    686         dprintf(("PM: WM_CHAR: hwnd %x flags %x mp1 %x, mp2 %x", win32wnd->getWindowHandle(), flags, os2Msg->mp1, os2Msg->mp2));
     692        dprintf(("PM: WM_CHAR: hwnd %x flags %x mp1 %x, mp2 %x, time=%08xh", win32wnd->getWindowHandle(), flags, os2Msg->mp1, os2Msg->mp2, os2Msg->time));
    687693
    688694        // vitali add begin
     
    805811        // check if additional messages have to be recorded
    806812        // ------------------------------------------------
     813#if 0
    807814        {
    808815          MSG extramsg;
     
    813820          switch (scanCode)
    814821          {
    815             case PMSCAN_ESC:
    816             {
    817               // Note: ESC generates a WM_CHAR for WINWM_KEYDOWN
    818               // under Windows, not under PM
    819               // so we've got to post it to ourself here!
    820               // WM_CHAR(0x0000001bh, 00010001h)
    821               if (winMsg->message == WINWM_KEYDOWN)
    822               {
    823                 extramsg.message = WINWM_CHAR;
    824                 extramsg.wParam  = VK_ESCAPE_W;
    825                 extramsg.lParam  = winMsg->lParam;
    826                 setThreadQueueExtraCharMessage(teb, &extramsg);
    827               }
    828             }
    829             break;
    830            
    831 #if 0
    832822            case PMSCAN_PRINT:
    833823              // Note: PRINT generates a WM_KEYUP under Windows
     
    841831              setThreadQueueExtraCharMessage(teb, &extramsg);
    842832              break;
    843 #endif
    844833           
     834            #define WIN_KEY_EXTENDED   0x01000000
     835            #define WIN_KEY_DONTCARE   0x02000000
     836            #define WIN_KEY_ALTHELD    0x20000000
     837            #define WIN_KEY_PREVSTATE  0x40000000
    845838            case PMSCAN_ALTRIGHT:
    846839            {
    847840              // we need very special treatment here for the
    848841              // poor, crippled AltGr key
    849               if (keyWasPressed)
     842              // Note: see fKeyAltGrDown above!
     843             
     844              if ( (keyWasPressed) || (fKeyAltGrDown == FALSE) )
    850845              {
     846                fKeyAltGrDown = TRUE;
     847               
    851848                // 1 - generate a virtual LCONTROL-keypress
    852849                // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-AltGr!)
    853850                // 0xfe000000: mask out extended-key, scancode, repeatcount
     851                // Note: Win sends a WINWM_SYSKEYDOWN to the hooks,
     852                // the queue gets a WM_KEYDOWN only! (wrong impl. here)
    854853                extramsg.message = WINWM_KEYDOWN;
    855854                extramsg.wParam  = VK_RMENU_W;
    856855                extramsg.lParam  = (winMsg->lParam & 0xfe000000)
     856                                   | WIN_KEY_EXTENDED
     857                                   | (keyWasPressed ? WIN_KEY_PREVSTATE : 0)
     858                                   | WIN_KEY_ALTHELD
    857859                                   | repeatCount
    858                                    | (WINSCAN_ALTRIGHT << 24);
     860                                   | (WINSCAN_ALTRIGHT << 16);
    859861                winMsg->message  = WINWM_KEYDOWN;
    860862                winMsg->wParam   = VK_LCONTROL_W;
    861863                winMsg->lParam   = (winMsg->lParam & 0xfe000000)
     864                                   | WIN_KEY_DONTCARE
     865                                   | (keyWasPressed ? WIN_KEY_PREVSTATE : 0)
     866                                   | WIN_KEY_ALTHELD
    862867                                   | repeatCount
    863                                    | (WINSCAN_CTRLLEFT << 24);
     868                                   | (WINSCAN_CTRLLEFT << 16);
    864869              }
    865870              else
    866871              {
     872                // OK, now we can release it!
     873                fKeyAltGrDown = FALSE;
     874               
    867875                // key up
    868876                // 1 - generate a virtual LCONTROL-keypress
    869877                // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-Alt!)
    870                 extramsg.message = WINWM_KEYDOWN;
     878                extramsg.message = WINWM_KEYUP;
    871879                extramsg.wParam  = VK_RMENU_W;
    872880                extramsg.lParam  = (winMsg->lParam & 0xfe000000)
     881                                   | WIN_KEY_EXTENDED
    873882                                   | repeatCount
    874                                    | (WINSCAN_ALTRIGHT << 24);
     883                                   | (WINSCAN_ALTRIGHT << 16);
    875884                winMsg->message  = WINWM_SYSKEYUP;
    876885                winMsg->wParam   = VK_LCONTROL_W;
    877886                winMsg->lParam   = (winMsg->lParam & 0xfe000000)
     887                                   | WIN_KEY_ALTHELD
    878888                                   | repeatCount
    879                                    | (WINSCAN_CTRLLEFT << 24);
     889                                   | (WINSCAN_CTRLLEFT << 16);
    880890              }
    881891             
     892              // @@@PH
     893              // unknown: this leads to an infinite loop
     894              // because the OS/2 WM_CHAR_SPECIAL message is never
     895              // removed from the queue?!
    882896              setThreadQueueExtraCharMessage(teb, &extramsg);
    883             }
     897             
     898              if ( (keyWasPressed) || (fKeyAltGrDown == FALSE) )
     899              {
     900                fKeyAltGrDown = TRUE;
     901               
     902                // 1 - generate a virtual LCONTROL-keypress
     903                // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-AltGr!)
     904                // 0xfe000000: mask out extended-key, scancode, repeatcount
     905                // Note: Win sends a WINWM_SYSKEYDOWN to the hooks,
     906                // the queue gets a WM_KEYDOWN only! (wrong impl. here)
     907                winMsg->message = WINWM_KEYDOWN;
     908                winMsg->wParam  = VK_RMENU_W;
     909                winMsg->lParam  = (winMsg->lParam & 0xfe000000)
     910                                   | WIN_KEY_EXTENDED
     911                                   | (keyWasPressed ? WIN_KEY_PREVSTATE : 0)
     912                                   | WIN_KEY_ALTHELD
     913                                   | repeatCount
     914                                   | (WINSCAN_ALTRIGHT << 16);
     915              }
     916              else
     917              {
     918                // OK, now we can release it!
     919                fKeyAltGrDown = FALSE;
     920               
     921                // key up
     922                // 1 - generate a virtual LCONTROL-keypress
     923                // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-Alt!)
     924                winMsg->message = WINWM_KEYUP;
     925                winMsg->wParam  = VK_RMENU_W;
     926                winMsg->lParam  = (winMsg->lParam & 0xfe000000)
     927                                   | WIN_KEY_EXTENDED
     928                                   | repeatCount
     929                                   | (WINSCAN_ALTRIGHT << 16);
     930              }
     931            }
     932            break;
    884933          } /* switch */
    885934        }
    886      
     935#endif
    887936     
    888937        if (ISKDB_CAPTURED())
     
    10461095    //      the newly generated WM_CHAR message.
    10471096    if(!teb->o.odin.fTranslated && teb->o.odin.os2msg.msg == WM_CHAR && !((SHORT1FROMMP(teb->o.odin.os2msg.mp1) & KC_KEYUP) == KC_KEYUP))
    1048     {//TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message
    1049             ULONG fl = SHORT1FROMMP(teb->o.odin.os2msg.mp1);
    1050             MSG extramsg;
    1051 
    1052             memcpy(&extramsg, msg, sizeof(MSG));
    1053             extramsg.wParam = SHORT1FROMMP(teb->o.odin.os2msg.mp2);
    1054             extramsg.lParam = 0;
    1055 
    1056             if(!(fl & KC_CHAR) && msg->message < WINWM_SYSKEYDOWN) {
    1057                 return FALSE;
    1058             }
    1059 
    1060             if(fl & KC_VIRTUALKEY) {
    1061                 if(msg->wParam) {
    1062                     if ((msg->wParam >= VK_NUMPAD0_W) && (msg->wParam <= VK_NUMPAD9_W))
    1063                         extramsg.wParam = msg->wParam - 0x30;
    1064                     else
    1065                         extramsg.wParam = msg->wParam;
    1066                 }
    1067                 else    extramsg.wParam = SHORT2FROMMP(teb->o.odin.os2msg.mp2);
    1068             }
    1069 
    1070 
    1071             if(msg->message >= WINWM_SYSKEYDOWN) {
    1072                     extramsg.message = WINWM_SYSCHAR;
    1073             }
    1074             else    extramsg.message = WINWM_CHAR;
    1075 
    1076             if(fl & KC_DEADKEY) {
    1077                 extramsg.message++;  //WM_DEADCHAR/WM_SYSDEADCHAR
    1078             }
    1079 
    1080             extramsg.lParam = msg->lParam & 0x00FFFFFF;
    1081             if(fl & KC_ALT)
    1082                 extramsg.lParam |= (1<<29);
    1083             if(fl & KC_PREVDOWN)
    1084                 extramsg.lParam |= (1<<30);
    1085             if(fl & KC_KEYUP)
    1086                 extramsg.lParam |= (1<<31);
    1087      
    1088             // insert message into the queue
    1089             setThreadQueueExtraCharMessage(teb, &extramsg);
    1090             return TRUE;
     1097    {
     1098      //TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message
     1099      ULONG fl = SHORT1FROMMP(teb->o.odin.os2msg.mp1);
     1100      MSG extramsg;
     1101
     1102      memcpy(&extramsg, msg, sizeof(MSG));
     1103      extramsg.wParam = SHORT1FROMMP(teb->o.odin.os2msg.mp2);
     1104      extramsg.lParam = 0;
     1105
     1106      // ESCAPE generates a WM_CHAR under windows, so take
     1107      // special care for this here.
     1108      UCHAR ucPMScanCode = CHAR4FROMMP(teb->o.odin.os2msg.mp1);
     1109      switch (ucPMScanCode)
     1110      {
     1111        case PMSCAN_ESC:
     1112          extramsg.wParam  = VK_ESCAPE_W;
     1113          fl |= KC_CHAR;
     1114        break;
     1115      }
     1116
     1117      if(!(fl & KC_CHAR) && msg->message < WINWM_SYSKEYDOWN)
     1118      {
     1119        return FALSE;
     1120      }
     1121
     1122      if(fl & KC_VIRTUALKEY)
     1123      {
     1124        if(msg->wParam)
     1125        {
     1126          if ((msg->wParam >= VK_NUMPAD0_W) &&
     1127              (msg->wParam <= VK_NUMPAD9_W))
     1128            extramsg.wParam = msg->wParam - 0x30;
     1129          else
     1130            extramsg.wParam = msg->wParam;
     1131        }
     1132        else   
     1133          extramsg.wParam = SHORT2FROMMP(teb->o.odin.os2msg.mp2);
     1134      }
     1135
     1136
     1137      if(msg->message >= WINWM_SYSKEYDOWN)
     1138        extramsg.message = WINWM_SYSCHAR;
     1139      else   
     1140        extramsg.message = WINWM_CHAR;
     1141
     1142      if(fl & KC_DEADKEY)
     1143        extramsg.message++;  //WM_DEADCHAR/WM_SYSDEADCHAR
     1144
     1145
     1146      extramsg.lParam = msg->lParam & 0x00FFFFFF;
     1147      if(fl & KC_ALT)
     1148        extramsg.lParam |= (1<<29);
     1149      if(fl & KC_PREVDOWN)
     1150        extramsg.lParam |= (1<<30);
     1151      if(fl & KC_KEYUP)
     1152        extramsg.lParam |= (1<<31);
     1153
     1154      // insert message into the queue
     1155      setThreadQueueExtraCharMessage(teb, &extramsg);
     1156      return TRUE;
    10911157    }
    10921158    return FALSE;
  • trunk/src/user32/pmwindow.cpp

    r7200 r7211  
    1 /* $Id: pmwindow.cpp,v 1.158 2001-10-25 10:40:45 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.159 2001-10-26 09:10:12 phaller Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    4545#include "options.h"
    4646#include "menu.h"
     47#include <pmkbdhk.h>
    4748
    4849#define DBG_LOCALLOG    DBG_pmwindow
     
    502503        win32wnd->DispatchMsgA(pWinMsg);
    503504        break;
    504 
     505     
     506    case WM_CHAR_SPECIAL:
     507      /* NO BREAK! FALLTHRU CASE! */
     508     
    505509    case WM_CHAR:
    506510        dprintf(("OS2: WM_CHAR %x %x %x, %x %x", win32wnd->getWindowHandle(), mp1, mp2, pWinMsg->wParam, pWinMsg->lParam));
Note: See TracChangeset for help on using the changeset viewer.