Fix #127438: Block Drag Cursor Issues

Avoid setting default cursor while number dragging. But always reset
cursor in title area if even there is a button in that space. Decrease
the title height slightly to work with title-less popups.

Pull Request: https://projects.blender.org/blender/blender/pulls/127598
This commit is contained in:
Harley Acheson
2024-09-14 00:07:42 +02:00
committed by Harley Acheson
parent 7b69c82494
commit a5779347b6

View File

@@ -10612,7 +10612,7 @@ static int ui_handle_menu_event(bContext *C,
/* check if mouse is inside block */
const bool inside = BLI_rctf_isect_pt(&block->rect, mx, my);
/* check for title dragging */
const bool inside_title = inside && ((my + (UI_UNIT_Y * 1.5f)) > block->rect.ymax);
const bool inside_title = inside && ((my + (UI_UNIT_Y * 1.4f)) > block->rect.ymax);
/* if there's an active modal button, don't check events or outside, except for search menu */
but = ui_region_find_active_but(region);
@@ -10629,14 +10629,19 @@ static int ui_handle_menu_event(bContext *C,
wmWindow *win = CTX_wm_window(C);
if (!menu->is_grab && is_floating && (!but || but->type == UI_BTYPE_IMAGE)) {
if (event->type == LEFTMOUSE && event->val == KM_PRESS && inside_title) {
/* Initial press before starting to drag. */
WM_cursor_set(win, PopupTitleDragCursor);
if (!menu->is_grab && is_floating) {
if (inside_title && (!but || but->type == UI_BTYPE_IMAGE)) {
if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
/* Initial press before starting to drag. */
WM_cursor_set(win, PopupTitleDragCursor);
}
else if (event->type == MOUSEMOVE && !win->modalcursor) {
/* Hover over draggable area. */
WM_cursor_set(win, PopupTitleHoverCursor);
}
}
else if (event->type == MOUSEMOVE && !win->modalcursor) {
/* Hover over draggable area. */
WM_cursor_set(win, inside_title ? PopupTitleHoverCursor : WM_CURSOR_DEFAULT);
else if (win->cursor == PopupTitleHoverCursor) {
WM_cursor_set(win, WM_CURSOR_DEFAULT);
}
}