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:
authorCampbell Barton <ideasman42@gmail.com>2020-08-16 14:21:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-08-16 14:21:20 +0300
commitb0b0d9f2cfb0157a6278c3cef131378f9878edf3 (patch)
tree0dee53f1237b684ece270330d8c3763ab80868ac
parentd5d83b71f75d8f01f3278020147ebd09040558af (diff)
parent59bc71d69b138db12c9017c7a7d492fdb6dcddc3 (diff)
Merge branch 'blender-v2.90-release' into master
-rw-r--r--source/blender/editors/include/ED_screen.h4
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c13
-rw-r--r--source/blender/editors/interface/interface_region_popover.c12
-rw-r--r--source/blender/editors/screen/area.c32
-rw-r--r--source/blender/makesdna/DNA_screen_types.h5
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c3
6 files changed, 12 insertions, 57 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 29fe766b2d0..ad46dada0c9 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -187,11 +187,7 @@ void ED_area_newspace(struct bContext *C, ScrArea *area, int type, const bool sk
void ED_area_prevspace(struct bContext *C, ScrArea *area);
void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2);
int ED_area_headersize(void);
-int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback);
-int ED_area_header_alignment(const ScrArea *area);
int ED_area_footersize(void);
-int ED_area_footer_alignment_or_fallback(const ScrArea *area, int fallback);
-int ED_area_footer_alignment(const ScrArea *area);
int ED_area_global_size_y(const ScrArea *area);
int ED_area_global_min_size_y(const ScrArea *area);
int ED_area_global_max_size_y(const ScrArea *area);
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index 077e8888d53..dbb072fa4a6 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -284,17 +284,10 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
else {
/* for a header menu we set the direction automatic */
if (!pup->slideout && flip) {
- ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
- if (area && region) {
- if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
- if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(area)) == RGN_ALIGN_BOTTOM) {
- UI_block_direction_set(block, UI_DIR_UP);
- UI_block_order_flip(block);
- }
- }
- if (region->regiontype == RGN_TYPE_FOOTER) {
- if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(area)) == RGN_ALIGN_BOTTOM) {
+ if (region) {
+ if (RGN_TYPE_IS_HEADER_ANY(region->regiontype)) {
+ if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_BOTTOM) {
UI_block_direction_set(block, UI_DIR_UP);
UI_block_order_flip(block);
}
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index 0ad7e570e80..18c31dde66f 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -171,7 +171,6 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
}
if (!slideout) {
- ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
if (region && region->panels.first) {
@@ -180,14 +179,9 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
}
/* Prefer popover from header to be positioned into the editor. */
- else if (area && region) {
- if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
- if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(area)) == RGN_ALIGN_BOTTOM) {
- UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
- }
- }
- if (region->regiontype == RGN_TYPE_FOOTER) {
- if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(area)) == RGN_ALIGN_BOTTOM) {
+ else if (region) {
+ if (RGN_TYPE_IS_HEADER_ANY(region->regiontype)) {
+ if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_BOTTOM) {
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
}
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index fc1d467964a..02a1e1fa2f6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -3165,43 +3165,11 @@ int ED_area_headersize(void)
return U.widget_unit + (int)(UI_DPI_FAC * HEADER_PADDING_Y);
}
-int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback)
-{
- LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
- if (region->regiontype == RGN_TYPE_HEADER) {
- return region->alignment;
- }
- }
- return fallback;
-}
-
-int ED_area_header_alignment(const ScrArea *area)
-{
- return ED_area_header_alignment_or_fallback(
- area, (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP);
-}
-
int ED_area_footersize(void)
{
return ED_area_headersize();
}
-int ED_area_footer_alignment_or_fallback(const ScrArea *area, int fallback)
-{
- LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
- if (region->regiontype == RGN_TYPE_FOOTER) {
- return region->alignment;
- }
- }
- return fallback;
-}
-
-int ED_area_footer_alignment(const ScrArea *area)
-{
- return ED_area_footer_alignment_or_fallback(
- area, (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM);
-}
-
/**
* \return the final height of a global \a area, accounting for DPI.
*/
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 60d6f85569c..7ff96c5a908 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -645,6 +645,11 @@ typedef enum eRegionType {
/* Region supports panel tabs (categories). */
#define RGN_TYPE_HAS_CATEGORY_MASK (1 << RGN_TYPE_UI)
+/* Check for any kind of header region. */
+#define RGN_TYPE_IS_HEADER_ANY(regiontype) \
+ (((1 << (regiontype)) & \
+ ((1 << RGN_TYPE_HEADER) | 1 << (RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_FOOTER))) != 0)
+
/** #ARegion.alignment */
enum {
RGN_ALIGN_NONE = 0,
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index bea4faa779a..1b991112f01 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1363,8 +1363,7 @@ static int wm_operator_invoke(bContext *C,
ScrArea *area = CTX_wm_area(C);
/* Wrap only in X for header. */
- if (region &&
- ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER)) {
+ if (region && RGN_TYPE_IS_HEADER_ANY(region->regiontype)) {
wrap = WM_CURSOR_WRAP_X;
}