diff options
author | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-25 07:59:33 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-25 07:59:33 +0300 |
commit | 67525b88d2e51db7ea5e6209b3589ce1c56f4959 (patch) | |
tree | 595211dd6c14c77cebb3b255c465e31896928393 /source/blender/editors/screen | |
parent | 95c7e8aa1384b28a91d65950898d36b0d5a69b59 (diff) |
Cleanup: Use array for BKE cursor functions
Differential Revision: https://developer.blender.org/D12962
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 25 | ||||
-rw-r--r-- | source/blender/editors/screen/screendump.c | 3 |
2 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d017345b523..b9c92c1664d 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1128,8 +1128,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) AREAMAP_FROM_SCREEN(screen), &screen_rect, event->xy[0], event->xy[1]) == NULL)) { /* What area are we now in? */ - ScrArea *area = BKE_screen_find_area_xy( - screen, SPACE_TYPE_ANY, event->xy[0], event->xy[1]); + ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->xy); if (area == sad->sa1) { /* Same area, so possible split. */ @@ -1173,7 +1172,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) /* gesture is large enough? */ if (is_gesture) { /* second area, for join when (sa1 != sa2) */ - sad->sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->xy[0], event->xy[1]); + sad->sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->xy); /* apply sends event */ actionzone_apply(C, op, sad->az->type); actionzone_exit(op); @@ -1241,12 +1240,16 @@ static ScrEdge *screen_area_edge_from_cursor(const bContext *C, int borderwidth = (4 * UI_DPI_FAC); ScrArea *sa1, *sa2; if (screen_geom_edge_is_horizontal(actedge)) { - sa1 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0], cursor[1] + borderwidth); - sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0], cursor[1] - borderwidth); + sa1 = BKE_screen_find_area_xy( + screen, SPACE_TYPE_ANY, (const int[2]){cursor[0], cursor[1] + borderwidth}); + sa2 = BKE_screen_find_area_xy( + screen, SPACE_TYPE_ANY, (const int[2]){cursor[0], cursor[1] - borderwidth}); } else { - sa1 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0] + borderwidth, cursor[1]); - sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0] - borderwidth, cursor[1]); + sa1 = BKE_screen_find_area_xy( + screen, SPACE_TYPE_ANY, (const int[2]){cursor[0] + borderwidth, cursor[1]}); + sa2 = BKE_screen_find_area_xy( + screen, SPACE_TYPE_ANY, (const int[2]){cursor[0] - borderwidth, cursor[1]}); } bool isGlobal = ((sa1 && ED_area_is_global(sa1)) || (sa2 && ED_area_is_global(sa2))); if (!isGlobal) { @@ -1334,8 +1337,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case MOUSEMOVE: /* second area, for join */ - sad->sa2 = BKE_screen_find_area_xy( - CTX_wm_screen(C), SPACE_TYPE_ANY, event->xy[0], event->xy[1]); + sad->sa2 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->xy); break; case LEFTMOUSE: /* release LMB */ if (event->val == KM_RELEASE) { @@ -2508,8 +2510,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) ED_area_tag_redraw(sd->sarea); } /* area context not set */ - sd->sarea = BKE_screen_find_area_xy( - CTX_wm_screen(C), SPACE_TYPE_ANY, event->xy[0], event->xy[1]); + sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->xy); if (sd->sarea) { ScrArea *area = sd->sarea; @@ -3517,7 +3518,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case MOUSEMOVE: { - ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->xy[0], event->xy[1]); + ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->xy); jd->dir = area_getorientation(jd->sa1, jd->sa2); if (area == jd->sa1) { diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index b26291c4d1b..4bc9f1e2565 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -166,8 +166,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (use_crop) { area = CTX_wm_area(C); bScreen *screen = CTX_wm_screen(C); - ScrArea *area_test = BKE_screen_find_area_xy( - screen, SPACE_TYPE_ANY, event->xy[0], event->xy[1]); + ScrArea *area_test = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->xy); if (area_test != NULL) { area = area_test; } |