[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35457] trunk/blender/intern/ghost/intern: Fix [#26446] Quick extrude (Ctrl+LMB) works only one time
Nathan Letwory
nathan at letworyinteractive.com
Thu Mar 10 19:56:19 CET 2011
Revision: 35457
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35457
Author: jesterking
Date: 2011-03-10 18:56:19 +0000 (Thu, 10 Mar 2011)
Log Message:
-----------
Fix [#26446] Quick extrude (Ctrl+LMB) works only one time
Reported by Michael R
This was one thing I didn't test when accepting patch [#26364]. It is important to not
send repeats of modifier keys.
Modified Paths:
--------------
trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2011-03-10 18:17:20 UTC (rev 35456)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2011-03-10 18:56:19 UTC (rev 35457)
@@ -454,8 +454,71 @@
if (ri.header.dwType == RIM_TYPEKEYBOARD)
{
+ GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
+
+ GHOST_ModifierKeys modifiers;
+ system->retrieveModifierKeys(modifiers);
+
*keyDown = !(ri.data.keyboard.Flags & RI_KEY_BREAK);
key = this->convertKey(window, ri.data.keyboard.VKey, ri.data.keyboard.MakeCode, (ri.data.keyboard.Flags&(RI_KEY_E1|RI_KEY_E0)));
+
+ // extra handling of modifier keys: don't send repeats out from GHOST
+ if(key >= GHOST_kKeyLeftShift && key <= GHOST_kKeyRightAlt)
+ {
+ bool changed = false;
+ GHOST_TModifierKeyMask modifier;
+ switch(key) {
+ case GHOST_kKeyLeftShift:
+ {
+ changed = (modifiers.get(GHOST_kModifierKeyLeftShift) != *keyDown);
+ modifier = GHOST_kModifierKeyLeftShift;
+ }
+ break;
+ case GHOST_kKeyRightShift:
+ {
+ changed = (modifiers.get(GHOST_kModifierKeyRightShift) != *keyDown);
+ modifier = GHOST_kModifierKeyRightShift;
+ }
+ break;
+ case GHOST_kKeyLeftControl:
+ {
+ changed = (modifiers.get(GHOST_kModifierKeyLeftControl) != *keyDown);
+ modifier = GHOST_kModifierKeyLeftControl;
+ }
+ break;
+ case GHOST_kKeyRightControl:
+ {
+ changed = (modifiers.get(GHOST_kModifierKeyRightControl) != *keyDown);
+ modifier = GHOST_kModifierKeyRightControl;
+ }
+ break;
+ case GHOST_kKeyLeftAlt:
+ {
+ changed = (modifiers.get(GHOST_kModifierKeyLeftAlt) != *keyDown);
+ modifier = GHOST_kModifierKeyLeftAlt;
+ }
+ break;
+ case GHOST_kKeyRightAlt:
+ {
+ changed = (modifiers.get(GHOST_kModifierKeyRightAlt) != *keyDown);
+ modifier = GHOST_kModifierKeyRightAlt;
+ }
+ break;
+ default: break;
+ }
+
+ if(changed)
+ {
+ modifiers.set(modifier, *keyDown);
+ system->storeModifierKeys(modifiers);
+ }
+ else
+ {
+ key = GHOST_kKeyUnknown;
+ }
+ }
+
+
if(vk) *vk = ri.data.keyboard.VKey;
};
@@ -586,6 +649,7 @@
break;
}
}
+
return key;
}
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h 2011-03-10 18:17:20 UTC (rev 35456)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h 2011-03-10 18:56:19 UTC (rev 35457)
@@ -322,6 +322,14 @@
*/
virtual GHOST_TKey hardKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam, int * keyDown, char * vk);
+ /**
+ * Creates modifier key event(s) and updates the key data stored locally (m_modifierKeys).
+ * With the modifier keys, we want to distinguish left and right keys.
+ * Sometimes this is not possible (Windows ME for instance). Then, we want
+ * events generated for both keys.
+ * @param window The window receiving the event (the active window).
+ */
+ GHOST_EventKey* processModifierKeys(GHOST_IWindow *window);
/**
* Creates mouse button event.
@@ -381,6 +389,19 @@
static void processMinMaxInfo(MINMAXINFO * minmax);
/**
+ * Returns the local state of the modifier keys (from the message queue).
+ * @param keys The state of the keys.
+ */
+ inline virtual void retrieveModifierKeys(GHOST_ModifierKeys& keys) const;
+
+ /**
+ * Stores the state of the modifier keys locally.
+ * For internal use only!
+ * @param keys The new state of the modifier keys.
+ */
+ inline virtual void storeModifierKeys(const GHOST_ModifierKeys& keys);
+
+ /**
* Check current key layout for AltGr
*/
inline virtual void handleKeyboardChange(void);
@@ -394,7 +415,9 @@
* Initiates WM_INPUT messages from keyboard
*/
GHOST_TInt32 initKeyboardRawInput(void);
-
+
+ /** The current state of the modifier keys. */
+ GHOST_ModifierKeys m_modifierKeys;
/** State variable set at initialization. */
bool m_hasPerformanceCounter;
/** High frequency timer variable. */
@@ -418,6 +441,16 @@
#endif
};
+inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const
+{
+ keys = m_modifierKeys;
+}
+
+inline void GHOST_SystemWin32::storeModifierKeys(const GHOST_ModifierKeys& keys)
+{
+ m_modifierKeys = keys;
+}
+
inline void GHOST_SystemWin32::handleKeyboardChange(void)
{
m_keylayout = GetKeyboardLayout(0); // get keylayout for current thread
More information about the Bf-blender-cvs
mailing list