From 7a026971dc3f9392278898cc28d7051f34e3dd6b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 24 Aug 2014 10:22:03 +0200 Subject: [PATCH] Fix T41548: Menu pulldown button behaves incorrectly on click if menu shadow width is set to 0 in theme prefs. This is more like a workaround actually, we use a fixed 'margin' for height in case of search menus, instead of using shadow width (which gave the bug with low values, and insane margins with big ones). Note root of the issue is that if 'top' margin is too small, the first entry of the search menu gets activated before the 'opening' click is released. This means that button will get the KM_RELEASE event, and immediately quit (see interface_handlers.c:7945, ui_handle_menu_button()). --- source/blender/editors/interface/interface_regions.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 8ad30d05197..1960c77bc95 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1165,8 +1165,9 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) /* widget rect, in region coords */ data->bbox.xmin = width; data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - width; - data->bbox.ymin = width; - data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - width; + /* Do not use shadow width for height, gives insane margin with big shadows, and issue T41548 with small ones */ + data->bbox.ymin = 8 * UI_DPI_FAC; + data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - 8 * UI_DPI_FAC; /* check if button is lower half */ if (but->rect.ymax < BLI_rctf_cent_y(&but->block->rect)) {