summaryrefslogtreecommitdiff
path: root/video/sdl_v.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-03-24 00:42:35 +0000
committerDarkvater <Darkvater@openttd.org>2006-03-24 00:42:35 +0000
commitfb48c3b4aa98540b03ef64410184547da70ea97c (patch)
treef10f7be93e3ce5d8a676824b0bec3535d8c3dfe6 /video/sdl_v.c
parent41f4c473dafd4cd1982d76cfb7b702426bb6067f (diff)
downloadopenttd-fb48c3b4aa98540b03ef64410184547da70ea97c.tar.xz
(svn r4075) - Feature: Undraw the mouse when it leaves the window and Draw it again when it enters. Added both for WIN32 and SDL. Since Win95 has troubles with TrackMouseEvent(), this function was just simply rewritten which was the easiest. Based on a patch by DmitryKo.
Diffstat (limited to 'video/sdl_v.c')
-rw-r--r--video/sdl_v.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/video/sdl_v.c b/video/sdl_v.c
index 3b27c7ad6..d190237fb 100644
--- a/video/sdl_v.c
+++ b/video/sdl_v.c
@@ -345,6 +345,15 @@ static int PollEvent(void)
}
break;
+ case SDL_ACTIVEEVENT:
+ if (ev.active.gain == 1) // mouse entered the window, enable cursor
+ _cursor.in_window = true;
+ else if (ev.active.gain == 0) {
+ UndrawMouseCursor(); // mouse left the window, undraw cursor
+ _cursor.in_window = false;
+ }
+ break;
+
case SDL_QUIT:
// do not ask to quit on the main screen
if (_game_mode != GM_MENU) {