[Bf-blender-cvs] [b262fba5e37] blender2.8: Fix T55587: bugs with popovers in collapsed menus, like the timeline header.

Brecht Van Lommel noreply at git.blender.org
Wed Aug 15 16:03:34 CEST 2018


Commit: b262fba5e379b8f9d04af850e30e3e431db2b8c4
Author: Brecht Van Lommel
Date:   Wed Aug 15 15:54:58 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb262fba5e379b8f9d04af850e30e3e431db2b8c4

Fix T55587: bugs with popovers in collapsed menus, like the timeline header.

===================================================================

M	release/scripts/startup/bl_ui/space_time.py
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_region_popover.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py
index 99e5f6b08e5..2d9a48a1852 100644
--- a/release/scripts/startup/bl_ui/space_time.py
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -87,12 +87,16 @@ class TIME_MT_editor_menus(Menu):
     bl_label = ""
 
     def draw(self, context):
-        self.draw_menus(self.layout, context)
+        self.draw_menus(self.layout, context, horizontal=False)
 
     @staticmethod
-    def draw_menus(layout, context):
-        row = layout.row()
-        sub = row.row(align=True)
+    def draw_menus(layout, context, horizontal=True):
+        if horizontal:
+            row = layout.row()
+            sub = row.row(align=True)
+        else:
+            sub = layout
+
         sub.popover(
             panel="TIME_PT_playback",
             text="Playback",
@@ -102,7 +106,9 @@ class TIME_MT_editor_menus(Menu):
             text="Keying",
         )
 
-        sub = row.row(align=True)
+        if horizontal:
+            sub = row.row(align=True)
+
         sub.menu("TIME_MT_view")
         sub.menu("TIME_MT_marker")
 
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ac7ed3d5106..0ba9261c4bd 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8228,7 +8228,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
 
 static void ui_mouse_motion_towards_init_ex(uiPopupBlockHandle *menu, const int xy[2], const bool force)
 {
-	BLI_assert(((uiBlock *)menu->region->uiblocks.first)->flag & UI_BLOCK_MOVEMOUSE_QUIT);
+	BLI_assert(((uiBlock *)menu->region->uiblocks.first)->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER));
 
 	if (!menu->dotowards || force) {
 		menu->dotowards = true;
@@ -8263,7 +8263,7 @@ static bool ui_mouse_motion_towards_check(
 	const float margin = MENU_TOWARDS_MARGIN;
 	rctf rect_px;
 
-	BLI_assert(block->flag & UI_BLOCK_MOVEMOUSE_QUIT);
+	BLI_assert(block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER));
 
 
 	/* annoying fix for [#36269], this is a bit odd but in fact works quite well
@@ -8579,7 +8579,7 @@ static int ui_handle_menu_event(
 #endif
 
 	if (but && button_modal_state(but->active->state)) {
-		if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) {
+		if (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER)) {
 			/* if a button is activated modal, always reset the start mouse
 			 * position of the towards mechanism to avoid loosing focus,
 			 * and don't handle events */
@@ -8593,7 +8593,7 @@ static int ui_handle_menu_event(
 	else {
 		/* for ui_mouse_motion_towards_block */
 		if (event->type == MOUSEMOVE) {
-			if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) {
+			if (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER)) {
 				ui_mouse_motion_towards_init(menu, &event->x);
 			}
 
@@ -8910,7 +8910,8 @@ static int ui_handle_menu_event(
 			else {
 
 				/* check mouse moving outside of the menu */
-				if (inside == 0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
+				//printf("inside %d mm quit %d\n", inside, block->flag & (UI_BLOCK_MOVEMOUSE_QUIT);
+				if (inside == 0 && (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER))) {
 					uiSafetyRct *saferct;
 
 					ui_mouse_motion_towards_check(block, menu, &event->x, is_parent_inside == false);
@@ -9019,7 +9020,7 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
 			submenu->menuretval = 0;
 	}
 
-	if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) {
+	if (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER)) {
 		/* for cases where close does not cascade, allow the user to
 		 * move the mouse back towards the menu without closing */
 		ui_mouse_motion_towards_reinit(menu, &event->x);
@@ -9419,7 +9420,7 @@ static int ui_handle_menus_recursive(
 
 			retval = ui_handle_menu_button(C, event, menu);
 
-			if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) {
+			if (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER)) {
 				/* when there is a active search button and we close it,
 				 * we need to reinit the mouse coords [#35346] */
 				if (ui_but_find_active_in_region(menu->region) != but) {
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index 376e367f4da..56ec61c5226 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -155,7 +155,7 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
 		UI_block_bounds_set_normal(block, block_margin);
 
 		/* If menu slides out of other menu, override direction. */
-		bool slideout = false; //ui_block_is_menu(pup->but->block);
+		bool slideout = ui_block_is_menu(pup->but->block);
 		if (slideout)
 			UI_block_direction_set(block, UI_DIR_RIGHT);



More information about the Bf-blender-cvs mailing list