From 0b1433b07cbe2426a704c253a427c870cc206288 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 12 Jan 2015 01:54:18 +0000 Subject: [PATCH] Disable mouse input affecting the menu when the console is down. This code is awful, because I am an awful man. git-svn-id: https://svn.eduke32.com/eduke32@4906 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/baselayer.c | 4 ++-- polymer/eduke32/build/src/sdlayer.c | 10 +++++++--- polymer/eduke32/source/osdfuncs.c | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index 9c73f03f8..a0a098f27 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -128,7 +128,7 @@ int32_t readmouseabsxy(vec2_t * const destination, vec2_t const * const source) { int32_t xwidth; - if (!moustat || !mouseinwindow) + if (!moustat || !appactive || !mouseinwindow || osd && osd->flags & OSD_CAPTURE) return 0; xwidth = max(scale(240<<16, xdim, ydim), 320<<16); @@ -141,7 +141,7 @@ int32_t readmouseabsxy(vec2_t * const destination, vec2_t const * const source) void readmousebstatus(int32_t *b) { - if (!moustat || !appactive || !mouseinwindow) { *b = 0; return; } + if (!moustat || !appactive || !mouseinwindow || osd && osd->flags & OSD_CAPTURE) { *b = 0; return; } *b = mouseb; } diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 04fa2c630..b1f8d7713 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -814,9 +814,13 @@ void grabmouse(char a) void AppGrabMouse(char a) { - grabmouse(a); - AppMouseGrab = mousegrab; - SDL_ShowCursor(SDL_DISABLE); + if (!(a & 2)) + { + grabmouse(a); + AppMouseGrab = mousegrab; + } + + SDL_ShowCursor((osd && osd->flags & OSD_CAPTURE) ? SDL_ENABLE : SDL_DISABLE); } // diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index bc2b05f2e..896bd427f 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -127,6 +127,8 @@ void GAME_onshowosd(int32_t shown) { G_UpdateScreenArea(); + AppGrabMouse(!shown | 2); + osdshown = shown; // XXX: it's weird to fake a keypress like this.