[Bf-blender-cvs] [ed62c38] pie-menus: Final fix for X11 weirdness.

Antony Riakiotakis noreply at git.blender.org
Fri Aug 1 17:51:42 CEST 2014


Commit: ed62c3873052c34f7eab05cf266cb18da05b1fb7
Author: Antony Riakiotakis
Date:   Fri Aug 1 17:51:30 2014 +0200
Branches: pie-menus
https://developer.blender.org/rBed62c3873052c34f7eab05cf266cb18da05b1fb7

Final fix for X11 weirdness.

Fortunately the extra keypress that comes after keyrelease has a time
signature less or equal than the last keyrelease of the same type, so
the included code will enable us to detect and reject such keypresses
safely and without many hacks.

===================================================================

M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_SystemX11.h

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 4d9fd56..5cbe408 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -525,6 +525,17 @@ processEvents(
 				continue;
 			}
 #endif
+			/* when using autorepeat, some keypress events can actually come -after- the
+			 * last keyrelease. The next code takes care of that */
+			if (xevent.type == KeyRelease) {
+				m_last_release_keycode = xevent.xkey.keycode;
+				m_last_release_time = xevent.xkey.time;
+			}
+
+			if (xevent.type == KeyPress) {
+				if ((xevent.xkey.keycode == m_last_release_keycode) && ((xevent.xkey.time <= m_last_release_time)))
+					continue;
+			}
 
 			processEvent(&xevent);
 			anyProcessed = true;
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 1f95e4b..f6191aa 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -356,6 +356,9 @@ private:
 	 *  and stop accumulating all events generated before that */
 	Time m_last_warp;
 
+	unsigned int m_last_release_keycode;
+	Time m_last_release_time;
+
 	/**
 	 * Return the ghost window associated with the
 	 * X11 window xwind




More information about the Bf-blender-cvs mailing list