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
This commit is contained in:
terminx 2015-01-12 01:54:18 +00:00
parent 130244a302
commit 0b1433b07c
3 changed files with 11 additions and 5 deletions

View file

@ -128,7 +128,7 @@ int32_t readmouseabsxy(vec2_t * const destination, vec2_t const * const source)
{ {
int32_t xwidth; int32_t xwidth;
if (!moustat || !mouseinwindow) if (!moustat || !appactive || !mouseinwindow || osd && osd->flags & OSD_CAPTURE)
return 0; return 0;
xwidth = max(scale(240<<16, xdim, ydim), 320<<16); 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) 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; *b = mouseb;
} }

View file

@ -814,9 +814,13 @@ void grabmouse(char a)
void AppGrabMouse(char a) void AppGrabMouse(char a)
{ {
grabmouse(a); if (!(a & 2))
AppMouseGrab = mousegrab; {
SDL_ShowCursor(SDL_DISABLE); grabmouse(a);
AppMouseGrab = mousegrab;
}
SDL_ShowCursor((osd && osd->flags & OSD_CAPTURE) ? SDL_ENABLE : SDL_DISABLE);
} }
// //

View file

@ -127,6 +127,8 @@ void GAME_onshowosd(int32_t shown)
{ {
G_UpdateScreenArea(); G_UpdateScreenArea();
AppGrabMouse(!shown | 2);
osdshown = shown; osdshown = shown;
// XXX: it's weird to fake a keypress like this. // XXX: it's weird to fake a keypress like this.