diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-24 17:51:31 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-24 17:51:31 +0400 |
commit | c1c3d66079adb2e0ea7b7eb9bdb2997f37623591 (patch) | |
tree | 7e5c443db618d598a10306a9efc2d9684ef6c8d3 /source/blender/windowmanager | |
parent | 51014d8e4f45c132433f1319ddfa67419455c670 (diff) |
Fix #29306: Alt+N, Enter In Image View Does closes the dialog without executing.
If enter is pressed outside of any button in menu, generate two menu return values:
- UI_RETURN_CANCEL so button wouldn't be executed
- UI_RETURN_POPUP_OK so callback associated with popup block would be executed
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 0c538865501..26f59189e47 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1072,6 +1072,15 @@ static void wm_operator_ui_popup_cancel(void *userData) MEM_freeN(data); } +static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval) +{ + wmOpPopUp *data= arg; + wmOperator *op= data->op; + + if(op && retval > 0) + WM_operator_call(C, op); +} + int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) { wmOpPopUp *data= MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup"); @@ -1079,7 +1088,7 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) data->width= width; data->height= height; data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */ - uiPupBlockEx(C, wm_operator_ui_create, wm_operator_ui_popup_cancel, data); + uiPupBlockEx(C, wm_operator_ui_create, NULL, wm_operator_ui_popup_cancel, data); return OPERATOR_RUNNING_MODAL; } @@ -1110,7 +1119,7 @@ int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int h data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */ /* op is not executed until popup OK but is clicked */ - uiPupBlockEx(C, wm_block_dialog_create, wm_operator_ui_popup_cancel, data); + uiPupBlockEx(C, wm_block_dialog_create, wm_operator_ui_popup_ok, wm_operator_ui_popup_cancel, data); return OPERATOR_RUNNING_MODAL; } |