mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: [Win32] Use OS function for mouse tracking if present.
This commit is contained in:
parent
afa3e15afe
commit
4bfd277017
|
@ -38,6 +38,9 @@
|
||||||
#define PM_QS_INPUT 0x20000
|
#define PM_QS_INPUT 0x20000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI *PFNTRACKMOUSEEVENT)(LPTRACKMOUSEEVENT lpEventTrack);
|
||||||
|
static PFNTRACKMOUSEEVENT _pTrackMouseEvent = NULL;
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
HWND main_wnd;
|
HWND main_wnd;
|
||||||
HBITMAP dib_sect;
|
HBITMAP dib_sect;
|
||||||
|
@ -747,7 +750,16 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
* tracking the mouse for exiting the window */
|
* tracking the mouse for exiting the window */
|
||||||
if (!_cursor.in_window) {
|
if (!_cursor.in_window) {
|
||||||
_cursor.in_window = true;
|
_cursor.in_window = true;
|
||||||
SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, (TIMERPROC)TrackMouseTimerProc);
|
if (_pTrackMouseEvent != NULL) {
|
||||||
|
TRACKMOUSEEVENT tme;
|
||||||
|
tme.cbSize = sizeof(tme);
|
||||||
|
tme.dwFlags = TME_LEAVE;
|
||||||
|
tme.hwndTrack = hwnd;
|
||||||
|
|
||||||
|
_pTrackMouseEvent(&tme);
|
||||||
|
} else {
|
||||||
|
SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, (TIMERPROC)TrackMouseTimerProc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cursor.fix_at) {
|
if (_cursor.fix_at) {
|
||||||
|
@ -1038,6 +1050,9 @@ static void RegisterWndClass()
|
||||||
|
|
||||||
registered = true;
|
registered = true;
|
||||||
if (!RegisterClass(&wnd)) usererror("RegisterClass failed");
|
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…
Reference in New Issue