2.5
authorTon Roosendaal <ton@blender.org>
Mon, 2 Feb 2009 16:30:03 +0000 (16:30 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 2 Feb 2009 16:30:03 +0000 (16:30 +0000)
Bugfix: mouse key checks should use KM_PRESS checks now.
Interface toggle button didnt work for that reason. :)

source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_panel.c
source/blender/windowmanager/intern/wm_operators.c

index 61ea1b1b8e3dd4ca0ef37f97051654f7c448d196..f2275a18db40009774b6eda4eacfc3db8f0d14cd 100644 (file)
@@ -1239,7 +1239,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
                        retval= WM_UI_HANDLER_BREAK;
                        break;
                case LEFTMOUSE: {
                        retval= WM_UI_HANDLER_BREAK;
                        break;
                case LEFTMOUSE: {
-                       if(event->val) {
+                       if(event->val==KM_PRESS) {
                                mx= event->x;
                                my= event->y;
                                ui_window_to_block(data->region, block, &mx, &my);
                                mx= event->x;
                                my= event->y;
                                ui_window_to_block(data->region, block, &mx, &my);
@@ -1261,7 +1261,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
                }
        }
 
                }
        }
 
-       if(event->val) {
+       if(event->val==KM_PRESS) {
                switch (event->type) {
                        case VKEY:
                        case XKEY:
                switch (event->type) {
                        case VKEY:
                        case XKEY:
@@ -1506,7 +1506,7 @@ static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
 static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
 static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(event->type == LEFTMOUSE && event->val) {
+               if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
                        button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
                        return WM_UI_HANDLER_BREAK;
                }
                        button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -1514,13 +1514,13 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        return WM_UI_HANDLER_BREAK;
                }
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        return WM_UI_HANDLER_BREAK;
                }
-               else if(ELEM(event->type, PADENTER, RETKEY) && event->val) {
+               else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
                        return WM_UI_HANDLER_BREAK;
                }
        }
        else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
                        button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
                        return WM_UI_HANDLER_BREAK;
                }
        }
        else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
-               if(event->type == LEFTMOUSE && event->val==0) {
+               if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
                        if(!(but->flag & UI_SELECT))
                                data->cancel= 1;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        if(!(but->flag & UI_SELECT))
                                data->cancel= 1;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -1534,7 +1534,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
 static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
 static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val) {
+               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
                        return WM_UI_HANDLER_BREAK;
                }
                        button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -1543,7 +1543,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
                if(event->type == MOUSEMOVE)
                        return WM_UI_HANDLER_CONTINUE;
 
                if(event->type == MOUSEMOVE)
                        return WM_UI_HANDLER_CONTINUE;
 
-               if(event->val) {
+               if(event->val==KM_PRESS) {
                        if(WM_key_event_string(event->type)[0])
                                ui_set_but_val(but, event->type);
                        else
                        if(WM_key_event_string(event->type)[0])
                                ui_set_but_val(but, event->type);
                        else
@@ -1559,7 +1559,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
 static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
 static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val) {
+               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
                        return WM_UI_HANDLER_BREAK;
                }
                        button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -1579,7 +1579,7 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
 static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val) {
+               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        data->togdual= event->ctrl;
                        data->togonly= !event->shift;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        data->togdual= event->ctrl;
                        data->togonly= !event->shift;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -1592,7 +1592,7 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
 static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
 static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val) {
+               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        return WM_UI_HANDLER_BREAK;
                }
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -1701,7 +1701,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(event->val) {
+               if(event->val==KM_PRESS) {
                        if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->shift) {
                                button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
                                retval= WM_UI_HANDLER_BREAK;
                        if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->shift) {
                                button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
                                retval= WM_UI_HANDLER_BREAK;
@@ -1712,12 +1712,12 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
                                retval= WM_UI_HANDLER_BREAK;
                        }
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
                                retval= WM_UI_HANDLER_BREAK;
                        }
-                       else if(ELEM(event->type, PADENTER, RETKEY) && event->val)
+                       else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
                                click= 1;
                }
        }
        else if(data->state == BUTTON_STATE_NUM_EDITING) {
                                click= 1;
                }
        }
        else if(data->state == BUTTON_STATE_NUM_EDITING) {
-               if(event->type == LEFTMOUSE && event->val==0) {
+               if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
                        if(data->dragchange)
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        else
                        if(data->dragchange)
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        else
@@ -1886,7 +1886,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val) {
+               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        /* start either dragging as slider, or editing as text */
                        if(mx>= -6+(but->x1+but->x2)/2) {
                                if(event->type == LEFTMOUSE) {
                        /* start either dragging as slider, or editing as text */
                        if(mx>= -6+(but->x1+but->x2)/2) {
                                if(event->type == LEFTMOUSE) {
@@ -1904,7 +1904,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                }
        }
        else if(data->state == BUTTON_STATE_NUM_EDITING) {
                }
        }
        else if(data->state == BUTTON_STATE_NUM_EDITING) {
-               if(event->type == LEFTMOUSE && event->val==0) {
+               if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
                        if(data->dragchange)
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        else
                        if(data->dragchange)
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        else
@@ -1971,7 +1971,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
 static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val) {
+               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
                        return WM_UI_HANDLER_BREAK;
                }
                        button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -2045,7 +2045,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(event->type==LEFTMOUSE && event->val) {
+               if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
                        data->dragstartx= mx;
                        data->dragstarty= my;
                        data->draglastx= mx;
                        data->dragstartx= mx;
                        data->dragstarty= my;
                        data->draglastx= mx;
@@ -2066,7 +2066,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
-               else if(event->type==LEFTMOUSE && event->val==0)
+               else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
 
                return WM_UI_HANDLER_BREAK;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
 
                return WM_UI_HANDLER_BREAK;
@@ -2121,7 +2121,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(event->type==LEFTMOUSE && event->val) {
+               if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
                        data->dragstartx= mx;
                        data->dragstarty= my;
                        data->draglastx= mx;
                        data->dragstartx= mx;
                        data->dragstarty= my;
                        data->draglastx= mx;
@@ -2142,7 +2142,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
-               else if(event->type==LEFTMOUSE && event->val==0)
+               else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                
                return WM_UI_HANDLER_BREAK;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                
                return WM_UI_HANDLER_BREAK;
@@ -2208,7 +2208,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(event->type==LEFTMOUSE && event->val) {
+               if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
                        coba= (ColorBand*)but->poin;
 
                        if(event->ctrl) {
                        coba= (ColorBand*)but->poin;
 
                        if(event->ctrl) {
@@ -2264,7 +2264,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
-               else if(event->type==LEFTMOUSE && event->val==0)
+               else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                
                return WM_UI_HANDLER_BREAK;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                
                return WM_UI_HANDLER_BREAK;
@@ -2354,7 +2354,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(event->type==LEFTMOUSE && event->val) {
+               if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
                        CurveMapping *cumap= (CurveMapping*)but->poin;
                        CurveMap *cuma= cumap->cm+cumap->cur;
                        CurveMapPoint *cmp= cuma->curve;
                        CurveMapping *cumap= (CurveMapping*)but->poin;
                        CurveMap *cuma= cumap->cm+cumap->cur;
                        CurveMapPoint *cmp= cuma->curve;
@@ -2450,7 +2450,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
                                        ui_numedit_apply(C, block, but, data);
                        }
                }
-               else if(event->type==LEFTMOUSE && event->val==0) {
+               else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
                        if(data->dragsel != -1) {
                                CurveMapping *cumap= data->cumap;
                                CurveMap *cuma= cumap->cm+cumap->cur;
                        if(data->dragsel != -1) {
                                CurveMapping *cumap= data->cumap;
                                CurveMap *cuma= cumap->cm+cumap->cur;
@@ -2492,7 +2492,7 @@ static int ui_do_but_CHARTAB(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
        ui_window_to_block(data->region, block, &mx, &my);
 
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val) {
+               if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        /* Calculate the size of the button */
                        width = abs(but->x2 - but->x1);
                        height = abs(but->y2 - but->y1);
                        /* Calculate the size of the button */
                        width = abs(but->x2 - but->x1);
                        height = abs(but->y2 - but->y1);
@@ -2595,7 +2595,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 
        /* handle copy-paste */
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
 
        /* handle copy-paste */
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
-               if(ELEM(event->type, CKEY, VKEY) && event->val && (event->ctrl || event->oskey)) {
+               if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
                        ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v');
                        return WM_UI_HANDLER_BREAK;
                }
                        ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v');
                        return WM_UI_HANDLER_BREAK;
                }
@@ -3334,7 +3334,7 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
                switch(event->type) {
                        /* closing sublevels of pulldowns */
                        case LEFTARROWKEY:
                switch(event->type) {
                        /* closing sublevels of pulldowns */
                        case LEFTARROWKEY:
-                               if(event->val && (block->flag & UI_BLOCK_LOOP))
+                               if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP))
                                        if(BLI_countlist(&block->saferct) > 0)
                                                menu->menuretval= UI_RETURN_OUT;
 
                                        if(BLI_countlist(&block->saferct) > 0)
                                                menu->menuretval= UI_RETURN_OUT;
 
@@ -3343,7 +3343,7 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
 
                        /* opening sublevels of pulldowns */
                        case RIGHTARROWKEY:     
 
                        /* opening sublevels of pulldowns */
                        case RIGHTARROWKEY:     
-                               if(event->val && (block->flag & UI_BLOCK_LOOP)) {
+                               if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
                                        but= ui_but_find_activated(ar);
 
                                        if(!but) {
                                        but= ui_but_find_activated(ar);
 
                                        if(!but) {
@@ -3365,7 +3365,7 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
                        case WHEELDOWNMOUSE:
                                /* arrowkeys: only handle for block_loop blocks */
                                if(inside || (block->flag & UI_BLOCK_LOOP)) {
                        case WHEELDOWNMOUSE:
                                /* arrowkeys: only handle for block_loop blocks */
                                if(inside || (block->flag & UI_BLOCK_LOOP)) {
-                                       if(event->val) {
+                                       if(event->val==KM_PRESS) {
                                                but= ui_but_find_activated(ar);
                                                if(but) {
                                                        if(ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) {
                                                but= ui_but_find_activated(ar);
                                                if(but) {
                                                        if(ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) {
@@ -3457,17 +3457,17 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
                        if(inside==0) {
                                uiSafetyRct *saferct= block->saferct.first;
 
                        if(inside==0) {
                                uiSafetyRct *saferct= block->saferct.first;
 
-                               if(ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val)
+                               if(ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val==KM_PRESS)
                                        if(saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y))
                                                menu->menuretval= UI_RETURN_OK;
                        }
 
                        if(menu->menuretval);
                                        if(saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y))
                                                menu->menuretval= UI_RETURN_OK;
                        }
 
                        if(menu->menuretval);
-                       else if(event->type==ESCKEY && event->val) {
+                       else if(event->type==ESCKEY && event->val==KM_PRESS) {
                                /* esc cancels this and all preceding menus */
                                menu->menuretval= UI_RETURN_CANCEL;
                        }
                                /* esc cancels this and all preceding menus */
                                menu->menuretval= UI_RETURN_CANCEL;
                        }
-                       else if(ELEM(event->type, RETKEY, PADENTER) && event->val) {
+                       else if(ELEM(event->type, RETKEY, PADENTER) && event->val==KM_PRESS) {
                                /* enter will always close this block, but we let the event
                                 * get handled by the button if it is activated */
                                if(!ui_but_find_activated(ar))
                                /* enter will always close this block, but we let the event
                                 * get handled by the button if it is activated */
                                if(!ui_but_find_activated(ar))
index 74cd888df26b8f2b387d8da2cc338fccea16de97..fb12ebcde7d01a98b37673376670df5eaddd02ba 100644 (file)
@@ -1459,7 +1459,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
                                inside_scale= 1;
        }
 
                                inside_scale= 1;
        }
 
-       if(!event->val)
+       if(event->val!=KM_PRESS)
                return retval;
 
        if(event->type == LEFTMOUSE) {
                return retval;
 
        if(event->type == LEFTMOUSE) {
@@ -1513,7 +1513,7 @@ static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
        uiHandlePanelData *data= panel->activedata;
 
        /* verify if we can stop */
        uiHandlePanelData *data= panel->activedata;
 
        /* verify if we can stop */
-       if(event->type == LEFTMOUSE && !event->val) {
+       if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
                panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
                return WM_UI_HANDLER_BREAK;
        }
                panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
                return WM_UI_HANDLER_BREAK;
        }
index 4141851e96c457be5b1ecb8bbf30fcc93487e23d..5c286e06324d29f8963fd77bc246e362ffc868f3 100644 (file)
@@ -771,12 +771,8 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
                                WM_gesture_end(C, gesture);
                                window->tweak= NULL;
                                
                                WM_gesture_end(C, gesture);
                                window->tweak= NULL;
                                
-                               /* when tweak fails we should give the other keymap entries a chance
-                                * those then won't react to km_press, but km_release
-                                * it sets hidden event value where tweak maps fail on, to prevent loops */
+                               /* when tweak fails we should give the other keymap entries a chance */
                                event->val= KM_RELEASE;
                                event->val= KM_RELEASE;
-                               //event->val= 1;
-                               //event->no_tweak= 1;
                        }
                        break;
                default:
                        }
                        break;
                default: