Codechange: [Win32] Remove Windows 95 specific mouse tracking work-around.

pull/217/head
Michael Lutz 3 years ago
parent 40d5fe1631
commit 7415964a4d

@ -39,9 +39,6 @@
#define PM_QS_INPUT 0x20000
#endif
typedef BOOL (WINAPI *PFNTRACKMOUSEEVENT)(LPTRACKMOUSEEVENT lpEventTrack);
static PFNTRACKMOUSEEVENT _pTrackMouseEvent = nullptr;
static struct {
HWND main_wnd; ///< Handle to system window.
HBITMAP dib_sect; ///< System bitmap object referencing our rendering buffer.
@ -229,31 +226,6 @@ int RedrawScreenDebug()
}
#endif
/* Windows 95 will not have a WM_MOUSELEAVE message, so define it if needed */
#if !defined(WM_MOUSELEAVE)
#define WM_MOUSELEAVE 0x02A3
#endif
#define TID_POLLMOUSE 1
#define MOUSE_POLL_DELAY 75
static void CALLBACK TrackMouseTimerProc(HWND hwnd, UINT msg, UINT_PTR event, DWORD time)
{
RECT rc;
POINT pt;
/* Get the rectangle of our window and translate it to screen coordinates.
* Compare this with the current screen coordinates of the mouse and if it
* falls outside of the area or our window we have left the window. */
GetClientRect(hwnd, &rc);
MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT)(LPRECT)&rc, 2);
GetCursorPos(&pt);
if (!PtInRect(&rc, pt) || (WindowFromPoint(pt) != hwnd)) {
KillTimer(hwnd, event);
PostMessage(hwnd, WM_MOUSELEAVE, 0, 0L);
}
}
/**
* Instantiate a new window.
* @param full_screen Whether to make a full screen window or not.
@ -633,7 +605,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
switch (msg) {
case WM_CREATE:
SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, TrackMouseTimerProc);
_cursor.in_window = false; // Win32 has mouse tracking.
SetCompositionPos(hwnd);
_imm_props = ImmGetProperty(GetKeyboardLayout(0), IGP_PROPERTY);
break;
@ -730,16 +702,12 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
* tracking the mouse for exiting the window */
if (!_cursor.in_window) {
_cursor.in_window = true;
if (_pTrackMouseEvent != nullptr) {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
_pTrackMouseEvent(&tme);
} else {
SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, TrackMouseTimerProc);
}
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
TrackMouseEvent(&tme);
}
if (_cursor.fix_at) {
@ -1024,9 +992,6 @@ static void RegisterWndClass()
registered = true;
if (!RegisterClass(&wnd)) usererror("RegisterClass failed");
/* Dynamically load mouse tracking, as it doesn't exist on Windows 95. */
_pTrackMouseEvent = (PFNTRACKMOUSEEVENT)GetProcAddress(GetModuleHandle(_T("User32")), "TrackMouseEvent");
}
}

Loading…
Cancel
Save