[aseprite] 233/308: Hide software cursor when mouse leaves window on Linux (fix #948)
Tobias Hansen
thansen at moszumanska.debian.org
Tue Mar 8 02:45:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 3400cdba8bb8dfb41cc8b626fe64f7074d990606
Author: David Capello <davidcapello at gmail.com>
Date: Fri Feb 12 18:59:11 2016 -0300
Hide software cursor when mouse leaves window on Linux (fix #948)
Now we generate MouseEvent/Leave she events when Allegro4 _mouse_on
changes from 1 to 0 or vice-versa on Linux.
---
src/allegro/src/mouse.c | 10 +++++++++-
src/she/alleg4/mouse_poller.cpp | 17 ++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/allegro/src/mouse.c b/src/allegro/src/mouse.c
index dd7519e..a8442d2 100644
--- a/src/allegro/src/mouse.c
+++ b/src/allegro/src/mouse.c
@@ -57,6 +57,7 @@ int _mouse_z = 0;
int _mouse_w = 0;
int _mouse_b = 0;
int _mouse_on = FALSE;
+int _mouse_on_old = FALSE;
static int mon = TRUE;
@@ -261,6 +262,7 @@ END_OF_STATIC_FUNCTION(draw_mouse);
static void update_mouse(void)
{
int x, y, z, w, b, flags = 0;
+ int mouse_on_changed = FALSE;
if (freeze_mouse_flag) {
x = mx;
@@ -280,11 +282,17 @@ static void update_mouse(void)
b = 4;
}
+ if (_mouse_on_old != _mouse_on) {
+ _mouse_on_old = _mouse_on;
+ mouse_on_changed = TRUE;
+ }
+
if ((mouse_x != x) ||
(mouse_y != y) ||
(mouse_z != z) ||
(mouse_w != w) ||
- (mouse_b != b)) {
+ (mouse_b != b) ||
+ (mouse_on_changed)) {
if (mouse_callback) {
if ((mouse_x != x) || (mouse_y != y))
diff --git a/src/she/alleg4/mouse_poller.cpp b/src/she/alleg4/mouse_poller.cpp
index 6e796fa..35ff742 100644
--- a/src/she/alleg4/mouse_poller.cpp
+++ b/src/she/alleg4/mouse_poller.cpp
@@ -1,5 +1,5 @@
// SHE library
-// Copyright (C) 2012-2015 David Capello
+// Copyright (C) 2012-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@@ -51,6 +51,12 @@ DlbClk double_click_level;
Event::MouseButton double_click_button = Event::NoneButton;
int double_click_ticks;
+#if !defined(__APPLE__) && !defined(_WIN32)
+// Mouse enter/leave
+int old_mouse_on = 0;
+extern "C" int _mouse_on;
+#endif
+
inline int display_w()
{
ASSERT(unique_display);
@@ -192,6 +198,15 @@ void she_mouse_callback(int flags)
Event ev;
ev.setPosition(gfx::Point(she_mouse_x, she_mouse_y));
+ // Mouse enter/leave for Linux
+#if !defined(__APPLE__) && !defined(_WIN32)
+ if (old_mouse_on != _mouse_on) {
+ old_mouse_on = _mouse_on;
+ ev.setType(_mouse_on ? Event::MouseEnter: Event::MouseLeave);
+ queue_event(ev);
+ }
+#endif
+
// move
if (flags & MOUSE_FLAG_MOVE) {
ev.setType(Event::MouseMove);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list