Fix T67008: Missing move handle and flickering in FileBrowser

Fix T67008: Missing move handle and flickering in FileBrowser

Allow split regions (child regions) to contribute to the action zones (azone) of the parent region.
This fixes the issues in file browser and also in the user preferences.

Reviewers: Severin, mont29, campbellbarton

Reviewed By: Severin, mont29, campbellbarton

Subscribers: brecht, campbellbarton

Maniphest Tasks: T67008

Differential Revision: https://developer.blender.org/D5273
This commit is contained in:
Andrea Weikert 2019-08-18 16:34:39 +02:00
parent 454b120f48
commit 38380ddca3
Notes: blender-bot 2024-03-25 12:30:38 +01:00
Referenced by issue #67008, Missing move handle and flickering in FileBrowser
2 changed files with 46 additions and 12 deletions

View File

@ -1052,16 +1052,11 @@ static void region_azones_scrollbars_initialize(ScrArea *sa, ARegion *ar)
}
/* *************************************************************** */
static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *ar, const int alignment)
static void region_azones_add_edge(ScrArea *sa,
ARegion *ar,
const int alignment,
const bool is_fullscreen)
{
const bool is_fullscreen = screen->state == SCREENFULL;
/* Only display tab or icons when the header region is hidden
* (not the tool header - they overlap). */
if (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
return;
}
/* edge code (t b l r) is along which area edge azone will be drawn */
if (alignment == RGN_ALIGN_TOP) {
@ -1077,6 +1072,27 @@ static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *ar, c
region_azone_edge_initialize(sa, ar, AE_RIGHT_TO_TOPLEFT, is_fullscreen);
}
}
static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *ar)
{
const bool is_fullscreen = screen->state == SCREENFULL;
/* Only display tab or icons when the header region is hidden
* (not the tool header - they overlap). */
if (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
return;
}
region_azones_add_edge(sa, ar, RGN_ALIGN_ENUM_FROM_MASK(ar->alignment), is_fullscreen);
/* For a split region also continue the azone edge from the next region if this region is aligned
* with the next */
if ((ar->alignment & RGN_SPLIT_PREV) && ar->prev) {
region_azones_add_edge(
sa, ar, RGN_ALIGN_ENUM_FROM_MASK(ar->prev->alignment), is_fullscreen);
}
if (is_fullscreen) {
fullscreen_azone_initialize(sa, ar);
}
@ -1695,7 +1711,7 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
}
/* Some AZones use View2D data which is only updated in region init, so call that first! */
region_azones_add(screen, area, ar, RGN_ALIGN_ENUM_FROM_MASK(ar->alignment));
region_azones_add(screen, area, ar);
}
ED_area_azones_update(area, &win->eventstate->x);
@ -1766,7 +1782,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
}
/* Some AZones use View2D data which is only updated in region init, so call that first! */
region_azones_add(screen, sa, ar, RGN_ALIGN_ENUM_FROM_MASK(ar->alignment));
region_azones_add(screen, sa, ar);
}
/* Avoid re-initializing tools while resizing the window. */

View File

@ -2458,6 +2458,15 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
return dist;
}
static bool is_split_edge(const int alignment, const AZEdge edge)
{
return ((alignment == RGN_ALIGN_BOTTOM) && (edge == AE_TOP_TO_BOTTOMRIGHT)) ||
((alignment == RGN_ALIGN_TOP) && (edge == AE_BOTTOM_TO_TOPLEFT)) ||
((alignment == RGN_ALIGN_LEFT) && (edge == AE_RIGHT_TO_TOPLEFT)) ||
((alignment == RGN_ALIGN_RIGHT) && (edge == AE_LEFT_TO_TOPRIGHT));
}
static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
sActionzoneData *sad = event->customdata;
@ -2476,7 +2485,16 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event
op->customdata = rmd;
rmd->az = az;
rmd->ar = az->ar;
/* special case for region within region - this allows the scale of
* the parent region if the azone edge is not the edge splitting
* both regions */
if ((az->ar->alignment & RGN_SPLIT_PREV) && az->ar->prev &&
!is_split_edge(RGN_ALIGN_ENUM_FROM_MASK(az->ar->alignment), az->edge)) {
rmd->ar = az->ar->prev;
}
else {
rmd->ar = az->ar;
}
rmd->sa = sad->sa1;
rmd->edge = az->edge;
rmd->origx = event->x;