35 |
#define KEYMAP_MASK 0xffff |
#define KEYMAP_MASK 0xffff |
36 |
#define KEYMAP_MAX_LINE_LENGTH 80 |
#define KEYMAP_MAX_LINE_LENGTH 80 |
37 |
|
|
38 |
extern Display *display; |
extern Display *g_display; |
39 |
extern char keymapname[16]; |
extern char keymapname[16]; |
40 |
extern int keylayout; |
extern int keylayout; |
41 |
extern int win_button_size; |
extern int g_win_button_size; |
42 |
extern BOOL g_enable_compose; |
extern BOOL g_enable_compose; |
43 |
|
extern BOOL g_use_rdp5; |
44 |
|
|
45 |
static BOOL keymap_loaded; |
static BOOL keymap_loaded; |
46 |
static key_translation keymap[KEYMAP_SIZE]; |
static key_translation keymap[KEYMAP_SIZE]; |
237 |
keymap_loaded = True; |
keymap_loaded = True; |
238 |
} |
} |
239 |
|
|
240 |
XDisplayKeycodes(display, &min_keycode, (int *) &max_keycode); |
XDisplayKeycodes(g_display, &min_keycode, (int *) &max_keycode); |
241 |
|
} |
242 |
|
|
243 |
|
static void |
244 |
|
send_winkey(uint32 ev_time, BOOL pressed, BOOL leftkey) |
245 |
|
{ |
246 |
|
uint8 winkey; |
247 |
|
|
248 |
|
if (leftkey) |
249 |
|
winkey = SCANCODE_CHAR_LWIN; |
250 |
|
else |
251 |
|
winkey = SCANCODE_CHAR_RWIN; |
252 |
|
|
253 |
|
if (pressed) |
254 |
|
{ |
255 |
|
if (g_use_rdp5) |
256 |
|
{ |
257 |
|
rdp_send_scancode(ev_time, RDP_KEYPRESS, winkey); |
258 |
|
} |
259 |
|
else |
260 |
|
{ |
261 |
|
/* RDP4 doesn't support winkey. Fake with Ctrl-Esc */ |
262 |
|
rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_LCTRL); |
263 |
|
rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_ESC); |
264 |
|
} |
265 |
|
} |
266 |
|
else |
267 |
|
{ |
268 |
|
/* key released */ |
269 |
|
if (g_use_rdp5) |
270 |
|
{ |
271 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, winkey); |
272 |
|
} |
273 |
|
else |
274 |
|
{ |
275 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_ESC); |
276 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LCTRL); |
277 |
|
} |
278 |
|
} |
279 |
} |
} |
280 |
|
|
281 |
/* Handles, for example, multi-scancode keypresses (which is not |
/* Handles, for example, multi-scancode keypresses (which is not |
338 |
case XK_Meta_L: /* Windows keys */ |
case XK_Meta_L: /* Windows keys */ |
339 |
case XK_Super_L: |
case XK_Super_L: |
340 |
case XK_Hyper_L: |
case XK_Hyper_L: |
341 |
|
send_winkey(ev_time, pressed, True); |
342 |
|
return True; |
343 |
|
|
344 |
case XK_Meta_R: |
case XK_Meta_R: |
345 |
case XK_Super_R: |
case XK_Super_R: |
346 |
case XK_Hyper_R: |
case XK_Hyper_R: |
347 |
if (pressed) |
send_winkey(ev_time, pressed, False); |
|
{ |
|
|
rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_LCTRL); |
|
|
rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_ESC); |
|
|
} |
|
|
else |
|
|
{ |
|
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_ESC); |
|
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LCTRL); |
|
|
} |
|
348 |
return True; |
return True; |
349 |
|
|
350 |
case XK_space: |
case XK_space: |
351 |
/* Prevent access to the Windows system menu in single app mode */ |
/* Prevent access to the Windows system menu in single app mode */ |
352 |
if (win_button_size |
if (g_win_button_size |
353 |
&& (get_key_state(state, XK_Alt_L) || get_key_state(state, XK_Alt_R))) |
&& (get_key_state(state, XK_Alt_L) || get_key_state(state, XK_Alt_R))) |
354 |
return True; |
return True; |
355 |
|
|