summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-14 16:30:44 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-14 16:30:44 +0000
commit8381ec4111505692a9058db37412adb872bedd3e (patch)
treeafabb776a5f3b6696e021266c8fa1023c1b71fcb /src/graphics.cpp
parente7d91341bc0ee21f4b31fefb77c34b14c13c618d (diff)
downloadmana-8381ec4111505692a9058db37412adb872bedd3e.tar.gz
mana-8381ec4111505692a9058db37412adb872bedd3e.tar.bz2
mana-8381ec4111505692a9058db37412adb872bedd3e.tar.xz
mana-8381ec4111505692a9058db37412adb872bedd3e.zip
Hide mouse when the application doesn't have mouse focus.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 5ff02aa8..7da5520c 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -130,10 +130,14 @@ void Graphics::drawImageRect(
void Graphics::updateScreen()
{
- // Draw mouse before flipping
int mouseX, mouseY;
- SDL_GetMouseState(&mouseX, &mouseY);
- mouseCursor->draw(screen, mouseX - 5, mouseY - 2);
+ Uint8 button = SDL_GetMouseState(&mouseX, &mouseY);
+
+ if (SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1))
+ {
+ // Draw mouse before flipping
+ mouseCursor->draw(screen, mouseX - 5, mouseY - 2);
+ }
if (useOpenGL) {
glFlush();