Commit: adcb0edca0e25002981faa3db17e65f7f3dfa2a6
Author: Campbell Barton
Date:   Wed Jan 25 11:51:21 2023 +1100
Branches: master
https://developer.blender.org/rBadcb0edca0e25002981faa3db17e65f7f3dfa2a6

Cleanup: clang-tidy, replace defines with enum, redundant parenthesis

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

M       intern/ghost/intern/GHOST_SystemWayland.cpp
M       source/blender/blenlib/intern/math_matrix.cc
M       source/blender/windowmanager/intern/wm_window.c

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

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 3911014d8cb..496179fc826 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -215,13 +215,15 @@ static bool use_gnome_confine_hack = false;
 /**
  * The event codes are used to differentiate from which mouse button an event 
comes from.
  */
-#define BTN_LEFT 0x110
-#define BTN_RIGHT 0x111
-#define BTN_MIDDLE 0x112
-#define BTN_SIDE 0x113
-#define BTN_EXTRA 0x114
-#define BTN_FORWARD 0x115
-#define BTN_BACK 0x116
+enum {
+  BTN_LEFT = 0x110,
+  BTN_RIGHT = 0x111,
+  BTN_MIDDLE = 0x112,
+  BTN_SIDE = 0x113,
+  BTN_EXTRA = 0x114,
+  BTN_FORWARD = 0x115,
+  BTN_BACK = 0x116
+};
 // #define BTN_TASK 0x117 /* UNUSED. */
 
 /**
@@ -232,28 +234,34 @@ static bool use_gnome_confine_hack = false;
  * at the Blender studio, having the button closest to the nib be MMB is 
preferable,
  * so use this as a default. If needs be - swapping these could be a 
preference.
  */
-#define BTN_STYLUS 0x14b  /* Use as middle-mouse. */
-#define BTN_STYLUS2 0x14c /* Use as right-mouse. */
-/* NOTE(@campbellbarton): Map to an additional button (not sure which hardware 
uses this). */
-#define BTN_STYLUS3 0x149
+enum {
+  /** Use as middle-mouse. */
+  BTN_STYLUS = 0x14b,
+  /** Use as right-mouse. */
+  BTN_STYLUS2 = 0x14c,
+  /** NOTE(@campbellbarton): Map to an additional button (not sure which 
hardware uses this). */
+  BTN_STYLUS3 = 0x149,
+};
 
 /**
  * Keyboard scan-codes.
  */
-#define KEY_GRAVE 41
+enum {
+  KEY_GRAVE = 41,
 
 #ifdef USE_NON_LATIN_KB_WORKAROUND
-#  define KEY_1 2
-#  define KEY_2 3
-#  define KEY_3 4
-#  define KEY_4 5
-#  define KEY_5 6
-#  define KEY_6 7
-#  define KEY_7 8
-#  define KEY_8 9
-#  define KEY_9 10
-#  define KEY_0 11
+  KEY_1 = 2,
+  KEY_2 = 3,
+  KEY_3 = 4,
+  KEY_4 = 5,
+  KEY_5 = 6,
+  KEY_6 = 7,
+  KEY_7 = 8,
+  KEY_8 = 9,
+  KEY_9 = 10,
+  KEY_0 = 11,
 #endif
+};
 
 /** \} */
 
diff --git a/source/blender/blenlib/intern/math_matrix.cc 
b/source/blender/blenlib/intern/math_matrix.cc
index 9ab484d0d8a..e89b58b2a76 100644
--- a/source/blender/blenlib/intern/math_matrix.cc
+++ b/source/blender/blenlib/intern/math_matrix.cc
@@ -230,9 +230,9 @@ MatBase<T, Size, Size> pseudo_invert(const MatBase<T, Size, 
Size> &mat, T epsilo
     JacobiSVD<MatrixDynamicT, NoQRPreconditioner> svd(
         Eigen::Map<const MatrixDynamicT>(mat.base_ptr(), Size, Size), 
ComputeThinU | ComputeThinV);
 
-    (Eigen::Map<MatrixT>(U.base_ptr())) = svd.matrixU();
+    Eigen::Map<MatrixT>(U.base_ptr()) = svd.matrixU();
     (Eigen::Map<VectorT>(S_val)) = svd.singularValues();
-    (Eigen::Map<MatrixT>(V.base_ptr())) = svd.matrixV();
+    Eigen::Map<MatrixT>(V.base_ptr()) = svd.matrixV();
   }
 
   /* Invert or nullify component based on epsilon comparison. */
@@ -290,9 +290,9 @@ static void polar_decompose(const MatBase<T, 3, 3> &mat3,
     JacobiSVD<MatrixDynamicT, NoQRPreconditioner> svd(
         Eigen::Map<const MatrixDynamicT>(mat3.base_ptr(), 3, 3), ComputeThinU 
| ComputeThinV);
 
-    (Eigen::Map<MatrixT>(W.base_ptr())) = svd.matrixU();
+    Eigen::Map<MatrixT>(W.base_ptr()) = svd.matrixU();
     (Eigen::Map<VectorT>(S_val)) = svd.singularValues();
-    (Map<MatrixT>(V.base_ptr())) = svd.matrixV();
+    Map<MatrixT>(V.base_ptr()) = svd.matrixV();
   }
 
   MatBase<T, 3, 3> S = from_scale<MatBase<T, 3, 3>>(S_val);
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index 1c029a6902d..aa82a7d0b3a 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1143,7 +1143,7 @@ static bool ghost_event_proc(GHOST_EventHandle evt, 
GHOST_TUserDataPtr C_void_pt
     wmWindow *win = GHOST_GetWindowUserData(ghostwin);
 
     switch (type) {
-      case GHOST_kEventWindowDeactivate:
+      case GHOST_kEventWindowDeactivate: {
 #ifdef USE_WIN_DEACTIVATE
         /* Release all held modifiers before de-activating the window. */
         if (win->eventstate->modifier != 0) {
@@ -1180,8 +1180,9 @@ static bool ghost_event_proc(GHOST_EventHandle evt, 
GHOST_TUserDataPtr C_void_pt
 #endif /* USE_WIN_DEACTIVATE */
 
         wm_event_add_ghostevent(wm, win, type, data);
-        win->active = 0; /* XXX */
+        win->active = 0;
         break;
+      }
       case GHOST_kEventWindowActivate: {
 
         /* No context change! C->wm->windrawable is drawable, or for area 
queues. */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to