Commit: 17422124eca332ac81628a197dc49f11616687ea
Author: julianeisel
Date: Wed Jan 21 03:45:00 2015 +0100
Branches: master
https://developer.blender.org/rB17422124eca332ac81628a197dc49f11616687ea
Fix T43247: Don't open pulldown when a popup overlaps it
Auto-opening of pulldown menus didn't take overlapping popups into account.
===================================================================
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/screen/area.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c
b/source/blender/editors/interface/interface_handlers.c
index 1c874a2..5527d37 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -9129,13 +9129,13 @@ static void ui_region_handler_remove(bContext *C, void
*UNUSED(userdata))
ui_apply_but_funcs_after(C);
}
+/* handle buttons at the window level, modal, for example while
+ * number sliding, text editing, or when a menu block is open */
static int ui_handler_region_menu(bContext *C, const wmEvent *event, void
*UNUSED(userdata))
{
ARegion *ar;
uiBut *but;
- /* here we handle buttons at the window level, modal, for example
- * while number sliding, text editing, or when a menu block is open */
ar = CTX_wm_menu(C);
if (!ar)
ar = CTX_wm_region(C);
@@ -9143,13 +9143,32 @@ static int ui_handler_region_menu(bContext *C, const
wmEvent *event, void *UNUSE
but = ui_but_find_active_in_region(ar);
if (but) {
+ bScreen *screen = CTX_wm_screen(C);
+ ARegion *ar_temp;
uiBut *but_other;
uiHandleButtonData *data;
+ bool is_inside_menu = false;
+
+ /* look for a popup menu containing the mouse */
+ for (ar_temp = screen->regionbase.first; ar_temp; ar_temp =
ar_temp->next) {
+ rcti rect = ar_temp->winrct;
+
+ /* resize region rect to ignore shadow */
+ BLI_rcti_resize(&rect,
(BLI_rcti_size_x(&ar_temp->winrct) - UI_ThemeMenuShadowWidth() * 2),
+ (BLI_rcti_size_y(&ar_temp->winrct) -
UI_ThemeMenuShadowWidth() * 2));
+ if (BLI_rcti_isect_pt_v(&rect, &event->x)) {
+ BLI_assert(ar_temp->type->regionid ==
RGN_TYPE_TEMPORARY);
+
+ is_inside_menu = true;
+ break;
+ }
+ }
/* handle activated button events */
data = but->active;
if ((data->state == BUTTON_STATE_MENU_OPEN) &&
+ (is_inside_menu == false) && /* make sure mouse isn't
inside another menu (see T43247) */
(but->type == UI_BTYPE_PULLDOWN) &&
(but_other = ui_but_find_mouse_over(ar, event)) &&
(but != but_other) &&
diff --git a/source/blender/editors/screen/area.c
b/source/blender/editors/screen/area.c
index 71714bd..698d4a4 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2161,4 +2161,3 @@ void ED_region_cache_draw_cached_segments(const ARegion
*ar, const int num_segme
}
}
}
-
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs