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

This commit is contained in:
Campbell Barton 2023-01-25 11:51:21 +11:00
parent 9c71f5807f
commit adcb0edca0
3 changed files with 37 additions and 28 deletions

View File

@ -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
};
/** \} */

View File

@ -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);

View File

@ -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. */