diff options
author | Robert Ögren <gtk@roboros.com> | 2005-07-28 21:53:07 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2005-07-28 21:53:07 +0000 |
commit | 67021509039b34f7cb16136e77812fd0c93161d3 (patch) | |
tree | 920b7fea19c334bd11218101b1ef6985fb564ef4 | |
parent | 1a24be4e584fe9b09e952671047abf7644e874bb (diff) | |
download | gtk+-67021509039b34f7cb16136e77812fd0c93161d3.tar.gz |
Avoid spurious core pointer events when the tablet pen is lifted.
2005-07-28 Robert Ögren <gtk@roboros.com>
Avoid spurious core pointer events when the tablet pen is lifted.
(#167000)
* gdk/win32/gdkinput-win32.c (set_ignore_core): New static function,
handles delayed unsetting of _gdk_input_ignore_core.
(_gdk_input_other_event): Call set_ignore_core instead of setting
_gdk_input_ignore_core directly.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 10 | ||||
-rw-r--r-- | gdk/win32/gdkinput-win32.c | 47 |
4 files changed, 75 insertions, 2 deletions
@@ -1,3 +1,13 @@ +2005-07-28 Robert Ögren <gtk@roboros.com> + + Avoid spurious core pointer events when the tablet pen is lifted. + (#167000) + + * gdk/win32/gdkinput-win32.c (set_ignore_core): New static function, + handles delayed unsetting of _gdk_input_ignore_core. + (_gdk_input_other_event): Call set_ignore_core instead of setting + _gdk_input_ignore_core directly. + 2005-07-28 Dom Lachowicz <cinamod@hotmail.com> * modules/engines/ms-windows/*: Re-sync with gtk-wimp CVS. Notable diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ad780637db..c3a1e4c2c5 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2005-07-28 Robert Ögren <gtk@roboros.com> + + Avoid spurious core pointer events when the tablet pen is lifted. + (#167000) + + * gdk/win32/gdkinput-win32.c (set_ignore_core): New static function, + handles delayed unsetting of _gdk_input_ignore_core. + (_gdk_input_other_event): Call set_ignore_core instead of setting + _gdk_input_ignore_core directly. + 2005-07-28 Dom Lachowicz <cinamod@hotmail.com> * modules/engines/ms-windows/*: Re-sync with gtk-wimp CVS. Notable diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ad780637db..c3a1e4c2c5 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +2005-07-28 Robert Ögren <gtk@roboros.com> + + Avoid spurious core pointer events when the tablet pen is lifted. + (#167000) + + * gdk/win32/gdkinput-win32.c (set_ignore_core): New static function, + handles delayed unsetting of _gdk_input_ignore_core. + (_gdk_input_other_event): Call set_ignore_core instead of setting + _gdk_input_ignore_core directly. + 2005-07-28 Dom Lachowicz <cinamod@hotmail.com> * modules/engines/ms-windows/*: Re-sync with gtk-wimp CVS. Notable diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c index 25c4fd77bb..c7bb9a3aa6 100644 --- a/gdk/win32/gdkinput-win32.c +++ b/gdk/win32/gdkinput-win32.c @@ -45,6 +45,8 @@ #define DEBUG_WINTAB 1 /* Verbose debug messages enabled */ +#define PROXIMITY_OUT_DELAY 200 /* In milliseconds, see set_ignore_core */ + #endif #if defined(HAVE_WINTAB) || defined(HAVE_WHATEVER_OTHER) @@ -652,6 +654,47 @@ get_modifier_key_state (void) return state; } +#ifdef HAVE_WINTAB + +static guint ignore_core_timer = 0; + +static gboolean +ignore_core_timefunc (gpointer data) +{ + /* The delay has passed */ + _gdk_input_ignore_core = FALSE; + ignore_core_timer = 0; + + return FALSE; /* remove timeout */ +} + +/* + * Set or unset the _gdk_input_ignore_core variable that tells GDK + * to ignore events for the core pointer when the tablet is in proximity + * The unsetting is delayed slightly so that if a tablet event arrives + * just after proximity out, it does not cause a core pointer event + * which e.g. causes GIMP to switch tools. + */ +static void +set_ignore_core (gboolean ignore) +{ + if (ignore) + { + _gdk_input_ignore_core = TRUE; + /* Remove any pending clear */ + if (ignore_core_timer) + { + g_source_remove (ignore_core_timer); + ignore_core_timer = 0; + } + } + else + if (!ignore_core_timer) + ignore_core_timer = g_timeout_add (PROXIMITY_OUT_DELAY, + ignore_core_timefunc, NULL); +} +#endif /* HAVE_WINTAB */ + gboolean _gdk_input_other_event (GdkEvent *event, MSG *msg, @@ -934,12 +977,12 @@ _gdk_input_other_event (GdkEvent *event, if (LOWORD (msg->lParam) == 0) { event->proximity.type = GDK_PROXIMITY_OUT; - _gdk_input_ignore_core = FALSE; + set_ignore_core (FALSE); } else { event->proximity.type = GDK_PROXIMITY_IN; - _gdk_input_ignore_core = TRUE; + set_ignore_core (TRUE); } event->proximity.time = _gdk_win32_get_next_tick (msg->time); event->proximity.device = &gdkdev->info; |