diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-23 09:43:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-23 09:51:00 +0300 |
commit | be3adb51de21652d64a6839cd5614c5096064c6a (patch) | |
tree | b76f6346673205ed3aeb33a4768bd2a182a4c605 /source/blender/windowmanager | |
parent | 310f288bb03b4197f54b7d7b6d611669f2604d04 (diff) |
UI: ignore events in empty region overlap areas
- Resizable areas use 2D view bounds.
- Header uses the button bounds.
- A margin is added to avoid clicking between buttons.
- Region resize edges clamp to the 2D view bounds.
Resovles T61554
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 46533cd7ef5..76a59944832 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -69,6 +69,7 @@ #include "RNA_access.h" #include "UI_interface.h" +#include "UI_view2d.h" #include "PIL_time.h" @@ -2951,15 +2952,23 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) return action; } -static int wm_event_inside_i(wmEvent *event, rcti *rect) +static bool wm_event_inside_rect(const wmEvent *event, const rcti *rect) { if (wm_event_always_pass(event)) { - return 1; + return true; } if (BLI_rcti_isect_pt_v(rect, &event->x)) { - return 1; + return true; } - return 0; + return false; +} + +static bool wm_event_inside_region(const wmEvent *event, const ARegion *ar) +{ + if (wm_event_always_pass(event)) { + return true; + } + return ED_region_contains_xy(ar, &event->x); } static ScrArea *area_event_inside(bContext *C, const int xy[2]) @@ -3246,12 +3255,13 @@ void wm_event_do_handlers(bContext *C) ED_area_azones_update(sa, &event->x); } - if (wm_event_inside_i(event, &sa->totrct)) { + if (wm_event_inside_rect(event, &sa->totrct)) { CTX_wm_area_set(C, sa); if ((action & WM_HANDLER_BREAK) == 0) { for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (wm_event_inside_i(event, &ar->winrct)) { + if (wm_event_inside_region(event, ar)) { + CTX_wm_region_set(C, ar); /* call even on non mouse events, since the */ |