Ignore:
Timestamp:
Oct 26, 2001, 2:46:17 PM (24 years ago)
Author:
phaller
Message:

AltGr fix

File:
1 edited

Legend:

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

    r7212 r7216  
    1 /* $Id: HOOK.CPP,v 1.31 2001-10-26 10:03:33 phaller Exp $ */
     1/* $Id: HOOK.CPP,v 1.32 2001-10-26 12:46:16 phaller Exp $ */
    22
    33/*
     
    4545#include <wprocess.h>
    4646#include "menu.h"
     47#include <winscan.h>
    4748
    4849#include "win32wbase.h"
     
    825826 
    826827    // this undoc (don't care) bit isn't passed through to this hook
    827     DWORD lParam = msg->lParam & ~0x02000000;
     828    // DWORD lParam = msg->lParam & ~0x02000000;
     829    msg->lParam &= ~0x02000000;
    828830 
    829831    return (HOOK_CallHooksA( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE,
    830                              LOWORD (msg->wParam), lParam )
     832                             LOWORD (msg->wParam), msg->lParam )
    831833                             ? TRUE : FALSE);
    832834}
     
    843845BOOL ProcessKbdHookLL(LPMSG msg, BOOL flagRemove, BOOL flagInjected )
    844846{
    845   // @@@PH
    846847  // format KBDLLHOOKSTRUCT and pass it in as msg->lParam
    847848  KBDLLHOOKSTRUCT kbhs;
    848849 
     850  kbhs.vkCode      = msg->wParam;
     851 
     852  // Note: the "extended" bit seems to be filtered
     853  kbhs.scanCode    = ( (msg->lParam & 0x02ff0000) >> 16);
     854 
     855  BOOL fKeyUp      = (msg->message == WM_KEYUP) ||
     856                     (msg->message == WM_SYSKEYUP);
     857 
    849858  // check if alt is currently pressed
    850859  // Note: ALT seems to stick sometimes
    851   // BOOL fAltDown = GetKeyState(VK_LMENU);
    852   BOOL fAltDown = GetAsyncKeyState(VK_LMENU);
    853  
    854   kbhs.vkCode      = msg->wParam;
    855   kbhs.scanCode    = ( (msg->lParam & 0x03ff0000) >> 16);
    856  
    857   BOOL fKeyUp      = (msg->message == WM_KEYUP) ||
    858                      (msg->message == WM_SYSKEYUP);
     860  // Note: ALTGR can't be queried
     861  BOOL fAltDown; // = GetAsyncKeyState(VK_LMENU);
     862 
     863  // this bit indicates if ALT was held
     864  fAltDown = msg->lParam & 0x20000000;
     865 
    859866  kbhs.flags       = fKeyUp ? LLKHF_UP : 0;
    860867 
    861   // @@@PH seems not to work properly
    862868  kbhs.flags      |= fAltDown ? LLKHF_ALTDOWN : 0;
    863869  kbhs.flags      |= flagInjected ? LLKHF_INJECTED : 0;
    864870  kbhs.flags      |= (msg->lParam & (1 << 24)) ? LLKHF_EXTENDED : 0;
    865  
    866 /*
    867   kbhs.flags       = ( (msg->lParam & (1 << 24)) ? LLKHF_EXTENDED : 0 ) |
    868                      ( flagInjected ? LLKHF_INJECTED : 0) |
    869                      fAltDown ? LLKHF_ALTDOWN : 0 |
    870                      ( (msg->lParam & (1 << 31)) ? LLKHF_UP : 0);
    871                      */
    872871  kbhs.time        = msg->time;
    873872  kbhs.dwExtraInfo = 0; // @@@PH not supported?
Note: See TracChangeset for help on using the changeset viewer.