Changeset 4498 for trunk/src


Ignore:
Timestamp:
Oct 18, 2000, 10:12:46 PM (25 years ago)
Author:
sandervl
Message:

ToAscii implemenation started

Location:
trunk/src/user32
Files:
2 edited

Legend:

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

    r3942 r4498  
    1 /* $Id: user32.cpp,v 1.84 2000-08-02 20:18:24 bird Exp $ */
     1/* $Id: user32.cpp,v 1.85 2000-10-18 20:12:45 sandervl Exp $ */
    22
    33/*
     
    14331433}
    14341434/*****************************************************************************
    1435  * Name      : int WIN32API ToAscii
    1436  * Purpose   : The ToAscii function translates the specified virtual-key code
    1437  *             and keyboard state to the corresponding Windows character or characters.
    1438  * Parameters: UINT   uVirtKey    virtual-key code
    1439  *             UINT   uScanCode   scan code
    1440  *             PBYTE  lpbKeyState address of key-state array
    1441  *             LPWORD lpwTransKey buffer for translated key
    1442  *             UINT   fuState     active-menu flag
    1443  * Variables :
    1444  * Result    : 0 The specified virtual key has no translation for the current
    1445  *               state of the keyboard.
    1446  *             1 One Windows character was copied to the buffer.
    1447  *             2 Two characters were copied to the buffer. This usually happens
    1448  *               when a dead-key character (accent or diacritic) stored in the
    1449  *               keyboard layout cannot be composed with the specified virtual
    1450  *               key to form a single character.
    1451  * Remark    :
    1452  * Status    : UNTESTED STUB
    1453  *
    1454  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
    1455  *****************************************************************************/
    1456 int WIN32API ToAscii(UINT   uVirtKey,
    1457                         UINT   uScanCode,
    1458                         PBYTE  lpbKeyState,
    1459                         LPWORD lpwTransKey,
    1460                         UINT   fuState)
    1461 {
    1462   dprintf(("USER32:ToAscii (%u,%u,%08xh,%08xh,%u) not implemented.\n",
    1463          uVirtKey,
    1464          uScanCode,
    1465          lpbKeyState,
    1466          lpwTransKey,
    1467          fuState));
    1468 
    1469   return (0);
    1470 }
    1471 /*****************************************************************************
    1472  * Name      : int WIN32API ToAsciiEx
    1473  * Purpose   : The ToAscii function translates the specified virtual-key code
    1474  *             and keyboard state to the corresponding Windows character or characters.
    1475  * Parameters: UINT   uVirtKey    virtual-key code
    1476  *             UINT   uScanCode   scan code
    1477  *             PBYTE  lpbKeyState address of key-state array
    1478  *             LPWORD lpwTransKey buffer for translated key
    1479  *             UINT   fuState     active-menu flag
    1480  *             HLK    hlk         keyboard layout handle
    1481  * Variables :
    1482  * Result    : 0 The specified virtual key has no translation for the current
    1483  *               state of the keyboard.
    1484  *             1 One Windows character was copied to the buffer.
    1485  *             2 Two characters were copied to the buffer. This usually happens
    1486  *               when a dead-key character (accent or diacritic) stored in the
    1487  *               keyboard layout cannot be composed with the specified virtual
    1488  *               key to form a single character.
    1489  * Remark    :
    1490  * Status    : UNTESTED STUB
    1491  *
    1492  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
    1493  *****************************************************************************/
    1494 int WIN32API ToAsciiEx(UINT   uVirtKey,
    1495                           UINT   uScanCode,
    1496                           PBYTE  lpbKeyState,
    1497                           LPWORD lpwTransKey,
    1498                           UINT   fuState,
    1499                           HKL    hkl)
    1500 {
    1501   dprintf(("USER32:ToAsciiEx (%u,%u,%08xh,%08xh,%u,%08x) not implemented.\n",
    1502          uVirtKey,
    1503          uScanCode,
    1504          lpbKeyState,
    1505          lpwTransKey,
    1506          fuState,
    1507          hkl));
    1508 
    1509   return (0);
    1510 }
    1511 /*****************************************************************************
    15121435 * Name      : int WIN32API ToUnicode
    15131436 * Purpose   : The ToUnicode function translates the specified virtual-key code
  • trunk/src/user32/winkeyboard.cpp

    r2803 r4498  
    1 /* $Id: winkeyboard.cpp,v 1.5 2000-02-16 14:28:27 sandervl Exp $ */
     1/* $Id: winkeyboard.cpp,v 1.6 2000-10-18 20:12:46 sandervl Exp $ */
    22/*
    33 * Win32 <-> PM key translation
     
    301301 BOOL   rc;
    302302
    303   dprintf(("USER32:  GetKeyboardState"));
     303  dprintf(("USER32: GetKeyboardState %x", lpKeyState));
    304304  rc = OSLibWinGetKeyboardStateTable((PBYTE)&PMKeyState );
    305305
     
    315315BOOL WIN32API SetKeyboardState(PBYTE lpKeyState)
    316316{
    317   dprintf(("USER32:  SetKeyboardState, not implemented"));
     317  dprintf(("USER32: SetKeyboardState %x not implemented", lpKeyState));
    318318  return(TRUE);
    319319}
     
    399399        return 1;
    400400}
    401 
    402 //******************************************************************************
    403 //******************************************************************************
     401/*****************************************************************************
     402 * Name      : int WIN32API ToAscii
     403 * Purpose   : The ToAscii function translates the specified virtual-key code
     404 *             and keyboard state to the corresponding Windows character or characters.
     405 * Parameters: UINT   uVirtKey    virtual-key code
     406 *             UINT   uScanCode   scan code
     407 *             PBYTE  lpbKeyState address of key-state array
     408 *             LPWORD lpwTransKey buffer for translated key
     409 *             UINT   fuState     active-menu flag
     410 * Variables :
     411 * Result    : 0 The specified virtual key has no translation for the current
     412 *               state of the keyboard.
     413 *             1 One Windows character was copied to the buffer.
     414 *             2 Two characters were copied to the buffer. This usually happens
     415 *               when a dead-key character (accent or diacritic) stored in the
     416 *               keyboard layout cannot be composed with the specified virtual
     417 *               key to form a single character.
     418 * Remark    :
     419 * Status    : UNTESTED STUB
     420 *
     421 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
     422 *****************************************************************************/
     423int WIN32API ToAscii(UINT   uVirtKey,
     424                     UINT   uScanCode,
     425                     PBYTE  lpbKeyState,
     426                     LPWORD lpwTransKey,
     427                     UINT   fuState)
     428{
     429  dprintf(("USER32:ToAscii (%u,%u,%08xh,%08xh,%u) not implemented.\n",
     430         uVirtKey,
     431         uScanCode,
     432         lpbKeyState,
     433         lpwTransKey,
     434         fuState));
     435
     436  INT ret;
     437
     438  if (uScanCode == 0) {
     439        /* This happens when doing Alt+letter : a fake 'down arrow' key press
     440           event is generated by windows. Just ignore it. */
     441        dprintf2(("scanCode=0, doing nothing"));
     442        return 0;
     443  }
     444  if (uScanCode & 0x8000)
     445  {
     446        dprintf2(("Key UP, doing nothing"));
     447        return 0;
     448  }
     449  /* We have a special case to handle : Shift + arrow, shift + home, ...
     450     X returns a char for it, but Windows doesn't. Let's eat it. */
     451  if(!(lpbKeyState[VK_NUMLOCK] & 0x01)  /* NumLock is off */
     452       && (lpbKeyState[VK_SHIFT] & 0x80) /* Shift is pressed */
     453       && (uVirtKey >= VK_0) && (uVirtKey >= VK_9))
     454  {
     455        *(char*)lpwTransKey = 0;
     456        ret = 0;
     457  }
     458  else       
     459  /* We have another special case for delete key (XK_Delete) on an
     460     extended keyboard. X returns a char for it, but Windows doesn't */
     461  if (uVirtKey == VK_DELETE)
     462  {
     463       *(char*)lpwTransKey = 0;
     464       ret = 0;
     465  }
     466  else {
     467       *(char*)lpwTransKey = uVirtKey;
     468       ret = 1;
     469  }
     470  return ret;
     471}
     472/*****************************************************************************
     473 * Name      : int WIN32API ToAsciiEx
     474 * Purpose   : The ToAscii function translates the specified virtual-key code
     475 *             and keyboard state to the corresponding Windows character or characters.
     476 * Parameters: UINT   uVirtKey    virtual-key code
     477 *             UINT   uScanCode   scan code
     478 *             PBYTE  lpbKeyState address of key-state array
     479 *             LPWORD lpwTransKey buffer for translated key
     480 *             UINT   fuState     active-menu flag
     481 *             HLK    hlk         keyboard layout handle
     482 * Variables :
     483 * Result    : 0 The specified virtual key has no translation for the current
     484 *               state of the keyboard.
     485 *             1 One Windows character was copied to the buffer.
     486 *             2 Two characters were copied to the buffer. This usually happens
     487 *               when a dead-key character (accent or diacritic) stored in the
     488 *               keyboard layout cannot be composed with the specified virtual
     489 *               key to form a single character.
     490 * Remark    :
     491 * Status    : UNTESTED STUB
     492 *
     493 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
     494 *****************************************************************************/
     495int WIN32API ToAsciiEx(UINT   uVirtKey,
     496                       UINT   uScanCode,
     497                       PBYTE  lpbKeyState,
     498                       LPWORD lpwTransKey,
     499                       UINT   fuState,
     500                       HKL    hkl)
     501{
     502  dprintf(("USER32:ToAsciiEx (%u,%u,%08xh,%08xh,%u,%08x) not implemented.\n",
     503         uVirtKey,
     504         uScanCode,
     505         lpbKeyState,
     506         lpwTransKey,
     507         fuState,
     508         hkl));
     509
     510  return (0);
     511}
     512//******************************************************************************
     513//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.