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()).
This commit is contained in:
Bastien Montagne 2014-08-24 10:22:03 +02:00
parent 9541f75200
commit 7a026971dc
Notes: blender-bot 2023-02-14 10:10:41 +01:00
Referenced by commit 9b729adb6e, Remove redundant workaround for T41548
Referenced by issue #41548, Menu pulldown button behaves incorrectly on click if menu shadow width is set to 0 in theme prefs
1 changed files with 3 additions and 2 deletions

View File

@ -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)) {