UI: Mac Cursors While Docking

With docking enabled, for Mac hovering over the corner actions zones
shows an open hand cursor, while dragging it uses the closed hand
cursor. For other platforms this just uses the "move" cursor.

Pull Request: https://projects.blender.org/blender/blender/pulls/127291
This commit is contained in:
Harley Acheson
2024-09-10 00:55:52 +02:00
committed by Harley Acheson
parent 2859eabd1c
commit 72a0be0944
2 changed files with 21 additions and 5 deletions

View File

@@ -974,7 +974,12 @@ static void screen_cursor_set(wmWindow *win, const int xy[2])
if (area) {
if (az->type == AZONE_AREA) {
WM_cursor_set(win, WM_CURSOR_EDIT);
#if defined(__APPLE__)
const int cursor = U.experimental.use_docking ? WM_CURSOR_HAND : WM_CURSOR_EDIT;
#else
const int cursor = U.experimental.use_docking ? WM_CURSOR_MOVE : WM_CURSOR_EDIT;
#endif
WM_cursor_set(win, cursor);
}
else if (az->type == AZONE_REGION) {
if (ELEM(az->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {

View File

@@ -1207,7 +1207,12 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
else {
WM_cursor_set(win, WM_CURSOR_CROSS);
#if defined(__APPLE__)
const int cursor = U.experimental.use_docking ? WM_CURSOR_HAND_CLOSED : WM_CURSOR_EDIT;
#else
const int cursor = U.experimental.use_docking ? WM_CURSOR_MOVE : WM_CURSOR_EDIT;
#endif
WM_cursor_set(win, cursor);
is_gesture = false;
}
}
@@ -3848,17 +3853,23 @@ static int area_join_cursor(sAreaJoinData *jd, const wmEvent *event)
return WM_CURSOR_STOP;
}
#if defined(__APPLE__)
const int move_cursor = WM_CURSOR_HAND_CLOSED;
#else
const int move_cursor = WM_CURSOR_MOVE;
#endif
if (jd->sa1 && jd->sa1 == jd->sa2 && U.experimental.use_docking) {
if (jd->split_fac >= 0.0001f) {
/* Mouse inside source area, so allow splitting. */
return (jd->split_dir == SCREEN_AXIS_V) ? WM_CURSOR_V_SPLIT : WM_CURSOR_H_SPLIT;
}
return WM_CURSOR_EDIT;
return move_cursor;
}
if (jd->dock_target == AreaDockTarget::None) {
if (U.experimental.use_docking) {
return WM_CURSOR_DEFAULT;
return move_cursor;
}
else {
if (jd->dir == SCREEN_DIR_N) {
@@ -3879,7 +3890,7 @@ static int area_join_cursor(sAreaJoinData *jd, const wmEvent *event)
if (U.experimental.use_docking &&
(jd->dir != SCREEN_DIR_NONE || jd->dock_target != AreaDockTarget::None))
{
return WM_CURSOR_DEFAULT;
return move_cursor;
}
return U.experimental.use_docking ? WM_CURSOR_PICK_AREA : WM_CURSOR_STOP;