When modifiers are used and a key is released, the generated keysym
might be different from the one generated when the key was pressed. This can happen if the user physically releases the modifier key before the symbol key. It can also happen with VNC servers such as Xvnc, since it only "fakes" the correct modifiers during key presses. So, we must remember which keysym that was used during the key press, and use the same on release, otherwise keys such as the Windows key can be stuck activated. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1512 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
ecd9eeeaa6
commit
bbeb187681
@ -260,3 +260,16 @@ works:
|
||||
* Release F1
|
||||
|
||||
Verify that shift is not stuck down, by clicking on the text.
|
||||
|
||||
14. Use a keyboard layout where Meta_L can be generated with Shift_R +
|
||||
Alt_L. Then:
|
||||
|
||||
* Start Notepad
|
||||
* Press Shift_R
|
||||
* Press Alt_L
|
||||
* Release Shift_R
|
||||
* Release Alt_L
|
||||
* Press "e"
|
||||
|
||||
Verify that you get an "e" in Notepad, rather than start Windows
|
||||
Explorer.
|
||||
|
32
xkeymap.c
32
xkeymap.c
@ -31,6 +31,7 @@
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "rdesktop.h"
|
||||
#include "scancodes.h"
|
||||
|
||||
@ -52,6 +53,7 @@ extern RD_BOOL g_numlock_sync;
|
||||
|
||||
static RD_BOOL keymap_loaded;
|
||||
static key_translation *keymap[KEYMAP_SIZE];
|
||||
static KeySym keypress_keysyms[256];
|
||||
static int min_keycode;
|
||||
static uint16 remote_modifier_state = 0;
|
||||
static uint16 saved_remote_modifier_state = 0;
|
||||
@ -503,6 +505,36 @@ reset_winkey(uint32 ev_time)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
set_keypress_keysym(unsigned int keycode, KeySym keysym)
|
||||
{
|
||||
if (keycode < 8 || keycode > 255)
|
||||
return;
|
||||
keypress_keysyms[keycode] = keysym;
|
||||
}
|
||||
|
||||
|
||||
KeySym
|
||||
reset_keypress_keysym(unsigned int keycode, KeySym keysym)
|
||||
{
|
||||
KeySym ks;
|
||||
if (keycode < 8 || keycode > 255)
|
||||
return keysym;
|
||||
ks = keypress_keysyms[keycode];
|
||||
if (ks != 0)
|
||||
{
|
||||
keypress_keysyms[keycode] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ks = keysym;
|
||||
}
|
||||
|
||||
return ks;
|
||||
}
|
||||
|
||||
|
||||
/* Handle special key combinations */
|
||||
RD_BOOL
|
||||
handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL pressed)
|
||||
|
2
xwin.c
2
xwin.c
@ -2341,6 +2341,7 @@ xwin_process_events(void)
|
||||
DEBUG_KBD(("KeyPress for keysym (0x%lx, %s)\n", keysym,
|
||||
get_ksname(keysym)));
|
||||
|
||||
set_keypress_keysym(xevent.xkey.keycode, keysym);
|
||||
ev_time = time(NULL);
|
||||
if (handle_special_keys(keysym, xevent.xkey.state, ev_time, True))
|
||||
break;
|
||||
@ -2357,6 +2358,7 @@ xwin_process_events(void)
|
||||
DEBUG_KBD(("\nKeyRelease for keysym (0x%lx, %s)\n", keysym,
|
||||
get_ksname(keysym)));
|
||||
|
||||
keysym = reset_keypress_keysym(xevent.xkey.keycode, keysym);
|
||||
ev_time = time(NULL);
|
||||
if (handle_special_keys(keysym, xevent.xkey.state, ev_time, False))
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user