Xephyr: option to disable grabbing the host
This patch makes it possible to use C-S key combinations within Xephyr without losing access to the host window manager's commands. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
61a292adf4
commit
942e18e17e
|
@ -68,6 +68,7 @@ typedef struct _EphyrInputPrivate {
|
||||||
|
|
||||||
Bool EphyrWantGrayScale = 0;
|
Bool EphyrWantGrayScale = 0;
|
||||||
Bool EphyrWantResize = 0;
|
Bool EphyrWantResize = 0;
|
||||||
|
Bool EphyrWantNoHostGrab = 0;
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
host_has_extension(xcb_extension_t *extension)
|
host_has_extension(xcb_extension_t *extension)
|
||||||
|
@ -649,7 +650,11 @@ ephyrInitScreen(ScreenPtr pScreen)
|
||||||
|
|
||||||
EPHYR_LOG("pScreen->myNum:%d\n", pScreen->myNum);
|
EPHYR_LOG("pScreen->myNum:%d\n", pScreen->myNum);
|
||||||
hostx_set_screen_number(screen, pScreen->myNum);
|
hostx_set_screen_number(screen, pScreen->myNum);
|
||||||
hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)");
|
if (EphyrWantNoHostGrab) {
|
||||||
|
hostx_set_win_title(screen, "xephyr");
|
||||||
|
} else {
|
||||||
|
hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)");
|
||||||
|
}
|
||||||
pScreen->CreateColormap = ephyrCreateColormap;
|
pScreen->CreateColormap = ephyrCreateColormap;
|
||||||
|
|
||||||
#ifdef XV
|
#ifdef XV
|
||||||
|
@ -1092,12 +1097,13 @@ ephyrProcessKeyRelease(xcb_generic_event_t *xev)
|
||||||
if (!keysyms)
|
if (!keysyms)
|
||||||
keysyms = xcb_key_symbols_alloc(conn);
|
keysyms = xcb_key_symbols_alloc(conn);
|
||||||
|
|
||||||
if (((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L
|
if (!EphyrWantNoHostGrab &&
|
||||||
|
(((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L
|
||||||
|| xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_R)
|
|| xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_R)
|
||||||
&& (key->state & XCB_MOD_MASK_CONTROL)) ||
|
&& (key->state & XCB_MOD_MASK_CONTROL)) ||
|
||||||
((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_L
|
((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_L
|
||||||
|| xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_R)
|
|| xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_R)
|
||||||
&& (key->state & XCB_MOD_MASK_SHIFT))) {
|
&& (key->state & XCB_MOD_MASK_SHIFT)))) {
|
||||||
KdScreenInfo *screen = screen_from_window(key->event);
|
KdScreenInfo *screen = screen_from_window(key->event);
|
||||||
EphyrScrPriv *scrpriv = screen->driver;
|
EphyrScrPriv *scrpriv = screen->driver;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
extern Window EphyrPreExistingHostWin;
|
extern Window EphyrPreExistingHostWin;
|
||||||
extern Bool EphyrWantGrayScale;
|
extern Bool EphyrWantGrayScale;
|
||||||
extern Bool EphyrWantResize;
|
extern Bool EphyrWantResize;
|
||||||
|
extern Bool EphyrWantNoHostGrab;
|
||||||
extern Bool kdHasPointer;
|
extern Bool kdHasPointer;
|
||||||
extern Bool kdHasKbd;
|
extern Bool kdHasKbd;
|
||||||
extern Bool ephyr_glamor, ephyr_glamor_gles2;
|
extern Bool ephyr_glamor, ephyr_glamor_gles2;
|
||||||
|
@ -153,6 +154,7 @@ ddxUseMsg(void)
|
||||||
ErrorF("-name [name] define the name in the WM_CLASS property\n");
|
ErrorF("-name [name] define the name in the WM_CLASS property\n");
|
||||||
ErrorF
|
ErrorF
|
||||||
("-title [title] set the window title in the WM_NAME property\n");
|
("-title [title] set the window title in the WM_NAME property\n");
|
||||||
|
ErrorF("-no-host-grab Disable grabbing the keyboard and mouse.\n");
|
||||||
ErrorF("\n");
|
ErrorF("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,6 +362,10 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
/* end Xnest compat */
|
/* end Xnest compat */
|
||||||
|
else if (!strcmp(argv[i], "-no-host-grab")) {
|
||||||
|
EphyrWantNoHostGrab = 1;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
return KdProcessArgument(argc, argv, i);
|
return KdProcessArgument(argc, argv, i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,9 @@ improvement is negligible.
|
||||||
.B -resizeable
|
.B -resizeable
|
||||||
Allow the Xephyr window to be resized, even if not embedded into a parent
|
Allow the Xephyr window to be resized, even if not embedded into a parent
|
||||||
window. By default, the Xephyr window has a fixed size.
|
window. By default, the Xephyr window has a fixed size.
|
||||||
|
.TP 8
|
||||||
|
.B -no-host-grab
|
||||||
|
Disable grabbing the keyboard and mouse.
|
||||||
.SH "SIGNALS"
|
.SH "SIGNALS"
|
||||||
Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
|
Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
|
||||||
toggle the debugging mode.
|
toggle the debugging mode.
|
||||||
|
|
Loading…
Reference in New Issue