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:
authorJulian Eisel <eiseljulian@gmail.com>2018-07-02 17:48:18 +0300
committerJulian Eisel <eiseljulian@gmail.com>2018-07-02 17:56:54 +0300
commitbea364fe2a37222fc8737afdb508ca81e1b89e68 (patch)
tree3002dbb7be5056b9364d2e34d787e2b776e6aee7 /source/blender/editors/screen
parent878b09562cd5617dea32dbc354ebb484def99f8b (diff)
Fix: Global area edges couldn't call right click menu to join/split
Operators ignored edges along the screen-layout bounds. They should've ignored those along window bounds instead. Although the global areas can not be joined/split, the adjacent areas can. So the menu should still be shown. Had to change the return value of area joining operator, so that an error report can show up when trying to join over a global area edge. Think this is fine to do, but you never know with such stuff. Preferably we'd gray out the "Join Area" item in the menu when clicking on the edge of a global area. Unfotunately the operator uses coordinates passed as operator properties to find the right edge/areas, which we cannot access from the poll callback.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/screen_ops.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index f449272bc72..188592d6129 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1899,7 +1899,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
ScrEdge *actedge;
- rcti screen_rect;
+ rcti window_rect;
int event_co[2];
/* retrieve initial mouse coord, so we can find the active edge */
@@ -1910,10 +1910,10 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
copy_v2_v2_int(event_co, &event->x);
}
- WM_window_screen_rect_calc(win, &screen_rect);
+ WM_window_rect_calc(win, &window_rect);
actedge = screen_geom_area_map_find_active_scredge(
- AREAMAP_FROM_SCREEN(sc), &screen_rect, event_co[0], event_co[1]);
+ AREAMAP_FROM_SCREEN(sc), &window_rect, event_co[0], event_co[1]);
if (actedge == NULL) {
return OPERATOR_CANCELLED;
}
@@ -2894,6 +2894,8 @@ static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata
/* XXX todo: find edge based on (x,y) and set other area? */
static int area_join_init(bContext *C, wmOperator *op)
{
+ const wmWindow *win = CTX_wm_window(C);
+ bScreen *screen = CTX_wm_screen(C);
ScrArea *sa1, *sa2;
sAreaJoinData *jd = NULL;
int x1, y1;
@@ -2906,10 +2908,21 @@ static int area_join_init(bContext *C, wmOperator *op)
x2 = RNA_int_get(op->ptr, "max_x");
y2 = RNA_int_get(op->ptr, "max_y");
- sa1 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, x1, y1);
- sa2 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, x2, y2);
- if (sa1 == NULL || sa2 == NULL || sa1 == sa2)
+ sa1 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, x1, y1);
+ if (sa1 == NULL) {
+ sa1 = BKE_screen_area_map_find_area_xy(&win->global_areas, SPACE_TYPE_ANY, x1, y1);
+ }
+ sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, x2, y2);
+ if (sa2 == NULL) {
+ sa2 = BKE_screen_area_map_find_area_xy(&win->global_areas, SPACE_TYPE_ANY, x2, y2);
+ }
+ if ((sa1 && ED_area_is_global(sa1)) || (sa2 && ED_area_is_global(sa2))) {
+ BKE_report(op->reports, RPT_ERROR, "Global areas (Top Bar, Status Bar) do not support joining");
+ return 0;
+ }
+ else if (sa1 == NULL || sa2 == NULL || sa1 == sa2) {
return 0;
+ }
/* do areas share an edge? */
if (sa1->v1 == sa2->v1 || sa1->v1 == sa2->v2 || sa1->v1 == sa2->v3 || sa1->v1 == sa2->v4) shared++;
@@ -3008,7 +3021,7 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (!area_join_init(C, op))
- return OPERATOR_PASS_THROUGH;
+ return OPERATOR_CANCELLED;
/* add temp handler */
WM_event_add_modal_handler(C, op);
@@ -3141,10 +3154,10 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
uiLayout *layout;
PointerRNA ptr;
ScrEdge *actedge;
- rcti screen_rect;
+ rcti window_rect;
- WM_window_screen_rect_calc(win, &screen_rect);
- actedge = screen_geom_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y);
+ WM_window_rect_calc(win, &window_rect);
+ actedge = screen_geom_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &window_rect, event->x, event->y);
if (actedge == NULL) return OPERATOR_CANCELLED;