Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Wed, 20 Jun 2018 13:40:14 +0000 (15:40 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 20 Jun 2018 13:40:14 +0000 (15:40 +0200)
1  2 
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_intern.h
source/blender/editors/screen/screen_ops.c

@@@ -960,8 -1062,8 +960,8 @@@ static void screen_cursor_set(wmWindow 
        AZone *az = NULL;
        ScrArea *sa;
  
 -      for (sa = win->screen->areabase.first; sa; sa = sa->next)
 -              if ((az = ED_area_actionzone_find_xy(sa, &event->x)))
 +      for (sa = screen->areabase.first; sa; sa = sa->next)
-               if ((az = is_in_area_actionzone(sa, xy)))
++              if ((az = ED_area_actionzone_find_xy(sa, xy)))
                        break;
  
        if (sa) {
  
  /* called in wm_event_system.c. sets state vars in screen, cursors */
  /* event type is mouse move */
 -void ED_screen_set_subwinactive(bContext *C, const wmEvent *event)
 +void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
  {
 -      wmWindow *win = CTX_wm_window(C);
 +      bScreen *scr = WM_window_get_active_screen(win);
  
 -      if (win->screen) {
 -              bScreen *scr = win->screen;
 -              ScrArea *sa;
 +      if (scr) {
 +              ScrArea *sa = NULL;
                ARegion *ar;
 -              int oldswin = scr->subwinactive;
 +              ARegion *old_ar = scr->active_region;
  
 -              for (sa = scr->areabase.first; sa; sa = sa->next) {
 -                      if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
 -                              if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
 -                                      if (NULL == ED_area_actionzone_find_xy(sa, &event->x))
 +              ED_screen_areas_iter(win, scr, area_iter) {
 +                      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) {
++                                      if (ED_area_actionzone_find_xy(area_iter, xy) == NULL) {
 +                                              sa = area_iter;
                                                break;
 +                                      }
 +                              }
 +                      }
                }
                if (sa) {
                        /* make overlap active when mouse over */
@@@ -56,18 -50,18 +56,18 @@@ bScreen    *screen_change_prepare(bScre
  ScrArea    *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
  int         screen_area_join(struct bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2);
  int         area_getorientation(ScrArea *sa, ScrArea *sb);
 -void        select_connected_scredge(bScreen *sc, ScrEdge *edge);
 +void        select_connected_scredge(const wmWindow *win, ScrEdge *edge);
  
 -void        removenotused_scrverts(bScreen *sc);
 -void        removedouble_scrverts(bScreen *sc);
 -void        removedouble_scredges(bScreen *sc);
 -void        removenotused_scredges(bScreen *sc);
  bool        scredge_is_horizontal(ScrEdge *se);
 -ScrEdge    *screen_find_active_scredge(bScreen *sc,
 -                                       const int winsize_x, const int winsize_y,
 -                                       const int mx, const int my);
 +ScrEdge     *screen_area_map_find_active_scredge(
 +        const struct ScrAreaMap *area_map,
 +        const rcti *bounds_rect,
 +        const int mx, const int my);
 +ScrEdge    *screen_find_active_scredge(
 +        const wmWindow *win, const bScreen *screen,
 +        const int mx, const int my);
  
- struct AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]);
+ struct AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]);
  
  /* screen_context.c */
  int ed_screen_context(
@@@ -872,15 -815,10 +872,15 @@@ static int actionzone_modal(bContext *C
                                sad->gesture_dir = 'w';
  
                        if (sad->az->type == AZONE_AREA) {
 +                              const wmWindow *win = CTX_wm_window(C);
 +                              rcti screen_rect;
 +
 +                              WM_window_screen_rect_calc(win, &screen_rect);
                                /* once we drag outside the actionzone, register a gesture
                                 * check we're not on an edge so join finds the other area */
-                               is_gesture = ((is_in_area_actionzone(sad->sa1, &event->x) != sad->az) &&
+                               is_gesture = ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) &&
 -                                            (screen_find_active_scredge(sc, winsize_x, winsize_y, event->x, event->y) == NULL));
 +                                            (screen_area_map_find_active_scredge(
 +                                                 AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL));
                        }
                        else {
                                const int delta_min = 1;