diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-02 03:23:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-02 03:25:04 +0400 |
commit | f61e8857066e7c6f4f4db9f6bda3c379661f0282 (patch) | |
tree | fd98642d04a6138eb3d64f619bc0d9bb42040245 | |
parent | 9f16428cb5f047bf46bc338746a0fa84add6e720 (diff) |
UIL: Dragging popups wasn't updating safe-areas
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 6 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 23 |
3 files changed, 27 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 4c02346d545..dfe4dc07f86 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7736,11 +7736,7 @@ 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); - BLI_rcti_translate(&ar->winrct, UNPACK2(mdiff)); - - ED_region_update_rect(C, ar); - - ED_region_tag_redraw(ar); + ui_popup_translate(C, ar, mdiff); } return retval; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index a38a733a461..3fe6452e56b 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -473,7 +473,9 @@ struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, void ui_tooltip_free(struct bContext *C, struct ARegion *ar); uiBut *ui_popup_menu_memory_get(struct uiBlock *block); -void ui_popup_menu_memory_set(struct uiBlock *block, struct uiBut *but); +void ui_popup_menu_memory_set(uiBlock *block, struct uiBut *but); + +void ui_popup_translate(struct bContext *C, struct ARegion *ar, const int mdiff[2]); float *ui_block_hsv_get(struct uiBlock *block); void ui_popup_block_scrolltest(struct uiBlock *block); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index ce807274815..dd4948cc5a5 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2143,6 +2143,29 @@ void ui_popup_menu_memory_set(uiBlock *block, uiBut *but) ui_popup_menu_memory__internal(block, but); } +/** + * Translate any popup regions (so we can drag them). + */ +void ui_popup_translate(bContext *C, ARegion *ar, const int mdiff[2]) +{ + uiBlock *block; + + BLI_rcti_translate(&ar->winrct, UNPACK2(mdiff)); + + ED_region_update_rect(C, ar); + + ED_region_tag_redraw(ar); + + /* update blocks */ + for (block = ar->uiblocks.first; block; block = block->next) { + uiSafetyRct *saferct; + for (saferct = block->saferct.first; saferct; saferct = saferct->next) { + BLI_rctf_translate(&saferct->parent, UNPACK2(mdiff)); + BLI_rctf_translate(&saferct->safety, UNPACK2(mdiff)); + } + } +} + /******************** Popup Menu with callback or string **********************/ struct uiPopupMenu { |