diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-21 18:39:34 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-21 18:42:49 +0300 |
commit | 22bd1559e1fb813c959327655790e8916dd250c1 (patch) | |
tree | be8403e4b423874c036ea490c17e396c969c2128 /source | |
parent | c23f33ac9e94d98cc1f593653f0e3abb031ecae0 (diff) |
Fix active region flickering in some cases, now always update before draw.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 18 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index eb8221ac6c9..0f4fb6b8cc3 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -160,7 +160,7 @@ void ED_screen_update_after_scene_change( const struct bScreen *screen, struct Scene *scene_new, struct ViewLayer *view_layer); -void ED_screen_set_active_region(struct bContext *C, const struct wmEvent *event); +void ED_screen_set_active_region(struct bContext *C, const int xy[2]); void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen); void ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable); void ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 6f7d7632a3c..6a27964165d 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -986,14 +986,14 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen) /* *********************************** */ /* case when on area-edge or in azones, or outside window */ -static void screen_cursor_set(wmWindow *win, const wmEvent *event) +static void screen_cursor_set(wmWindow *win, const int xy[2]) { const bScreen *screen = WM_window_get_active_screen(win); AZone *az = NULL; ScrArea *sa; for (sa = screen->areabase.first; sa; sa = sa->next) - if ((az = is_in_area_actionzone(sa, &event->x))) + if ((az = is_in_area_actionzone(sa, xy))) break; if (sa) { @@ -1007,7 +1007,7 @@ static void screen_cursor_set(wmWindow *win, const wmEvent *event) } } else { - ScrEdge *actedge = screen_find_active_scredge(win, screen, event->x, event->y); + ScrEdge *actedge = screen_find_active_scredge(win, screen, xy[0], xy[1]); if (actedge) { if (scredge_is_horizontal(actedge)) @@ -1023,7 +1023,7 @@ static void screen_cursor_set(wmWindow *win, const wmEvent *event) /* called in wm_event_system.c. sets state vars in screen, cursors */ /* event type is mouse move */ -void ED_screen_set_active_region(bContext *C, const wmEvent *event) +void ED_screen_set_active_region(bContext *C, const int xy[2]) { wmWindow *win = CTX_wm_window(C); bScreen *scr = WM_window_get_active_screen(win); @@ -1034,9 +1034,9 @@ void ED_screen_set_active_region(bContext *C, const wmEvent *event) ARegion *old_ar = scr->active_region; ED_screen_areas_iter(win, scr, area_iter) { - if (event->x > area_iter->totrct.xmin && event->x < area_iter->totrct.xmax) { - if (event->y > area_iter->totrct.ymin && event->y < area_iter->totrct.ymax) { - if (is_in_area_actionzone(area_iter, &event->x) == NULL) { + if (xy[0] > area_iter->totrct.xmin && xy[0] < area_iter->totrct.xmax) { + if (xy[1] > area_iter->totrct.ymin && xy[1] < area_iter->totrct.ymax) { + if (is_in_area_actionzone(area_iter, xy) == NULL) { sa = area_iter; break; } @@ -1046,7 +1046,7 @@ void ED_screen_set_active_region(bContext *C, const wmEvent *event) if (sa) { /* make overlap active when mouse over */ for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) { + if (BLI_rcti_isect_pt_v(&ar->winrct, xy)) { scr->active_region = ar; break; } @@ -1079,7 +1079,7 @@ void ED_screen_set_active_region(bContext *C, const wmEvent *event) /* cursors, for time being set always on edges, otherwise aregion doesnt switch */ if (scr->active_region == NULL) { - screen_cursor_set(win, event); + screen_cursor_set(win, xy); } else { /* notifier invokes freeing the buttons... causing a bit too much redraws */ diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 99319e009c8..b3e9eaeec45 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -960,6 +960,7 @@ void wm_draw_update(bContext *C) wm_window_make_drawable(wm, win); /* notifiers for screen redraw */ + ED_screen_set_active_region(C, &win->eventstate->x); ED_screen_ensure_updated(wm, win, screen); int drawmethod = wm_automatic_draw_method(win); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 218f48e9be6..95ead3befdc 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2768,7 +2768,7 @@ void wm_event_do_handlers(bContext *C) /* Note: setting subwin active should be done here, after modal handlers have been done */ if (event->type == MOUSEMOVE) { /* state variables in screen, cursors. Also used in wm_draw.c, fails for modal handlers though */ - ED_screen_set_active_region(C, event); + ED_screen_set_active_region(C, &event->x); /* for regions having custom cursors */ wm_paintcursor_test(C, event); } |