Fix #144168: Ignore mouse event when creating search popups

When search popups are created at the bottom of the screen, they are
repositioned to stay within the bounds of the main window. This
can cause the cursor to hover over one of the search results, causing
it to become active.

Since some searches put recently searched items at the top of the
result list, the first search result should always be active by default.

This is achieved by ignoring the mouse event after the creation of
the popup by checking if the mouse has actually moved.

Pull Request: https://projects.blender.org/blender/blender/pulls/144296
This commit is contained in:
Leon Schittek
2025-08-12 17:33:26 +02:00
committed by Leon Schittek
parent ac962c02f6
commit 520eaa76ff

View File

@@ -449,6 +449,14 @@ bool ui_searchbox_event(
}
break;
case MOUSEMOVE: {
/* Ignore the mouse event, in case the search popup is created underneath the cursor.
* We always want the first result to be selected by default. See: #144168 */
if (event->xy[0] == event->prev_xy[0] && event->xy[1] == event->prev_xy[1]) {
ui_searchbox_select(C, region, but, 0);
handled = true;
break;
}
bool is_inside = false;
if (BLI_rcti_isect_pt(&region->winrct, event->xy[0], event->xy[1])) {