Cleanup: Remove ugly ELEM checks in modifier key handling

Campbell once told me such checks can cause warnings on some compilers, so
let's try to avoid them.

From the theoretical view, this check works quite different than the old
one, but in this case everything should work just like previousely.
This commit is contained in:
julianeisel
2015-01-26 02:38:39 +01:00
parent c792e54699
commit b554bcf124
2 changed files with 7 additions and 7 deletions

View File

@@ -6344,7 +6344,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
}
/* handle keyframing */
else if ((event->type == IKEY) &&
!ELEM(KM_MOD_FIRST, event->ctrl, event->oskey) &&
(event->ctrl + event->oskey == 0) &&
(event->val == KM_PRESS))
{
if (event->alt) {
@@ -6365,7 +6365,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
}
/* handle drivers */
else if ((event->type == DKEY) &&
!ELEM(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) &&
((event->ctrl + event->oskey + event->shift) == 0) &&
(event->val == KM_PRESS))
{
if (event->alt)
@@ -6379,7 +6379,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
}
/* handle keyingsets */
else if ((event->type == KKEY) &&
!ELEM(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) &&
((event->ctrl + event->oskey + event->shift) == 0) &&
(event->val == KM_PRESS))
{
if (event->alt)
@@ -6392,9 +6392,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
return WM_UI_HANDLER_BREAK;
}
/* handle menu */
else if (event->type == RIGHTMOUSE &&
event->val == KM_PRESS &&
((event->ctrl + event->alt + event->shift) == 0))
else if ((event->type == RIGHTMOUSE) &&
((event->ctrl + event->alt + event->shift) == 0) &&
(event->val == KM_PRESS))
{
/* RMB has two options now */
if (ui_but_menu(C, but)) {

View File

@@ -1757,7 +1757,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar)
/* XXX hardcoded key warning */
if ((inside || inside_header) && event->val == KM_PRESS) {
if (event->type == AKEY && !ELEM(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
if (event->type == AKEY && ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) {
if (pa->flag & PNL_CLOSEDY) {
if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my))