]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed several bugs with mouse grabbing
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 8 May 2008 17:05:39 +0000 (17:05 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 8 May 2008 17:05:39 +0000 (17:05 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8289 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
prvm_cmds.c
vid.h
vid_agl.c
vid_glx.c
vid_sdl.c
vid_wgl.c

index b2d2ecc39f73ad813349ad97b7c07709571f58aa..044dc6dbf02b8bdb8d76e8a5929e41ab4f1f8c6a 100644 (file)
@@ -2279,9 +2279,12 @@ void CL_UpdateScreen(void)
        else if (key_dest == key_menu)
                grabmouse = in_client_mouse;
        else if (key_dest == key_game)
-               grabmouse = (vid.fullscreen || vid_mouse.integer) && !cls.demoplayback && !cl.csqc_wantsmousemove;
+               grabmouse = vid_mouse.integer && !cls.demoplayback && !cl.csqc_wantsmousemove;
        else
                grabmouse = false;
+       vid.mouseaim = grabmouse;
+       if (vid.fullscreen)
+               grabmouse = true;
        if (!vid_activewindow)
                grabmouse = false;
 
index a20c55aeeeadc11309d7f82ca1d3cd9045e6415f..eb677b6168e2bf60d9ad560bec73adf7eefe1317 100644 (file)
@@ -2310,7 +2310,7 @@ void VM_getmousepos(void)
        VM_SAFEPARMCOUNT(0,VM_getmousepos);
 
        // FIXME: somehow this should involve in_client_mouse if this is menu progs
-       if (cl.csqc_wantsmousemove)
+       if (!vid.mouseaim)
                VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0);
        else
                VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0);
diff --git a/vid.h b/vid.h
index e76fbae62fe736835a88140d78cef6df141c7606..9f9e86d7eeff158cd67911c92e9a249e71cc4571 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -37,6 +37,9 @@ typedef struct viddef_s
        qboolean userefreshrate;
        int stereobuffer;
        int samples;
+
+       // these are used for state tracking
+       qboolean mouseaim;
 } viddef_t;
 
 // global video state
index df4f817f09fdc24adb4de449c10531bc8970f6cc..1caf2664fda02f65090d477b4b9faf2d04916a66 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -968,7 +968,7 @@ void Sys_SendKeyEvents(void)
                                                GetEventParameter(theEvent, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(deltaPos), NULL, &deltaPos);
                                                GetEventParameter(theEvent, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(windowPos), NULL, &windowPos);
 
-                                               if (vid_usingmouse)
+                                               if (vid.mouseaim)
                                                {
                                                        in_mouse_x += deltaPos.x;
                                                        in_mouse_y += deltaPos.y;
index adbe7a597a60654994b217fee06b1a165236284c..3593ac34d0e056519c53c7e24d6fdcddc454ea0f 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -365,7 +365,7 @@ static void HandleEvents(void)
 
                case MotionNotify:
                        // mouse moved
-                       if (vid_usingmouse)
+                       if (vid.mouseaim)
                        {
 #if !defined(__APPLE__) && !defined(SUNOS)
                                if (vid_dgamouse.integer == 1 && vid_x11_dgasupported)
index b38a22a3c0c97cf5525c05394fd40cdb95f30ec8..31e2f7aaa1582b0ff3e11800dbefc625dc0b0ada 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -276,7 +276,7 @@ void IN_Move( void )
        static int old_x = 0, old_y = 0;
        static int stuck = 0;
        int x, y;
-       if( vid_usingmouse )
+       if (vid.mouseaim)
        {
                if(vid_stick_mouse.integer)
                {
index 0c55110216efe94480c7e30982e55de0cd7590d7..7b39e2289da548a44ebbf93e3f66c001f985c31d 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -243,8 +243,6 @@ static void IN_StartupMouse (void);
 
 void VID_Finish (void)
 {
-       qboolean vid_usemouse;
-
        vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
        if (vid_usingvsync != vid_usevsync && gl_videosyncavailable)
        {
@@ -1477,7 +1475,7 @@ static void IN_MouseMove (void)
        in_windowmouse_x = current_pos.x - window_x;
        in_windowmouse_y = current_pos.y - window_y;
 
-       if (!vid_usingmouse)
+       if (!vid.mouseaim)
                return;
 
 #ifdef SUPPORTDIRECTX