Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r--source/blender/editors/screen/screen_ops.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 0c13ac03d1b..2063191658b 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -842,11 +842,8 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
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;
- const int screen_size_x = WM_window_screen_pixels_x(win);
- const int screen_size_y = WM_window_screen_pixels_y(win);
switch (event->type) {
case MOUSEMOVE:
@@ -867,11 +864,15 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
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) &&
(screen_area_map_find_active_scredge(
- AREAMAP_FROM_SCREEN(sc), screen_size_x, screen_size_y, event->x, event->y) == NULL));
+ AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL));
}
else {
const int delta_min = 1;
@@ -1186,10 +1187,10 @@ typedef struct sAreaMoveData {
} sAreaMoveData;
/* helper call to move area-edge, sets limits
- * need window size in order to get correct limits */
+ * need window bounds in order to get correct limits */
static void area_move_set_limits(
wmWindow *win, bScreen *sc, int dir,
- const int winsize_x, const int winsize_y,
+ const rcti *screen_rect,
int *bigger, int *smaller,
bool *use_bigger_smaller_snap)
{
@@ -1242,9 +1243,9 @@ static void area_move_set_limits(
int y1;
areamin = areaminy;
- if (sa->v1->vec.y > 0)
+ if (sa->v1->vec.y > screen_rect->ymin)
areamin += U.pixelsize;
- if (sa->v2->vec.y < winsize_y - 1)
+ if (sa->v2->vec.y < (screen_rect->ymax - 1))
areamin += U.pixelsize;
y1 = sa->v2->vec.y - sa->v1->vec.y + 1 - areamin;
@@ -1259,9 +1260,9 @@ static void area_move_set_limits(
int x1;
areamin = AREAMINX;
- if (sa->v1->vec.x > 0)
+ if (sa->v1->vec.x > screen_rect->xmin)
areamin += U.pixelsize;
- if (sa->v4->vec.x < winsize_x - 1)
+ if (sa->v4->vec.x < (screen_rect->xmax - 1))
areamin += U.pixelsize;
x1 = sa->v4->vec.x - sa->v1->vec.x + 1 - areamin;
@@ -1283,8 +1284,7 @@ static int area_move_init(bContext *C, wmOperator *op)
wmWindow *win = CTX_wm_window(C);
ScrEdge *actedge;
sAreaMoveData *md;
- const int screen_size_x = WM_window_screen_pixels_x(win);
- const int screen_size_y = WM_window_screen_pixels_y(win);
+ rcti screen_rect;
int x, y;
/* required properties */
@@ -1308,8 +1308,10 @@ static int area_move_init(bContext *C, wmOperator *op)
v1->editflag = v1->flag;
}
+ WM_window_screen_rect_calc(win, &screen_rect);
+
bool use_bigger_smaller_snap = false;
- area_move_set_limits(win, sc, md->dir, screen_size_x, screen_size_y,
+ area_move_set_limits(win, sc, md->dir, &screen_rect,
&md->bigger, &md->smaller,
&use_bigger_smaller_snap);
@@ -1772,14 +1774,15 @@ 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;
- const int screen_size_x = WM_window_screen_pixels_x(win);
- const int screen_size_y = WM_window_screen_pixels_y(win);
+ rcti screen_rect;
int dir;
/* no full window splitting allowed */
if (sc->state != SCREENNORMAL)
return OPERATOR_CANCELLED;
-
+
+ WM_window_screen_rect_calc(win, &screen_rect);
+
if (event->type == EVT_ACTIONZONE_AREA) {
sActionzoneData *sad = event->customdata;
@@ -1825,8 +1828,8 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
y = RNA_int_get(op->ptr, "mouse_y");
else
y = event->x;
-
- actedge = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), screen_size_x, screen_size_y, x, y);
+
+ actedge = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, x, y);
if (actedge == NULL)
return OPERATOR_CANCELLED;
@@ -1846,8 +1849,8 @@ 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(win, sc, dir, screen_size_x, screen_size_y, &sd->bigger, &sd->smaller, NULL);
-
+ area_move_set_limits(win, sc, dir, &screen_rect, &sd->bigger, &sd->smaller, NULL);
+
/* add temp handler for edge move or cancel */
WM_event_add_modal_handler(C, op);
@@ -2731,7 +2734,8 @@ static int screen_maximize_area_poll(bContext *C)
const bScreen *screen = CTX_wm_screen(C);
const ScrArea *area = CTX_wm_area(C);
return ED_operator_areaactive(C) &&
- ((screen->state != SCREENNORMAL) || (area->spacetype != SPACE_TOPBAR));
+ /* Don't allow maximizing global areas but allow minimizing from them. */
+ ((screen->state != SCREENNORMAL) || !ED_area_is_global(area));
}
static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
@@ -3047,17 +3051,16 @@ static void SCREEN_OT_area_join(wmOperatorType *ot)
static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- wmWindow *win = CTX_wm_window(C);
- bScreen *sc = CTX_wm_screen(C);
+ const wmWindow *win = CTX_wm_window(C);
+ const bScreen *sc = CTX_wm_screen(C);
uiPopupMenu *pup;
uiLayout *layout;
PointerRNA ptr;
ScrEdge *actedge;
- const int screen_size_x = WM_window_screen_pixels_x(win);
- const int screen_size_y = WM_window_screen_pixels_y(win);
+ rcti screen_rect;
- actedge = screen_area_map_find_active_scredge(
- AREAMAP_FROM_SCREEN(sc), screen_size_x, screen_size_y, event->x, event->y);
+ WM_window_screen_rect_calc(win, &screen_rect);
+ actedge = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y);
if (actedge == NULL) return OPERATOR_CANCELLED;