Applied patch from Bob Bell for -K option
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@75 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
e263b82202
commit
f1e223725f
@ -43,6 +43,7 @@ BOOL licence = True;
|
||||
BOOL encryption = True;
|
||||
BOOL desktop_save = True;
|
||||
BOOL fullscreen = False;
|
||||
BOOL grab_keyboard = True;
|
||||
|
||||
/* Display usage information */
|
||||
static void
|
||||
@ -63,6 +64,7 @@ usage(char *program)
|
||||
printf(" -m: do not send motion events\n");
|
||||
printf(" -l: do not request licence\n");
|
||||
printf(" -t: rdp tcp port\n\n");
|
||||
printf(" -K: keep window manager key bindings\n");
|
||||
}
|
||||
|
||||
/* Client program */
|
||||
@ -89,7 +91,7 @@ main(int argc, char *argv[])
|
||||
domain[0] = password[0] = shell[0] = directory[0] = 0;
|
||||
strcpy(keymapname, "us");
|
||||
|
||||
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:t:fbemlh?")) != -1)
|
||||
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:t:fbemlKh?")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@ -159,6 +161,10 @@ main(int argc, char *argv[])
|
||||
tcp_port_rdp = strtol(optarg, NULL, 10);
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
grab_keyboard = False;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
case '?':
|
||||
default:
|
||||
|
19
xwin.c
19
xwin.c
@ -25,11 +25,13 @@
|
||||
#define XK_MISCELLANY
|
||||
#include <X11/keysymdef.h>
|
||||
#include "rdesktop.h"
|
||||
#include "scancodes.h"
|
||||
|
||||
extern int width;
|
||||
extern int height;
|
||||
extern BOOL sendmotion;
|
||||
extern BOOL fullscreen;
|
||||
extern BOOL grab_keyboard;
|
||||
|
||||
Display *display = NULL;
|
||||
static int x_socket;
|
||||
@ -347,7 +349,9 @@ ui_create_window(char *title)
|
||||
|
||||
input_mask =
|
||||
KeyPressMask | KeyReleaseMask | ButtonPressMask |
|
||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask;
|
||||
ButtonReleaseMask;
|
||||
if (grab_keyboard)
|
||||
input_mask |= EnterWindowMask | LeaveWindowMask;
|
||||
if (sendmotion)
|
||||
input_mask |= PointerMotionMask;
|
||||
|
||||
@ -518,13 +522,26 @@ xwin_process_events()
|
||||
xevent.xmotion.y);
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
/* fall through */
|
||||
case EnterNotify:
|
||||
if (grab_keyboard)
|
||||
XGrabKeyboard(display, wnd, True,
|
||||
GrabModeAsync, GrabModeAsync,
|
||||
CurrentTime);
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
/* reset keys */
|
||||
rdp_send_input(ev_time, RDP_INPUT_SCANCODE,
|
||||
KBD_FLAG_DOWN | KBD_FLAG_UP,
|
||||
SCANCODE_CHAR_LCTRL, 0);
|
||||
rdp_send_input(ev_time, RDP_INPUT_SCANCODE,
|
||||
KBD_FLAG_DOWN | KBD_FLAG_UP,
|
||||
SCANCODE_CHAR_LALT, 0);
|
||||
/* fall through */
|
||||
case LeaveNotify:
|
||||
if (grab_keyboard)
|
||||
XUngrabKeyboard(display, CurrentTime);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user