diff options
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1e169180d18..b5d7030ef82 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -698,8 +698,8 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) wmWindow *win = CTX_wm_window(C); bScreen *sc = CTX_wm_screen(C); sActionzoneData *sad = op->customdata; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); switch (event->type) { case MOUSEMOVE: @@ -723,7 +723,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) /* 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) && - (screen_find_active_scredge(sc, winsizex, winsizey, event->x, event->y) == NULL)); + (screen_find_active_scredge(sc, winsize_x, winsize_y, event->x, event->y) == NULL)); } else { const int delta_min = 1; @@ -994,7 +994,9 @@ typedef struct sAreaMoveData { /* helper call to move area-edge, sets limits * need window size in order to get correct limits */ -static void area_move_set_limits(bScreen *sc, int dir, int winsizex, int winsizey, int *bigger, int *smaller) +static void area_move_set_limits(bScreen *sc, int dir, + const int winsize_x, const int winsize_y, + int *bigger, int *smaller) { ScrArea *sa; int areaminy = ED_area_headersize(); @@ -1010,7 +1012,7 @@ static void area_move_set_limits(bScreen *sc, int dir, int winsizex, int winsize if (sa->v1->vec.y > 0) areamin += U.pixelsize; - if (sa->v2->vec.y < winsizey - 1) + if (sa->v2->vec.y < winsize_y - 1) areamin += U.pixelsize; y1 = sa->v2->vec.y - sa->v1->vec.y + 1 - areamin; @@ -1027,7 +1029,7 @@ static void area_move_set_limits(bScreen *sc, int dir, int winsizex, int winsize if (sa->v1->vec.x > 0) areamin += U.pixelsize; - if (sa->v4->vec.x < winsizex - 1) + if (sa->v4->vec.x < winsize_x - 1) areamin += U.pixelsize; x1 = sa->v4->vec.x - sa->v1->vec.x + 1 - areamin; @@ -1050,8 +1052,8 @@ static int area_move_init(bContext *C, wmOperator *op) ScrEdge *actedge; sAreaMoveData *md; ScrVert *v1; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); int x, y; /* required properties */ @@ -1059,7 +1061,7 @@ static int area_move_init(bContext *C, wmOperator *op) y = RNA_int_get(op->ptr, "y"); /* setup */ - actedge = screen_find_active_scredge(sc, winsizex, winsizey, x, y); + actedge = screen_find_active_scredge(sc, winsize_x, winsize_y, x, y); if (actedge == NULL) return 0; md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData"); @@ -1074,7 +1076,7 @@ static int area_move_init(bContext *C, wmOperator *op) for (v1 = sc->vertbase.first; v1; v1 = v1->next) v1->editflag = v1->flag; - area_move_set_limits(sc, md->dir, winsizex, winsizey, &md->bigger, &md->smaller); + area_move_set_limits(sc, md->dir, winsize_x, winsize_y, &md->bigger, &md->smaller); return 1; } @@ -1083,6 +1085,8 @@ static int area_move_init(bContext *C, wmOperator *op) static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int bigger, int smaller) { wmWindow *win = CTX_wm_window(C); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); bScreen *sc = CTX_wm_screen(C); ScrVert *v1; ScrArea *sa; @@ -1094,7 +1098,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int for (v1 = sc->vertbase.first; v1; v1 = v1->next) { if (v1->editflag) { /* that way a nice AREAGRID */ - if ((dir == 'v') && v1->vec.x > 0 && v1->vec.x < WM_window_pixels_x(win) - 1) { + if ((dir == 'v') && v1->vec.x > 0 && v1->vec.x < winsize_x - 1) { oldval = v1->vec.x; v1->vec.x = origval + delta; @@ -1105,7 +1109,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int if (oldval != v1->vec.x) doredraw = 1; } - if ((dir == 'h') && v1->vec.y > 0 && v1->vec.y < WM_window_pixels_y(win) - 1) { + if ((dir == 'h') && v1->vec.y > 0 && v1->vec.y < winsize_y - 1) { oldval = v1->vec.y; v1->vec.y = origval + delta; @@ -1450,8 +1454,8 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) wmWindow *win = CTX_wm_window(C); bScreen *sc = CTX_wm_screen(C); sAreaSplitData *sd; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); int dir; /* no full window splitting allowed */ @@ -1504,7 +1508,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) else y = event->x; - actedge = screen_find_active_scredge(sc, winsizex, winsizey, x, y); + actedge = screen_find_active_scredge(sc, winsize_x, winsize_y, x, y); if (actedge == NULL) return OPERATOR_CANCELLED; @@ -1527,7 +1531,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* do the split */ if (area_split_apply(C, op)) { - area_move_set_limits(sc, dir, winsizex, winsizey, &sd->bigger, &sd->smaller); + area_move_set_limits(sc, dir, winsize_x, winsize_y, &sd->bigger, &sd->smaller); /* add temp handler for edge move or cancel */ WM_event_add_modal_handler(C, op); @@ -2621,10 +2625,10 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent uiLayout *layout; PointerRNA ptr1, ptr2; ScrEdge *actedge; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); - actedge = screen_find_active_scredge(sc, winsizex, winsizey, event->x, event->y); + actedge = screen_find_active_scredge(sc, winsize_x, winsize_y, event->x, event->y); if (actedge == NULL) return OPERATOR_CANCELLED; |