winex11drv: Remove special treatment for caps-lock and num-lock keys. [try-2]
Alexandre Julliard
julliard at winehq.org
Mon Feb 25 13:08:29 CST 2008
Vitaliy Margolen <wine-patches at kievinfo.com> writes:
> - if (vkey)
> - {
> - switch (vkey & 0xff)
> + if (!vkey) return;
> +
> + /* Adjust the NUMLOCK state if it has been changed outside wine */
> + if (!(key_state_table[VK_NUMLOCK] & 0x01) != !(event->state & NumLockMask))
> {
> - case VK_NUMLOCK:
> - KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, event->type, event_time );
> - break;
> - case VK_CAPITAL:
> - TRACE("Caps Lock event. (type %d). State before : %#.2x\n",event->type,key_state_table[vkey]);
> - KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, event->type, event_time );
> - TRACE("State after : %#.2x\n",key_state_table[vkey]);
> - break;
> - default:
> - /* Adjust the NUMLOCK state if it has been changed outside wine */
> - if (!(key_state_table[VK_NUMLOCK] & 0x01) != !(event->state & NumLockMask))
> - {
> - TRACE("Adjusting NumLock state.\n");
> - KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, KeyPress, event_time );
> - KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, KeyRelease, event_time );
> - }
> - /* Adjust the CAPSLOCK state if it has been changed outside wine */
> - if (!(key_state_table[VK_CAPITAL] & 0x01) != !(event->state & LockMask))
> - {
> - TRACE("Adjusting Caps Lock state.\n");
> - KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, KeyPress, event_time );
> - KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, KeyRelease, event_time );
> - }
> - /* Not Num nor Caps : end of intermediary states for both. */
> - NumState = FALSE;
> - CapsState = FALSE;
> + TRACE("Adjusting NumLock state (%#.2x).\n", key_state_table[VK_NUMLOCK]);
> + X11DRV_send_keyboard_input( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY, event_time, 0, 0 );
> + X11DRV_send_keyboard_input( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, event_time, 0, 0 );
> + }
> + /* Adjust the CAPSLOCK state if it has been changed outside wine */
> + if (!(key_state_table[VK_CAPITAL] & 0x01) != !(event->state & LockMask))
> + {
> + TRACE("Adjusting Caps Lock state (%#.2x).\n", key_state_table[VK_CAPITAL]);
> + X11DRV_send_keyboard_input( VK_CAPITAL, 0x3A, 0, event_time, 0, 0 );
> + X11DRV_send_keyboard_input( VK_CAPITAL, 0x3A, KEYEVENTF_KEYUP, event_time, 0, 0 );
> + }
You still need to handle the case of caps lock or num lock keys
differently, otherwise you'll generate duplicate messages.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list