From 77d1b76d3f88c01c47d29bb507d8d9e2c398136f Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 12 Mar 2007 05:26:59 +0000 Subject: [PATCH 1/1] added vid_grabkeyboard cvar which defaults to 0, this means that the glx client no longer locks out window manager hotkeys (such as volume control and music player control keys, as well as alt-tab) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6957 d7cf8633-e32d-0410-b094-e92efae38249 --- vid.h | 1 + vid_glx.c | 3 ++- vid_shared.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/vid.h b/vid.h index ac182021..10bf2bf1 100644 --- a/vid.h +++ b/vid.h @@ -53,6 +53,7 @@ extern cvar_t vid_bitsperpixel; extern cvar_t vid_refreshrate; extern cvar_t vid_vsync; extern cvar_t vid_mouse; +extern cvar_t vid_grabkeyboard; extern cvar_t vid_minwidth; extern cvar_t vid_minheight; diff --git a/vid_glx.c b/vid_glx.c index de1ac666..96bf36f2 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -287,7 +287,8 @@ static void IN_Activate (qboolean grab) #endif XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2); - XGrabKeyboard(vidx11_display, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); + if (vid_grabkeyboard.integer) + XGrabKeyboard(vidx11_display, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); mouse_x = mouse_y = 0; cl_ignoremousemove = true; diff --git a/vid_shared.c b/vid_shared.c index d1ee155e..9024098f 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -83,6 +83,7 @@ cvar_t vid_stereobuffer = {CVAR_SAVE, "vid_stereobuffer", "0", "enables 'quad-bu cvar_t vid_vsync = {CVAR_SAVE, "vid_vsync", "0", "sync to vertical blank, prevents 'tearing' (seeing part of one frame and part of another on the screen at the same time), automatically disabled when doing timedemo benchmarks"}; cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1", "whether to use the mouse in windowed mode (fullscreen always does)"}; +cvar_t vid_grabkeyboard = {CVAR_SAVE, "vid_grabkeyboard", "0", "whether to grab the keyboard when mouse is active (prevents use of volume control keys, music player keys, etc on some keyboards)"}; cvar_t vid_minwidth = {0, "vid_minwidth", "0", "minimum vid_width that is acceptable (to be set in default.cfg in mods)"}; cvar_t vid_minheight = {0, "vid_minheight", "0", "minimum vid_height that is acceptable (to be set in default.cfg in mods)"}; cvar_t gl_combine = {0, "gl_combine", "1", "faster rendering by using GL_ARB_texture_env_combine extension (part of OpenGL 1.3 and above)"}; @@ -938,6 +939,7 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&vid_stereobuffer); Cvar_RegisterVariable(&vid_vsync); Cvar_RegisterVariable(&vid_mouse); + Cvar_RegisterVariable(&vid_grabkeyboard); Cvar_RegisterVariable(&vid_minwidth); Cvar_RegisterVariable(&vid_minheight); Cvar_RegisterVariable(&gl_combine); -- 2.39.2