Alt modifier for fullscreen toggle

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@101 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2002-08-26 17:14:04 +00:00
parent f56b13e3ae
commit 32d5382f9d
2 changed files with 46 additions and 5 deletions

View File

@ -80,8 +80,11 @@ void ensure_remote_modifiers(uint32 ev_time, key_translation tr);
void rdp_send_scancode(uint32 time, uint16 flags, uint16 scancode); void rdp_send_scancode(uint32 time, uint16 flags, uint16 scancode);
/* xwin.c */ /* xwin.c */
BOOL ui_init(void); BOOL ui_init(void);
BOOL ui_create_window(); void ui_create_window_obj(int xpos, int ypos, int width, int height, int valuemask);
BOOL ui_create_window(void);
void ui_destroy_window(void); void ui_destroy_window(void);
void reset_keys(void);
void toggle_fullscreen(void);
void ui_select(int rdp_socket); void ui_select(int rdp_socket);
void ui_move_pointer(int x, int y); void ui_move_pointer(int x, int y);
HBITMAP ui_create_bitmap(int width, int height, uint8 * data); HBITMAP ui_create_bitmap(int width, int height, uint8 * data);

42
xwin.c
View File

@ -247,6 +247,41 @@ close_inputmethod(void)
} }
} }
static BOOL
get_key_state(int keysym)
{
int keysymMask = 0, modifierpos, key;
Window wDummy1, wDummy2;
int iDummy3, iDummy4, iDummy5, iDummy6;
unsigned int current_state;
int offset;
XModifierKeymap *map = XGetModifierMapping(display);
KeyCode keycode = XKeysymToKeycode(display, keysym);
if (keycode == NoSymbol)
return False;
for (modifierpos = 0; modifierpos < 8; modifierpos++)
{
offset = map->max_keypermod * modifierpos;
for (key = 0; key < map->max_keypermod; key++)
{
if (map->modifiermap[offset + key] == keycode)
keysymMask = 1 << modifierpos;
}
}
XQueryPointer(display, DefaultRootWindow(display), &wDummy1,
&wDummy2, &iDummy3, &iDummy4, &iDummy5, &iDummy6, &current_state);
XFreeModifiermap(map);
return (current_state & keysymMask) ? True : False;
}
BOOL BOOL
ui_init() ui_init()
{ {
@ -266,7 +301,7 @@ ui_init()
return True; return True;
} }
BOOL void
ui_create_window_obj(int xpos, int ypos, int width, int height, int valuemask) ui_create_window_obj(int xpos, int ypos, int width, int height, int valuemask)
{ {
XClassHint *classhints; XClassHint *classhints;
@ -542,12 +577,15 @@ xwin_process_events()
str, sizeof(str), &keysym, NULL); str, sizeof(str), &keysym, NULL);
} }
/* FIXME needs alt modifier */
if (keysym == XK_Break) /* toggle full screen */ if (keysym == XK_Break) /* toggle full screen */
{
if (get_key_state(XK_Alt_L) || get_key_state(XK_Alt_R))
{ {
toggle_fullscreen(); toggle_fullscreen();
break; break;
} }
}
ksname = get_ksname(keysym); ksname = get_ksname(keysym);
DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname)); DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname));