Disable mouse scrolling when mouse leaves the window.
Keyboard scrolling still works. Really fixes #1141, and makes the game always behave as mentioned in r9428. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9447 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
35a510aa61
commit
897eeadedd
|
@ -210,6 +210,7 @@ static BOOL ignoreRMBC = true;
|
||||||
static DROID *psSelectedVtol;
|
static DROID *psSelectedVtol;
|
||||||
static DROID *psDominantSelected;
|
static DROID *psDominantSelected;
|
||||||
static BOOL bRadarDragging = false;
|
static BOOL bRadarDragging = false;
|
||||||
|
static bool mouseScroll = true;
|
||||||
|
|
||||||
BOOL rotActive = false;
|
BOOL rotActive = false;
|
||||||
BOOL gameStats = false;
|
BOOL gameStats = false;
|
||||||
|
@ -243,6 +244,10 @@ static BOOL bLasSatStruct;
|
||||||
static MOUSE_TARGET itemUnderMouse(BASE_OBJECT **ppObjUnderCursor);
|
static MOUSE_TARGET itemUnderMouse(BASE_OBJECT **ppObjUnderCursor);
|
||||||
static BOOL bShakingPermitted = true;
|
static BOOL bShakingPermitted = true;
|
||||||
|
|
||||||
|
void setMouseScroll(bool scroll)
|
||||||
|
{
|
||||||
|
mouseScroll = scroll;
|
||||||
|
}
|
||||||
|
|
||||||
void setRadarJump(BOOL val)
|
void setRadarJump(BOOL val)
|
||||||
{
|
{
|
||||||
|
@ -1047,33 +1052,7 @@ void scroll(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keyDown(KEY_LCTRL) && !keyDown(KEY_RCTRL))
|
if (mouseScroll)
|
||||||
{
|
|
||||||
/* Scroll left */
|
|
||||||
if (keyDown(KEY_LEFTARROW) || mouseXPos < BOUNDARY_X)
|
|
||||||
{
|
|
||||||
mouseAtLeft = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scroll right */
|
|
||||||
if ( keyDown(KEY_RIGHTARROW) || mouseXPos > (pie_GetVideoBufferWidth() - BOUNDARY_X) )
|
|
||||||
{
|
|
||||||
mouseAtRight = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scroll up */
|
|
||||||
if (keyDown(KEY_UPARROW) || (mouseYPos < BOUNDARY_Y))
|
|
||||||
{
|
|
||||||
mouseAtBottom = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scroll down */
|
|
||||||
if ( keyDown(KEY_DOWNARROW) || mouseYPos > (pie_GetVideoBufferHeight() - BOUNDARY_Y) )
|
|
||||||
{
|
|
||||||
mouseAtTop = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* Scroll left */
|
/* Scroll left */
|
||||||
if (mouseXPos < BOUNDARY_X)
|
if (mouseXPos < BOUNDARY_X)
|
||||||
|
@ -1099,6 +1078,32 @@ void scroll(void)
|
||||||
mouseAtTop = true;
|
mouseAtTop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!keyDown(KEY_LCTRL) && !keyDown(KEY_RCTRL))
|
||||||
|
{
|
||||||
|
/* Scroll left */
|
||||||
|
if (keyDown(KEY_LEFTARROW))
|
||||||
|
{
|
||||||
|
mouseAtLeft = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scroll right */
|
||||||
|
if (keyDown(KEY_RIGHTARROW))
|
||||||
|
{
|
||||||
|
mouseAtRight = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scroll up */
|
||||||
|
if (keyDown(KEY_UPARROW))
|
||||||
|
{
|
||||||
|
mouseAtBottom = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scroll down */
|
||||||
|
if ( keyDown(KEY_DOWNARROW))
|
||||||
|
{
|
||||||
|
mouseAtTop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Time to update scroll - change to should be time */
|
/* Time to update scroll - change to should be time */
|
||||||
timeDiff = SDL_GetTicks() - scrollRefTime;
|
timeDiff = SDL_GetTicks() - scrollRefTime;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ extern void processMouseClickInput(void);
|
||||||
|
|
||||||
extern void scroll(void);
|
extern void scroll(void);
|
||||||
extern void resetScroll(void);
|
extern void resetScroll(void);
|
||||||
|
extern void setMouseScroll(bool);
|
||||||
|
|
||||||
extern BOOL DrawnInLastFrame(SDWORD Frame);
|
extern BOOL DrawnInLastFrame(SDWORD Frame);
|
||||||
|
|
||||||
|
|
|
@ -864,7 +864,10 @@ static void handleActiveEvent(SDL_ActiveEvent * activeEvent)
|
||||||
// Ignore focus loss through SDL_APPMOUSEFOCUS, since it mostly happens accidentialy
|
// Ignore focus loss through SDL_APPMOUSEFOCUS, since it mostly happens accidentialy
|
||||||
// active.state is a bitflag! Mixed events (eg. APPACTIVE|APPMOUSEFOCUS) will thus not be ignored.
|
// active.state is a bitflag! Mixed events (eg. APPACTIVE|APPMOUSEFOCUS) will thus not be ignored.
|
||||||
if ( activeEvent->state == SDL_APPMOUSEFOCUS )
|
if ( activeEvent->state == SDL_APPMOUSEFOCUS )
|
||||||
|
{
|
||||||
|
setMouseScroll(activeEvent->gain);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( activeEvent->gain == 1 )
|
if ( activeEvent->gain == 1 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue