1 |
/* |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
User interface services - X Window System |
User interface services - X Window System |
4 |
Copyright (C) Matthew Chapman 1999-2001 |
Copyright (C) Matthew Chapman 1999-2002 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
184 |
} |
} |
185 |
|
|
186 |
BOOL |
BOOL |
187 |
get_key_state(uint32 keysym, unsigned int state) |
get_key_state(unsigned int state, uint32 keysym) |
188 |
{ |
{ |
189 |
int modifierpos, key, keysymMask = 0; |
int modifierpos, key, keysymMask = 0; |
190 |
int offset; |
int offset; |
218 |
display = XOpenDisplay(NULL); |
display = XOpenDisplay(NULL); |
219 |
if (display == NULL) |
if (display == NULL) |
220 |
{ |
{ |
221 |
error("Failed to open display\n"); |
error("Failed to open display: %s\n", XDisplayName(NULL)); |
222 |
return False; |
return False; |
223 |
} |
} |
224 |
|
|
293 |
if (IM != NULL) |
if (IM != NULL) |
294 |
XCloseIM(IM); |
XCloseIM(IM); |
295 |
|
|
296 |
XFreeModifierMap(mod_map); |
XFreeModifiermap(mod_map); |
297 |
|
|
298 |
if (ownbackstore) |
if (ownbackstore) |
299 |
XFreePixmap(display, backstore); |
XFreePixmap(display, backstore); |
345 |
} |
} |
346 |
|
|
347 |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
348 |
StructureNotifyMask | FocusChangeMask; |
VisibilityChangeMask | FocusChangeMask; |
349 |
|
|
350 |
if (sendmotion) |
if (sendmotion) |
351 |
input_mask |= PointerMotionMask; |
input_mask |= PointerMotionMask; |
352 |
if (ownbackstore) |
if (ownbackstore) |
353 |
input_mask |= ExposureMask; |
input_mask |= ExposureMask; |
354 |
|
if (fullscreen) |
355 |
|
input_mask |= EnterWindowMask; |
356 |
|
|
357 |
if (IM != NULL) |
if (IM != NULL) |
358 |
{ |
{ |
367 |
XSelectInput(display, wnd, input_mask); |
XSelectInput(display, wnd, input_mask); |
368 |
XMapWindow(display, wnd); |
XMapWindow(display, wnd); |
369 |
|
|
370 |
/* wait for MapNotify */ |
/* wait for VisibilityNotify */ |
371 |
do |
do |
372 |
{ |
{ |
373 |
XMaskEvent(display, StructureNotifyMask, &xevent); |
XMaskEvent(display, VisibilityChangeMask, &xevent); |
374 |
} |
} |
375 |
while (xevent.type != MapNotify); |
while (xevent.type != VisibilityNotify); |
|
|
|
|
if (fullscreen) |
|
|
XSetInputFocus(display, wnd, RevertToPointerRoot, CurrentTime); |
|
376 |
|
|
377 |
return True; |
return True; |
378 |
} |
} |
530 |
XUngrabKeyboard(display, CurrentTime); |
XUngrabKeyboard(display, CurrentTime); |
531 |
break; |
break; |
532 |
|
|
533 |
|
case EnterNotify: |
534 |
|
/* we only register for this event when in fullscreen mode */ |
535 |
|
XSetInputFocus(display, wnd, RevertToPointerRoot, CurrentTime); |
536 |
|
break; |
537 |
|
|
538 |
case Expose: |
case Expose: |
539 |
XCopyArea(display, backstore, wnd, gc, |
XCopyArea(display, backstore, wnd, gc, |
540 |
xevent.xexpose.x, xevent.xexpose.y, |
xevent.xexpose.x, xevent.xexpose.y, |
552 |
|
|
553 |
if (xevent.xmapping.request == MappingModifier) |
if (xevent.xmapping.request == MappingModifier) |
554 |
{ |
{ |
555 |
XFreeModifierMap(mod_map); |
XFreeModifiermap(mod_map); |
556 |
mod_map = XGetModifierMapping(display); |
mod_map = XGetModifierMapping(display); |
557 |
} |
} |
558 |
break; |
break; |