[Bf-blender-cvs] [ef431a87057] master: Cleanup: remove references to key-map modifier values denoting order

Campbell Barton noreply at git.blender.org
Thu Mar 3 05:34:38 CET 2022


Commit: ef431a87057d366afe589a1c7b16e83809191ca6
Author: Campbell Barton
Date:   Thu Mar 3 13:56:05 2022 +1100
Branches: master
https://developer.blender.org/rBef431a87057d366afe589a1c7b16e83809191ca6

Cleanup: remove references to key-map modifier values denoting order

This feature was never exposed to users.

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

M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index dabef04583b..7a972ac3ef8 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -364,7 +364,7 @@ typedef struct wmKeyMapItem {
   int8_t val;
   /** Use when `val == WM_CLICK_DRAG`,  */
   int8_t direction;
-  /** `oskey` also known as apple, windows-key or super, value denotes order of pressed. */
+  /** `oskey` also known as apple, windows-key or super. */
   short shift, ctrl, alt, oskey;
   /** Raw-key modifier. */
   short keymodifier;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 36ac6f401b1..af7d2a26e7e 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2037,33 +2037,28 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi)
     }
   }
 
-  const bool shift = (winevent->modifier & KM_SHIFT) != 0;
-  const bool ctrl = (winevent->modifier & KM_CTRL) != 0;
-  const bool alt = (winevent->modifier & KM_ALT) != 0;
-  const bool oskey = (winevent->modifier & KM_OSKEY) != 0;
-
-  /* Modifiers also check bits, so it allows modifier order.
-   * Account for rare case of when these keys are used as the 'type' not as modifiers. */
+  /* Account for rare case of when these keys are used as the 'type' not as modifiers. */
   if (kmi->shift != KM_ANY) {
-    if ((shift != kmi->shift) && !(shift & kmi->shift) &&
-        !ELEM(winevent->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) {
+    const bool shift = (winevent->modifier & KM_SHIFT) != 0;
+    if ((shift != kmi->shift) && !ELEM(winevent->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) {
       return false;
     }
   }
   if (kmi->ctrl != KM_ANY) {
-    if (ctrl != kmi->ctrl && !(ctrl & kmi->ctrl) &&
-        !ELEM(winevent->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) {
+    const bool ctrl = (winevent->modifier & KM_CTRL) != 0;
+    if (ctrl != kmi->ctrl && !ELEM(winevent->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) {
       return false;
     }
   }
   if (kmi->alt != KM_ANY) {
-    if (alt != kmi->alt && !(alt & kmi->alt) &&
-        !ELEM(winevent->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) {
+    const bool alt = (winevent->modifier & KM_ALT) != 0;
+    if (alt != kmi->alt && !ELEM(winevent->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) {
       return false;
     }
   }
   if (kmi->oskey != KM_ANY) {
-    if (oskey != kmi->oskey && !(oskey & kmi->oskey) && (winevent->type != EVT_OSKEY)) {
+    const bool oskey = (winevent->modifier & KM_OSKEY) != 0;
+    if ((oskey != kmi->oskey) && (winevent->type != EVT_OSKEY)) {
       return false;
     }
   }



More information about the Bf-blender-cvs mailing list