From ea2043eb3a31468d9afeb1d6cc140567e219565f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 15 Jun 2014 01:40:15 +1000 Subject: UI: Add support for popups to refresh their layput (D578) This is needed for popups to chance state once activated, currently it makes use of operators `check` callback, after values are modified, as the file selector does already. --- source/blender/editors/interface/interface_handlers.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/interface/interface_handlers.c') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c2deee4d542..bf8e46b5268 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5516,7 +5516,6 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE); uiPopupBoundsBlock(block, 6, -50, 26); - uiEndBlock(C, block); return block; } @@ -5561,7 +5560,6 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE); uiPopupBoundsBlock(block, 6, -50, 26); - uiEndBlock(C, block); return block; } @@ -7762,6 +7760,8 @@ static int ui_handle_menu_event( sub_v2_v2v2_int(mdiff, &event->x, menu->grab_xy_prev); copy_v2_v2_int(menu->grab_xy_prev, &event->x); + add_v2_v2v2_int(menu->popup_create_vars.event_xy, menu->popup_create_vars.event_xy, mdiff); + ui_popup_translate(C, ar, mdiff); } @@ -8414,10 +8414,13 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata) { uiPopupBlockHandle *menu = userdata; - + struct ARegion *menu_region; /* we block all events, this is modal interaction, except for drop events which is described below */ int retval = WM_UI_HANDLER_BREAK; + menu_region = CTX_wm_menu(C); + CTX_wm_menu_set(C, menu->region); + if (event->type == EVT_DROP) { /* if we're handling drop event we'll want it to be handled by popup callee as well, * so it'll be possible to perform such operations as opening .blend files by dropping @@ -8465,6 +8468,8 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata) /* delayed apply callbacks */ ui_apply_but_funcs_after(C); + CTX_wm_region_set(C, menu_region); + return retval; } -- cgit v1.2.3