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 encryption = True;
|
||||||
BOOL desktop_save = True;
|
BOOL desktop_save = True;
|
||||||
BOOL fullscreen = False;
|
BOOL fullscreen = False;
|
||||||
|
BOOL grab_keyboard = True;
|
||||||
|
|
||||||
/* Display usage information */
|
/* Display usage information */
|
||||||
static void
|
static void
|
||||||
@ -63,6 +64,7 @@ usage(char *program)
|
|||||||
printf(" -m: do not send motion events\n");
|
printf(" -m: do not send motion events\n");
|
||||||
printf(" -l: do not request licence\n");
|
printf(" -l: do not request licence\n");
|
||||||
printf(" -t: rdp tcp port\n\n");
|
printf(" -t: rdp tcp port\n\n");
|
||||||
|
printf(" -K: keep window manager key bindings\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Client program */
|
/* Client program */
|
||||||
@ -89,7 +91,7 @@ main(int argc, char *argv[])
|
|||||||
domain[0] = password[0] = shell[0] = directory[0] = 0;
|
domain[0] = password[0] = shell[0] = directory[0] = 0;
|
||||||
strcpy(keymapname, "us");
|
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)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -159,6 +161,10 @@ main(int argc, char *argv[])
|
|||||||
tcp_port_rdp = strtol(optarg, NULL, 10);
|
tcp_port_rdp = strtol(optarg, NULL, 10);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'K':
|
||||||
|
grab_keyboard = False;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
|
19
xwin.c
19
xwin.c
@ -25,11 +25,13 @@
|
|||||||
#define XK_MISCELLANY
|
#define XK_MISCELLANY
|
||||||
#include <X11/keysymdef.h>
|
#include <X11/keysymdef.h>
|
||||||
#include "rdesktop.h"
|
#include "rdesktop.h"
|
||||||
|
#include "scancodes.h"
|
||||||
|
|
||||||
extern int width;
|
extern int width;
|
||||||
extern int height;
|
extern int height;
|
||||||
extern BOOL sendmotion;
|
extern BOOL sendmotion;
|
||||||
extern BOOL fullscreen;
|
extern BOOL fullscreen;
|
||||||
|
extern BOOL grab_keyboard;
|
||||||
|
|
||||||
Display *display = NULL;
|
Display *display = NULL;
|
||||||
static int x_socket;
|
static int x_socket;
|
||||||
@ -347,7 +349,9 @@ ui_create_window(char *title)
|
|||||||
|
|
||||||
input_mask =
|
input_mask =
|
||||||
KeyPressMask | KeyReleaseMask | ButtonPressMask |
|
KeyPressMask | KeyReleaseMask | ButtonPressMask |
|
||||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask;
|
ButtonReleaseMask;
|
||||||
|
if (grab_keyboard)
|
||||||
|
input_mask |= EnterWindowMask | LeaveWindowMask;
|
||||||
if (sendmotion)
|
if (sendmotion)
|
||||||
input_mask |= PointerMotionMask;
|
input_mask |= PointerMotionMask;
|
||||||
|
|
||||||
@ -518,13 +522,26 @@ xwin_process_events()
|
|||||||
xevent.xmotion.y);
|
xevent.xmotion.y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FocusIn:
|
||||||
|
/* fall through */
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
|
if (grab_keyboard)
|
||||||
XGrabKeyboard(display, wnd, True,
|
XGrabKeyboard(display, wnd, True,
|
||||||
GrabModeAsync, GrabModeAsync,
|
GrabModeAsync, GrabModeAsync,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
break;
|
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:
|
case LeaveNotify:
|
||||||
|
if (grab_keyboard)
|
||||||
XUngrabKeyboard(display, CurrentTime);
|
XUngrabKeyboard(display, CurrentTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user