mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 05:01:41 +00:00
- Fixed: The mouse wheel generated no events in GUI mode if you weren't
fullscreen. (e.g. You could no longer scroll the console with the mouse buffer.) - Fixed: Wheeling down was seen as wheeling up with the Win32 mouse. SVN r1618 (trunk)
This commit is contained in:
parent
12959a1bd1
commit
092512c44a
4 changed files with 63 additions and 35 deletions
|
@ -1,4 +1,8 @@
|
||||||
May 27, 2009
|
May 27, 2009
|
||||||
|
- Fixed: The mouse wheel generated no events in GUI mode if you weren't
|
||||||
|
fullscreen. (e.g. You could no longer scroll the console with the mouse
|
||||||
|
buffer.)
|
||||||
|
- Fixed: Wheeling down was seen as wheeling up with the Win32 mouse.
|
||||||
- EV_GUI_Key(Down|Up|Repeat) events no longer provide shifted key codes
|
- EV_GUI_Key(Down|Up|Repeat) events no longer provide shifted key codes
|
||||||
in data2. This was just unnecessary overhead that wasn't really needed
|
in data2. This was just unnecessary overhead that wasn't really needed
|
||||||
anywhere.
|
anywhere.
|
||||||
|
|
|
@ -143,6 +143,7 @@ extern menu_t JoystickMenu;
|
||||||
EXTERN_CVAR (String, language)
|
EXTERN_CVAR (String, language)
|
||||||
EXTERN_CVAR (Bool, lookstrafe)
|
EXTERN_CVAR (Bool, lookstrafe)
|
||||||
|
|
||||||
|
static int WheelDelta;
|
||||||
|
|
||||||
extern BOOL paused;
|
extern BOOL paused;
|
||||||
static bool noidle = false;
|
static bool noidle = false;
|
||||||
|
@ -415,6 +416,32 @@ bool GUIWndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESU
|
||||||
}
|
}
|
||||||
D_PostEvent(&ev);
|
D_PostEvent(&ev);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// Note: If the mouse is grabbed, it sends the mouse wheel events itself.
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
if (wParam & MK_SHIFT) ev.data3 |= GKM_SHIFT;
|
||||||
|
if (wParam & MK_CONTROL) ev.data3 |= GKM_CTRL;
|
||||||
|
if (GetKeyState(VK_MENU) & 0x8000) ev.data3 |= GKM_ALT;
|
||||||
|
WheelDelta += (SHORT)HIWORD(wParam);
|
||||||
|
if (WheelDelta < 0)
|
||||||
|
{
|
||||||
|
ev.subtype = EV_GUI_WheelDown;
|
||||||
|
while (WheelDelta <= -WHEEL_DELTA)
|
||||||
|
{
|
||||||
|
D_PostEvent(&ev);
|
||||||
|
WheelDelta += WHEEL_DELTA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev.subtype = EV_GUI_WheelUp;
|
||||||
|
while (WheelDelta >= WHEEL_DELTA)
|
||||||
|
{
|
||||||
|
D_PostEvent(&ev);
|
||||||
|
WheelDelta -= WHEEL_DELTA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ protected:
|
||||||
void PostButtonEvent(int button, bool down);
|
void PostButtonEvent(int button, bool down);
|
||||||
void ClearButtonState();
|
void ClearButtonState();
|
||||||
|
|
||||||
|
int WheelMove;
|
||||||
int LastX, LastY; // for m_filter
|
int LastX, LastY; // for m_filter
|
||||||
WORD ButtonState; // bit mask of current button states (1=down, 0=up)
|
WORD ButtonState; // bit mask of current button states (1=down, 0=up)
|
||||||
};
|
};
|
||||||
|
|
|
@ -266,6 +266,7 @@ FMouse::FMouse()
|
||||||
{
|
{
|
||||||
LastX = LastY = 0;
|
LastX = LastY = 0;
|
||||||
ButtonState = 0;
|
ButtonState = 0;
|
||||||
|
WheelMove = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -316,49 +317,42 @@ void FMouse::WheelMoved(int wheelmove)
|
||||||
event_t ev = { 0 };
|
event_t ev = { 0 };
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
if (GUICapture)
|
WheelMove += wheelmove;
|
||||||
|
|
||||||
|
if (WheelMove < 0)
|
||||||
{
|
{
|
||||||
ev.type = EV_GUI_Event;
|
dir = WHEEL_DELTA;
|
||||||
if (wheelmove < 0)
|
ev.data1 = KEY_MWHEELDOWN;
|
||||||
{
|
|
||||||
dir = WHEEL_DELTA;
|
|
||||||
ev.subtype = EV_GUI_WheelDown;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dir = -WHEEL_DELTA;
|
|
||||||
ev.subtype = EV_GUI_WheelUp;
|
|
||||||
}
|
|
||||||
/* FIXME
|
|
||||||
ev.data3 = ((KeyState[VK_SHIFT]&128) ? GKM_SHIFT : 0) |
|
|
||||||
((KeyState[VK_CONTROL]&128) ? GKM_CTRL : 0) |
|
|
||||||
((KeyState[VK_MENU]&128) ? GKM_ALT : 0);
|
|
||||||
*/
|
|
||||||
while (abs(wheelmove) >= WHEEL_DELTA)
|
|
||||||
{
|
|
||||||
D_PostEvent(&ev);
|
|
||||||
wheelmove += dir;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (wheelmove < 0)
|
dir = -WHEEL_DELTA;
|
||||||
{
|
ev.data1 = KEY_MWHEELUP;
|
||||||
dir = WHEEL_DELTA;
|
}
|
||||||
ev.data1 = KEY_MWHEELDOWN;
|
|
||||||
}
|
if (!GUICapture)
|
||||||
else
|
{
|
||||||
{
|
while (abs(WheelMove) >= WHEEL_DELTA)
|
||||||
dir = -WHEEL_DELTA;
|
|
||||||
ev.data1 = KEY_MWHEELUP;
|
|
||||||
}
|
|
||||||
while (abs(wheelmove) >= WHEEL_DELTA)
|
|
||||||
{
|
{
|
||||||
ev.type = EV_KeyDown;
|
ev.type = EV_KeyDown;
|
||||||
D_PostEvent(&ev);
|
D_PostEvent(&ev);
|
||||||
ev.type = EV_KeyUp;
|
ev.type = EV_KeyUp;
|
||||||
D_PostEvent(&ev);
|
D_PostEvent(&ev);
|
||||||
wheelmove += dir;
|
WheelMove += dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev.type = EV_GUI_Event;
|
||||||
|
ev.subtype = (WheelMove < 0) ? EV_GUI_WheelDown : EV_GUI_WheelUp;
|
||||||
|
if (GetKeyState(VK_SHIFT) & 0x8000) ev.data3 |= GKM_SHIFT;
|
||||||
|
if (GetKeyState(VK_CONTROL) & 0x8000) ev.data3 |= GKM_CTRL;
|
||||||
|
if (GetKeyState(VK_MENU) & 0x8000) ev.data3 |= GKM_ALT;
|
||||||
|
ev.data1 = 0;
|
||||||
|
while (abs(WheelMove) >= WHEEL_DELTA)
|
||||||
|
{
|
||||||
|
D_PostEvent(&ev);
|
||||||
|
WheelMove += dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,6 +414,8 @@ void FMouse::ClearButtonState()
|
||||||
}
|
}
|
||||||
ButtonState = 0;
|
ButtonState = 0;
|
||||||
}
|
}
|
||||||
|
// Reset mouse wheel accumulation to 0.
|
||||||
|
WheelMove = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -967,7 +963,7 @@ bool FWin32Mouse::WndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
else if (message == WM_MOUSEWHEEL)
|
else if (message == WM_MOUSEWHEEL)
|
||||||
{
|
{
|
||||||
WheelMoved(HIWORD(wParam));
|
WheelMoved((SHORT)HIWORD(wParam));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (message >= WM_LBUTTONDOWN && message <= WM_MBUTTONUP)
|
else if (message >= WM_LBUTTONDOWN && message <= WM_MBUTTONUP)
|
||||||
|
|
Loading…
Reference in a new issue