diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-26 15:31:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-26 15:31:48 +0300 |
commit | b29ad7c91aac1398377000c24a56038a73a3e597 (patch) | |
tree | 960a28d2f9075cb504f63747f8bef41c9e419f9b /source | |
parent | 3bf4610347376d326ac376e62a810e20661f1479 (diff) |
WM: clean up cursors constants and code
There was a mix of old and new constants. Now have one list of WM_CURSOR_*
cursor types, using GHOST standard cursors when available and otherwise falling
back to our custom cursors.
Ref D5197
Diffstat (limited to 'source')
48 files changed, 229 insertions, 233 deletions
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 6274eb549da..616daf94e57 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -1003,7 +1003,7 @@ static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *p pose_slide_refresh(C, pso); /* set cursor to indicate modal */ - WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL); /* header print */ pose_slide_draw_status(pso); diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index fffb62019b4..4c4bac6a249 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -1064,7 +1064,7 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event) cdd->draw_handle_view = ED_region_draw_cb_activate( cdd->vc.ar->type, curve_draw_stroke_3d, op, REGION_DRAW_POST_VIEW); - WM_cursor_modal_set(cdd->vc.win, BC_PAINTBRUSHCURSOR); + WM_cursor_modal_set(cdd->vc.win, WM_CURSOR_PAINT_BRUSH); { View3D *v3d = cdd->vc.v3d; diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c index 1a132c2957a..ecbc503e084 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c @@ -258,9 +258,9 @@ static int gizmo_button2d_test_select(bContext *C, wmGizmo *gz, const int mval[2 static int gizmo_button2d_cursor_get(wmGizmo *gz) { if (RNA_boolean_get(gz->ptr, "show_drag")) { - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; } - return CURSOR_STD; + return WM_CURSOR_DEFAULT; } static void gizmo_button2d_free(wmGizmo *gz) diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c index ba3b8c2602e..ef4fd23b64d 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -752,30 +752,30 @@ static int gizmo_cage2d_get_cursor(wmGizmo *gz) int highlight_part = gz->highlight_part; if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; } switch (highlight_part) { case ED_GIZMO_CAGE2D_PART_TRANSLATE: - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X: case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X: - return CURSOR_X_MOVE; + return WM_CURSOR_X_MOVE; case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y: case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y: - return CURSOR_Y_MOVE; + return WM_CURSOR_Y_MOVE; /* TODO diagonal cursor */ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y: case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y: - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y: case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y: - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; case ED_GIZMO_CAGE2D_PART_ROTATE: - return BC_CROSSCURSOR; + return WM_CURSOR_CROSS; default: - return CURSOR_STD; + return WM_CURSOR_DEFAULT; } } diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c index 406f76bc65e..723be3cfe6b 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c @@ -424,10 +424,10 @@ static void gizmo_cage3d_draw(const bContext *C, wmGizmo *gz) static int gizmo_cage3d_get_cursor(wmGizmo *gz) { if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; } - return CURSOR_STD; + return WM_CURSOR_DEFAULT; } typedef struct RectTransformInteraction { diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c index 37ee95d5058..5342f8695b2 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c @@ -412,7 +412,7 @@ static void gizmo_move_property_update(wmGizmo *gz, wmGizmoProperty *gz_prop) static int gizmo_move_cursor_get(wmGizmo *UNUSED(gz)) { - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; } /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 22f1753a810..f2d039bb47c 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -1560,10 +1560,10 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) static void gpencil_draw_cursor_set(tGPsdata *p) { if (p->paintmode == GP_PAINTMODE_ERASER) { - WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */ + WM_cursor_modal_set(p->win, WM_CURSOR_CROSS); /* XXX need a better cursor */ } else { - WM_cursor_modal_set(p->win, BC_PAINTBRUSHCURSOR); + WM_cursor_modal_set(p->win, WM_CURSOR_PAINT_BRUSH); } } diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 0f76d1421cf..af9cadfb938 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1402,7 +1402,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op) gpsculpt_brush_header_set(C, gso); /* setup cursor drawing */ - // WM_cursor_modal_set(CTX_wm_window(C), BC_CROSSCURSOR); + // WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_CROSS); if (gso->sa->spacetype != SPACE_VIEW3D) { ED_gpencil_toggle_brush_cursor(C, true, NULL); } diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index ea93f861c6e..993ec15248f 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1394,7 +1394,7 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE tgpf->ar->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW); } - WM_cursor_modal_set(CTX_wm_window(C), BC_PAINTBRUSHCURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_PAINT_BRUSH); gpencil_fill_status_indicators(C, tgpf); diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 86de9a75a56..1438c33a972 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -560,7 +560,7 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent tgpi->ar->type, gpencil_interpolate_draw_3d, tgpi, REGION_DRAW_POST_VIEW); /* set cursor to indicate modal */ - WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL); /* update shift indicator in header */ gpencil_interpolate_status_indicators(C, tgpi); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 50da804a911..917c883909c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2551,10 +2551,10 @@ static void gpencil_draw_cursor_set(tGPsdata *p) #if 0 Brush *brush = p->brush; if ((p->paintmode == GP_PAINTMODE_ERASER) || (brush->gpencil_tool == GPAINT_TOOL_ERASE)) { - WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */ + WM_cursor_modal_set(p->win, WM_CURSOR_CROSS); /* XXX need a better cursor */ } else { - WM_cursor_modal_set(p->win, CURSOR_NONE); + WM_cursor_modal_set(p->win, WM_CURSOR_NONE); } #endif } @@ -3565,7 +3565,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* special mode for editing control points */ if (p->paintmode == GP_PAINTMODE_SET_CP) { wmWindow *win = p->win; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); bool drawmode = false; switch (event->type) { diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 8d4c75d2e8c..e5b1a82630b 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -1214,7 +1214,7 @@ static int gpencil_primitive_invoke(bContext *C, wmOperator *op, const wmEvent * op->flag |= OP_IS_MODAL_CURSOR_REGION; /* set cursor to indicate modal */ - WM_cursor_modal_set(win, BC_CROSSCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_CROSS); /* update sindicator in header */ gpencil_primitive_status_indicators(C, tgpi); @@ -1319,18 +1319,18 @@ static void gpencil_primitive_edit_event_handling( if (tgpi->flag == IN_CURVE_EDIT) { if ((a < BIG_SIZE_CTL && tgpi->tot_stored_edges == 0) || b < BIG_SIZE_CTL) { move = MOVE_ENDS; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } else if (tgpi->curve) { move = MOVE_CP; - WM_cursor_modal_set(win, BC_HANDCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_HAND); } else { - WM_cursor_modal_set(win, BC_CROSSCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_CROSS); } } else if (tgpi->flag == IN_PROGRESS) { - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } switch (event->type) { @@ -1402,7 +1402,7 @@ static void gpencil_primitive_edit_event_handling( case EKEY: { if (tgpi->flag == IN_CURVE_EDIT && !ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { tgpi->flag = IN_PROGRESS; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); gpencil_primitive_add_segment(tgpi); copy_v2_v2(tgpi->start, tgpi->end); copy_v2_v2(tgpi->origin, tgpi->start); @@ -1665,7 +1665,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e { if ((event->val == KM_PRESS)) { tgpi->flag = IN_MOVE; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } break; } @@ -1678,7 +1678,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e else { tgpi->flag = IN_BRUSH_SIZE; } - WM_cursor_modal_set(win, BC_NS_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NS_SCROLL); } break; } @@ -1704,7 +1704,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e case TABKEY: { if (tgpi->flag == IN_CURVE_EDIT) { tgpi->flag = IN_PROGRESS; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); gp_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index 00943680419..0cf357c508b 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -290,7 +290,7 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( { /* init */ if (eyedropper_init(C, op)) { - WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_EYEDROPPER); /* add temp handler */ WM_event_add_modal_handler(C, op); diff --git a/source/blender/editors/interface/interface_eyedropper_colorband.c b/source/blender/editors/interface/interface_eyedropper_colorband.c index ffe93e48936..479cf9ccffe 100644 --- a/source/blender/editors/interface/interface_eyedropper_colorband.c +++ b/source/blender/editors/interface/interface_eyedropper_colorband.c @@ -304,7 +304,7 @@ static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEven { /* init */ if (eyedropper_colorband_init(C, op)) { - WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_EYEDROPPER); /* add temp handler */ WM_event_add_modal_handler(C, op); diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c index 336fae45895..fd5a46e7716 100644 --- a/source/blender/editors/interface/interface_eyedropper_datablock.c +++ b/source/blender/editors/interface/interface_eyedropper_datablock.c @@ -314,7 +314,7 @@ static int datadropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED { /* init */ if (datadropper_init(C, op)) { - WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_EYEDROPPER); /* add temp handler */ WM_event_add_modal_handler(C, op); diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c index 2e51701e01d..8a48ca19db2 100644 --- a/source/blender/editors/interface/interface_eyedropper_depth.c +++ b/source/blender/editors/interface/interface_eyedropper_depth.c @@ -311,7 +311,7 @@ static int depthdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE { /* init */ if (depthdropper_init(C, op)) { - WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_EYEDROPPER); /* add temp handler */ WM_event_add_modal_handler(C, op); diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c index e6fc52bc3bc..cc13367c190 100644 --- a/source/blender/editors/interface/interface_eyedropper_driver.c +++ b/source/blender/editors/interface/interface_eyedropper_driver.c @@ -180,7 +180,7 @@ static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS { /* init */ if (driverdropper_init(C, op)) { - WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_EYEDROPPER); /* add temp handler */ WM_event_add_modal_handler(C, op); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6b77a53d5d3..e0442ebcca2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3258,7 +3258,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) ui_but_update(but); - WM_cursor_modal_set(win, BC_TEXTEDITCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_TEXT_EDIT); #ifdef WITH_INPUT_IME if (is_num_but == false && BLT_lang_is_ime_supported()) { @@ -4685,7 +4685,7 @@ static void ui_numedit_set_active(uiBut *but) } else { if (data->changed_cursor == false) { - WM_cursor_modal_set(data->window, CURSOR_X_MOVE); + WM_cursor_modal_set(data->window, WM_CURSOR_X_MOVE); data->changed_cursor = true; } } @@ -7564,7 +7564,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA if (but->type == UI_BTYPE_GRIP) { const bool horizontal = (BLI_rctf_size_x(&but->rect) < BLI_rctf_size_y(&but->rect)); - WM_cursor_modal_set(data->window, horizontal ? CURSOR_X_MOVE : CURSOR_Y_MOVE); + WM_cursor_modal_set(data->window, horizontal ? WM_CURSOR_X_MOVE : WM_CURSOR_Y_MOVE); } else if (but->type == UI_BTYPE_NUM) { ui_numedit_set_active(but); diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 2073117d51c..63dee77e90e 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -765,7 +765,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, UI_but_tooltip_timer_remove(C, activebut); } /* standard cursor by default */ - WM_cursor_set(window, CURSOR_STD); + WM_cursor_set(window, WM_CURSOR_DEFAULT); /* create handle */ handle = MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle"); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 032fb7e4cc2..5cf7cb4e7c4 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -256,13 +256,13 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event) RNA_int_set(op->ptr, "deltay", 0); if (v2d->keepofs & V2D_LOCKOFS_X) { - WM_cursor_modal_set(window, BC_NS_SCROLLCURSOR); + WM_cursor_modal_set(window, WM_CURSOR_NS_SCROLL); } else if (v2d->keepofs & V2D_LOCKOFS_Y) { - WM_cursor_modal_set(window, BC_EW_SCROLLCURSOR); + WM_cursor_modal_set(window, WM_CURSOR_EW_SCROLL); } else { - WM_cursor_modal_set(window, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(window, WM_CURSOR_NSEW_SCROLL); } /* add temp handler */ @@ -1113,13 +1113,13 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even } if (v2d->keepofs & V2D_LOCKOFS_X) { - WM_cursor_modal_set(window, BC_NS_SCROLLCURSOR); + WM_cursor_modal_set(window, WM_CURSOR_NS_SCROLL); } else if (v2d->keepofs & V2D_LOCKOFS_Y) { - WM_cursor_modal_set(window, BC_EW_SCROLLCURSOR); + WM_cursor_modal_set(window, WM_CURSOR_EW_SCROLL); } else { - WM_cursor_modal_set(window, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(window, WM_CURSOR_NSEW_SCROLL); } /* add temp handler */ diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 283e147b77b..4a511bbb5a2 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -455,7 +455,7 @@ void MESH_OT_bisect(struct wmOperatorType *ot) 0.00001, 0.1); - WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT); + WM_operator_properties_gesture_straightline(ot, WM_CURSOR_EDIT); #ifdef USE_GIZMO WM_gizmogrouptype_append(MESH_GGT_bisect); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index db97da9c84f..395c614f328 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2777,7 +2777,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event) op->flag |= OP_IS_MODAL_CURSOR_REGION; /* add a modal handler for this operator - handles loop selection */ - WM_cursor_modal_set(CTX_wm_window(C), BC_KNIFECURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_KNIFE); WM_event_add_modal_handler(C, op); knifetool_update_mval_i(kcd, event->mval); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index e5023068100..b97857ab7b9 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3871,8 +3871,15 @@ void MESH_OT_knife_cut(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", knife_items, KNIFE_EXACT, "Type", ""); /* internal */ - RNA_def_int( - ot->srna, "cursor", BC_KNIFECURSOR, 0, BC_NUMCURSORS, "Cursor", "", 0, BC_NUMCURSORS); + RNA_def_int(ot->srna, + "cursor", + WM_CURSOR_KNIFE, + 0, + WM_CURSOR_NUM, + "Cursor", + "", + 0, + WM_CURSOR_NUM); } /** \} */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index e28a03c26b7..32b5c6ba6d4 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1826,7 +1826,7 @@ void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *ar) if (WM_cursor_set_from_tool(win, sa, ar)) { return; } - WM_cursor_set(win, CURSOR_STD); + WM_cursor_set(win, WM_CURSOR_DEFAULT); } } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 2f5cc1c5191..c8008fe3cc7 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -644,14 +644,14 @@ static void screen_cursor_set(wmWindow *win, const int xy[2]) if (sa) { if (az->type == AZONE_AREA) { - WM_cursor_set(win, CURSOR_EDIT); + WM_cursor_set(win, WM_CURSOR_EDIT); } else if (az->type == AZONE_REGION) { if (az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT) { - WM_cursor_set(win, CURSOR_X_MOVE); + WM_cursor_set(win, WM_CURSOR_X_MOVE); } else { - WM_cursor_set(win, CURSOR_Y_MOVE); + WM_cursor_set(win, WM_CURSOR_Y_MOVE); } } } @@ -660,14 +660,14 @@ static void screen_cursor_set(wmWindow *win, const int xy[2]) if (actedge) { if (screen_geom_edge_is_horizontal(actedge)) { - WM_cursor_set(win, CURSOR_Y_MOVE); + WM_cursor_set(win, WM_CURSOR_Y_MOVE); } else { - WM_cursor_set(win, CURSOR_X_MOVE); + WM_cursor_set(win, WM_CURSOR_X_MOVE); } } else { - WM_cursor_set(win, CURSOR_STD); + WM_cursor_set(win, WM_CURSOR_DEFAULT); } } } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 4150b270262..a4665609353 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1041,28 +1041,28 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) if (BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y) == sad->sa1) { /* Same area, so possible split. */ WM_cursor_set( - win, (ELEM(sad->gesture_dir, 'n', 's')) ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR); + win, (ELEM(sad->gesture_dir, 'n', 's')) ? WM_CURSOR_V_SPLIT : WM_CURSOR_H_SPLIT); is_gesture = (delta_max > split_threshold); } else { /* Different area, so possible join. */ if (sad->gesture_dir == 'n') { - WM_cursor_set(win, BC_N_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_N_ARROW); } else if (sad->gesture_dir == 's') { - WM_cursor_set(win, BC_S_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_S_ARROW); } else if (sad->gesture_dir == 'e') { - WM_cursor_set(win, BC_E_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_E_ARROW); } else { - WM_cursor_set(win, BC_W_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_W_ARROW); } is_gesture = (delta_max > join_threshold); } } else { - WM_cursor_set(CTX_wm_window(C), BC_CROSSCURSOR); + WM_cursor_set(CTX_wm_window(C), WM_CURSOR_CROSS); is_gesture = false; } } @@ -1227,7 +1227,7 @@ static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event) } /* add modal handler */ - WM_cursor_modal_set(CTX_wm_window(C), BC_SWAPAREA_CURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_SWAP_AREA); WM_event_add_modal_handler(C, op); return OPERATOR_RUNNING_MODAL; @@ -2119,7 +2119,7 @@ static void area_split_preview_update_cursor(bContext *C, wmOperator *op) { wmWindow *win = CTX_wm_window(C); int dir = RNA_enum_get(op->ptr, "direction"); - WM_cursor_set(win, (dir == 'n' || dir == 's') ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR); + WM_cursor_set(win, (dir == 'n' || dir == 's') ? WM_CURSOR_V_SPLIT : WM_CURSOR_H_SPLIT); } /* UI callback, adds new handler */ @@ -3418,19 +3418,19 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) } if (dir == 1) { - WM_cursor_set(win, BC_N_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_N_ARROW); } else if (dir == 3) { - WM_cursor_set(win, BC_S_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_S_ARROW); } else if (dir == 2) { - WM_cursor_set(win, BC_E_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_E_ARROW); } else if (dir == 0) { - WM_cursor_set(win, BC_W_ARROWCURSOR); + WM_cursor_set(win, WM_CURSOR_W_ARROW); } else { - WM_cursor_set(win, BC_STOPCURSOR); + WM_cursor_set(win, WM_CURSOR_STOP); } break; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index e30e1c7df72..df3d4b115cc 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1367,10 +1367,10 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* Update WM mouse cursor, disable when the 3D brush cursor is enabled */ if (sd->paint.brush->overlay_flags & BRUSH_OVERLAY_CURSOR) { - WM_cursor_set(win, CURSOR_STD); + WM_cursor_set(win, WM_CURSOR_DEFAULT); } else { - WM_cursor_set(win, CURSOR_EDIT); + WM_cursor_set(win, WM_CURSOR_EDIT); } if (!ups->stroke_active) { diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 2ed1d5d1af7..e066e101410 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1023,7 +1023,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event !RNA_boolean_get(op->ptr, "merged"); paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false); - WM_cursor_modal_set(win, BC_EYEDROPPER_CURSOR); + WM_cursor_modal_set(win, WM_CURSOR_EYEDROPPER); WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 934aeeaf698..f0fe2d4ebdc 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -882,7 +882,7 @@ void PAINT_OT_weight_gradient(wmOperatorType *ot) prop = RNA_def_enum(ot->srna, "type", gradient_types, 0, "Type", ""); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT); + WM_operator_properties_gesture_straightline(ot, WM_CURSOR_EDIT); } /** \} */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c07fa1d894d..73461851111 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -7803,7 +7803,7 @@ static int sculpt_sample_detail_size_exec(bContext *C, wmOperator *op) static int sculpt_sample_detail_size_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e)) { ED_workspace_status_text(C, TIP_("Click on the mesh to set the detail")); - WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR); + WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_EYEDROPPER); WM_event_add_modal_handler(C, op); return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index da534cf9b40..e6c5195d64a 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -376,7 +376,7 @@ static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event) /* Grab will be set when running from gizmo. */ vpd->own_cursor = (win->grabcursor == 0); if (vpd->own_cursor) { - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } vpd->x = event->x; @@ -549,7 +549,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event) /* Grab will be set when running from gizmo. */ vpd->own_cursor = (win->grabcursor == 0); if (vpd->own_cursor) { - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } if (U.viewzoom == USER_ZOOM_CONT) { diff --git a/source/blender/editors/space_clip/tracking_ops_utils.c b/source/blender/editors/space_clip/tracking_ops_utils.c index 3970f1381bf..7579c9a49c6 100644 --- a/source/blender/editors/space_clip/tracking_ops_utils.c +++ b/source/blender/editors/space_clip/tracking_ops_utils.c @@ -57,11 +57,11 @@ void clip_tracking_clear_invisible_track_selection(SpaceClip *sc, MovieClip *cli void clip_tracking_hide_cursor(bContext *C) { wmWindow *win = CTX_wm_window(C); - WM_cursor_set(win, CURSOR_NONE); + WM_cursor_set(win, WM_CURSOR_NONE); } void clip_tracking_show_cursor(bContext *C) { wmWindow *win = CTX_wm_window(C); - WM_cursor_set(win, CURSOR_STD); + WM_cursor_set(win, WM_CURSOR_DEFAULT); } diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index f5c02dbd724..5cc2f00413a 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -149,11 +149,11 @@ static void console_main_region_init(wmWindowManager *wm, ARegion *ar) static void console_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) { SpaceText *st = sa->spacedata.first; - int wmcursor = BC_TEXTEDITCURSOR; + int wmcursor = WM_CURSOR_TEXT_EDIT; if (st->text && BLI_rcti_isect_pt(&st->txtbar, win->eventstate->x - ar->winrct.xmin, st->txtbar.ymin)) { - wmcursor = CURSOR_STD; + wmcursor = WM_CURSOR_DEFAULT; } WM_cursor_set(win, wmcursor); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c2c499e3cc1..4f958d9d1c5 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -300,7 +300,7 @@ static void image_view_pan_init(bContext *C, wmOperator *op, const wmEvent *even /* Grab will be set when running from gizmo. */ vpd->own_cursor = (win->grabcursor == 0); if (vpd->own_cursor) { - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } vpd->x = event->x; @@ -453,7 +453,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve /* Grab will be set when running from gizmo. */ vpd->own_cursor = (win->grabcursor == 0); if (vpd->own_cursor) { - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } vpd->origx = event->x; @@ -3421,7 +3421,7 @@ void IMAGE_OT_sample_line(wmOperatorType *ot) /* flags */ ot->flag = 0; /* no undo/register since this operates on the space */ - WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT); + WM_operator_properties_gesture_straightline(ot, WM_CURSOR_EDIT); } /******************** set curve point operator ********************/ diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 01a30f677a3..664349b3c3b 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -309,7 +309,7 @@ void NODE_OT_add_reroute(wmOperatorType *ot) prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); /* internal */ - RNA_def_int(ot->srna, "cursor", BC_CROSSCURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); + RNA_def_int(ot->srna, "cursor", WM_CURSOR_CROSS, 0, INT_MAX, "Cursor", "", 0, INT_MAX); } /* ****************** Add File Node Operator ******************* */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 770e6dd2a9e..2081c69a1a4 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1456,16 +1456,16 @@ static void node_draw_hidden(const bContext *C, int node_get_resize_cursor(int directions) { if (directions == 0) { - return CURSOR_STD; + return WM_CURSOR_DEFAULT; } else if ((directions & ~(NODE_RESIZE_TOP | NODE_RESIZE_BOTTOM)) == 0) { - return CURSOR_Y_MOVE; + return WM_CURSOR_Y_MOVE; } else if ((directions & ~(NODE_RESIZE_RIGHT | NODE_RESIZE_LEFT)) == 0) { - return CURSOR_X_MOVE; + return WM_CURSOR_X_MOVE; } else { - return CURSOR_EDIT; + return WM_CURSOR_EDIT; } } @@ -1474,7 +1474,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode, float cursor[2]) bNodeTree *ntree = snode->edittree; bNode *node; bNodeSocket *sock; - int wmcursor = CURSOR_STD; + int wmcursor = WM_CURSOR_DEFAULT; if (ntree) { if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_IN | SOCK_OUT)) { diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index eef3f85319c..357ef31c51f 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -1103,7 +1103,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); /* internal */ - RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); + RNA_def_int(ot->srna, "cursor", WM_CURSOR_KNIFE, 0, INT_MAX, "Cursor", "", 0, INT_MAX); } /* ********************** Detach links operator ***************** */ diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 9f39313b9ab..088f06e9da8 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -311,11 +311,11 @@ static void text_main_region_draw(const bContext *C, ARegion *ar) static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) { SpaceText *st = sa->spacedata.first; - int wmcursor = BC_TEXTEDITCURSOR; + int wmcursor = WM_CURSOR_TEXT_EDIT; if (st->text && BLI_rcti_isect_pt(&st->txtbar, win->eventstate->x - ar->winrct.xmin, st->txtbar.ymin)) { - wmcursor = CURSOR_STD; + wmcursor = WM_CURSOR_DEFAULT; } WM_cursor_set(win, wmcursor); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index f5963684395..fbb6dfb8f8f 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1042,10 +1042,10 @@ static void view3d_main_region_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) ViewLayer *view_layer = WM_window_get_active_view_layer(win); Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); if (obedit) { - WM_cursor_set(win, CURSOR_EDIT); + WM_cursor_set(win, WM_CURSOR_EDIT); } else { - WM_cursor_set(win, CURSOR_STD); + WM_cursor_set(win, WM_CURSOR_DEFAULT); } } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index b5b924c7f4a..d6d3a3dc563 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -518,9 +518,9 @@ static int gizmo_axis_test_select(bContext *UNUSED(C), wmGizmo *gz, const int mv static int gizmo_axis_cursor_get(wmGizmo *gz) { if (gz->highlight_part > 0) { - return CURSOR_EDIT; + return WM_CURSOR_EDIT; } - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; } void VIEW3D_GT_navigate_rotate(wmGizmoType *gzt) diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index 2189191ad53..5625333d837 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -1013,9 +1013,9 @@ static void gizmo_ruler_exit(bContext *C, wmGizmo *gz, const bool cancel) static int gizmo_ruler_cursor_get(wmGizmo *gz) { if (gz->highlight_part == PART_LINE) { - return BC_CROSSCURSOR; + return WM_CURSOR_CROSS; } - return BC_NSEW_SCROLLCURSOR; + return WM_CURSOR_NSEW_SCROLL; } void VIEW3D_GT_ruler_item(wmGizmoType *gzt) diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 91c05f5cac6..ac9ad30d719 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -577,7 +577,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) walk->ar->winrct.ymin + walk->center_mval[1]); /* remove the mouse cursor temporarily */ - WM_cursor_modal_set(win, CURSOR_NONE); + WM_cursor_modal_set(win, WM_CURSOR_NONE); return 1; } diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index e771fe43bd8..2821277ffa0 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -389,7 +389,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) /* INPUT_VECTOR, INPUT_CUSTOM_RATIO, INPUT_CUSTOM_RATIO_FLIP */ if (t->flag & T_MODAL) { t->flag |= T_MODAL_CURSOR_SET; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } break; case HLP_SPRING: @@ -400,7 +400,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) case HLP_CARROW: if (t->flag & T_MODAL) { t->flag |= T_MODAL_CURSOR_SET; - WM_cursor_modal_set(win, CURSOR_NONE); + WM_cursor_modal_set(win, WM_CURSOR_NONE); } break; default: diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index b705f98a3de..1e8b561f396 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -43,22 +43,22 @@ /* confusingm 2 enums mixed up here */ const EnumPropertyItem rna_enum_window_cursor_items[] = { - {CURSOR_STD, "DEFAULT", 0, "Default", ""}, - {CURSOR_NONE, "NONE", 0, "None", ""}, - {CURSOR_WAIT, "WAIT", 0, "Wait", ""}, - {CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""}, - {CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""}, - {CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""}, + {WM_CURSOR_DEFAULT, "DEFAULT", 0, "Default", ""}, + {WM_CURSOR_NONE, "NONE", 0, "None", ""}, + {WM_CURSOR_WAIT, "WAIT", 0, "Wait", ""}, + {WM_CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""}, + {WM_CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""}, + {WM_CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""}, /* new */ - {BC_KNIFECURSOR, "KNIFE", 0, "Knife", ""}, - {BC_TEXTEDITCURSOR, "TEXT", 0, "Text", ""}, - {BC_PAINTBRUSHCURSOR, "PAINT_BRUSH", 0, "Paint Brush", ""}, - {BC_HANDCURSOR, "HAND", 0, "Hand", ""}, - {BC_EW_SCROLLCURSOR, "SCROLL_X", 0, "Scroll-X", ""}, - {BC_NS_SCROLLCURSOR, "SCROLL_Y", 0, "Scroll-Y", ""}, - {BC_NSEW_SCROLLCURSOR, "SCROLL_XY", 0, "Scroll-XY", ""}, - {BC_EYEDROPPER_CURSOR, "EYEDROPPER", 0, "Eyedropper", ""}, + {WM_CURSOR_KNIFE, "KNIFE", 0, "Knife", ""}, + {WM_CURSOR_TEXT_EDIT, "TEXT", 0, "Text", ""}, + {WM_CURSOR_PAINT_BRUSH, "PAINT_BRUSH", 0, "Paint Brush", ""}, + {WM_CURSOR_HAND, "HAND", 0, "Hand", ""}, + {WM_CURSOR_EW_SCROLL, "SCROLL_X", 0, "Scroll-X", ""}, + {WM_CURSOR_NS_SCROLL, "SCROLL_Y", 0, "Scroll-Y", ""}, + {WM_CURSOR_NSEW_SCROLL, "SCROLL_XY", 0, "Scroll-XY", ""}, + {WM_CURSOR_EYEDROPPER, "EYEDROPPER", 0, "Eyedropper", ""}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 2313383fe6e..7e98db528ea 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -45,35 +45,24 @@ #include "wm_cursors.h" #include "wm_window.h" -/* XXX this still is mess from old code */ - -/* Some simple ghost <-> blender conversions */ -static GHOST_TStandardCursor convert_cursor(int curs) +/* Blender cursor to GHOST standard cursor conversion. */ +static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs) { switch (curs) { - default: - case CURSOR_STD: + case WM_CURSOR_DEFAULT: return GHOST_kStandardCursorDefault; - case CURSOR_FACESEL: - return GHOST_kStandardCursorRightArrow; - case CURSOR_WAIT: + case WM_CURSOR_WAIT: return GHOST_kStandardCursorWait; - case CURSOR_EDIT: + case WM_CURSOR_EDIT: return GHOST_kStandardCursorCrosshair; - case CURSOR_HELP: -#ifdef __APPLE__ + case WM_CURSOR_X_MOVE: return GHOST_kStandardCursorLeftRight; -#else - return GHOST_kStandardCursorHelp; -#endif - case CURSOR_X_MOVE: - return GHOST_kStandardCursorLeftRight; - case CURSOR_Y_MOVE: + case WM_CURSOR_Y_MOVE: return GHOST_kStandardCursorUpDown; - case CURSOR_PENCIL: - return GHOST_kStandardCursorPencil; - case CURSOR_COPY: + case WM_CURSOR_COPY: return GHOST_kStandardCursorCopy; + default: + return GHOST_kStandardCursorCustom; } } @@ -87,9 +76,9 @@ static void window_set_custom_cursor(wmWindow *win, win->ghostwin, (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotx, hoty, true); } -static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig) +static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor) { - if (useBig) { + if (U.curssize && cursor->big_bm) { GHOST_SetCustomCursorShape(win->ghostwin, (GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask, @@ -112,16 +101,15 @@ static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useB } /* Cursor Globals */ -static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs */ +static BCursor *BlenderCursor[WM_CURSOR_NUM] = {0}; void WM_cursor_set(wmWindow *win, int curs) { - if (win == NULL || G.background) { return; /* Can't set custom cursor before Window init */ } - if (curs == CURSOR_NONE) { + if (curs == WM_CURSOR_NONE) { GHOST_SetCursorVisibility(win->ghostwin, 0); return; } @@ -129,42 +117,46 @@ void WM_cursor_set(wmWindow *win, int curs) #ifdef _WIN32 /* the default win32 cross cursor is barely visible, * only 1 pixel thick, use another one instead */ - if (curs == CURSOR_EDIT) { - curs = BC_CROSSCURSOR; + if (curs == WM_CURSOR_EDIT) { + curs = WM_CURSOR_CROSS; } #else /* in case of large cursor, also use custom cursor because * large cursors don't work for system cursors */ - if (U.curssize && curs == CURSOR_EDIT) { - curs = BC_CROSSCURSOR; + if (U.curssize && curs == WM_CURSOR_EDIT) { + curs = WM_CURSOR_CROSS; } #endif GHOST_SetCursorVisibility(win->ghostwin, 1); - if (curs == CURSOR_STD && win->modalcursor) { + if (curs == WM_CURSOR_DEFAULT && win->modalcursor) { curs = win->modalcursor; } win->cursor = curs; - /* detect if we use system cursor or Blender cursor */ - if (curs >= BC_GHOST_CURSORS) { - GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs)); + if (curs < 0 || curs >= WM_CURSOR_NUM) { + BLI_assert(!"Invalid cursor number"); + return; } - else { - if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) { - return; - } - if (curs == SYSCURSOR) { /* System default Cursor */ - GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD)); - } - else if ((U.curssize == 0) || (BlenderCursor[curs]->big_bm == NULL)) { - window_set_custom_cursor_ex(win, BlenderCursor[curs], 0); + GHOST_TStandardCursor ghost_cursor = convert_to_ghost_standard_cursor(curs); + + if (ghost_cursor != GHOST_kStandardCursorCustom && + GHOST_HasCursorShape(win->ghostwin, ghost_cursor)) { + /* Use native GHOST cursor when available. */ + GHOST_SetCursorShape(win->ghostwin, ghost_cursor); + } + else { + BCursor *bcursor = BlenderCursor[curs]; + if (bcursor) { + /* Use custom bitmap cursor. */ + window_set_custom_cursor_ex(win, bcursor); } else { - window_set_custom_cursor_ex(win, BlenderCursor[curs], 1); + /* Fallback to default cursor if no bitmap found. */ + GHOST_SetCursorShape(win->ghostwin, GHOST_kStandardCursorDefault); } } } @@ -176,7 +168,7 @@ bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const AReg } bToolRef_Runtime *tref_rt = (sa && sa->runtime.tool) ? sa->runtime.tool->runtime : NULL; - if (tref_rt && tref_rt->cursor != CURSOR_STD) { + if (tref_rt && tref_rt->cursor != WM_CURSOR_DEFAULT) { if (win->modalcursor == 0) { WM_cursor_set(win, tref_rt->cursor); win->cursor = tref_rt->cursor; @@ -213,7 +205,7 @@ void WM_cursor_wait(bool val) for (; win; win = win->next) { if (val) { - WM_cursor_modal_set(win, BC_WAITCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_WAIT); } else { WM_cursor_modal_restore(win); @@ -440,7 +432,9 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_NW_ARROWCURSOR] = &NWArrowCursor; + BlenderCursor[WM_CURSOR_DEFAULT] = &NWArrowCursor; + BlenderCursor[WM_CURSOR_COPY] = &NWArrowCursor; + BlenderCursor[WM_CURSOR_NW_ARROW] = &NWArrowCursor; END_CURSOR_BLOCK; ///********************** NS_ARROW Cursor *************************/ @@ -476,7 +470,8 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor; + BlenderCursor[WM_CURSOR_Y_MOVE] = &NSArrowCursor; + BlenderCursor[WM_CURSOR_NS_ARROW] = &NSArrowCursor; END_CURSOR_BLOCK; /********************** EW_ARROW Cursor *************************/ @@ -512,7 +507,8 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_EW_ARROWCURSOR] = &EWArrowCursor; + BlenderCursor[WM_CURSOR_X_MOVE] = &EWArrowCursor; + BlenderCursor[WM_CURSOR_EW_ARROW] = &EWArrowCursor; END_CURSOR_BLOCK; /********************** Wait Cursor *****************************/ @@ -572,7 +568,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_WAITCURSOR] = &WaitCursor; + BlenderCursor[WM_CURSOR_WAIT] = &WaitCursor; END_CURSOR_BLOCK; /********************** Cross Cursor ***************************/ @@ -631,7 +627,8 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_CROSSCURSOR] = &CrossCursor; + BlenderCursor[WM_CURSOR_EDIT] = &CrossCursor; + BlenderCursor[WM_CURSOR_CROSS] = &CrossCursor; END_CURSOR_BLOCK; /********************** EditCross Cursor ***********************/ @@ -667,7 +664,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_EDITCROSSCURSOR] = &EditCrossCursor; + BlenderCursor[WM_CURSOR_EDITCROSS] = &EditCrossCursor; END_CURSOR_BLOCK; /********************** Box Select *************************/ @@ -703,7 +700,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_BOXSELCURSOR] = &BoxSelCursor; + BlenderCursor[WM_CURSOR_BOXSEL] = &BoxSelCursor; END_CURSOR_BLOCK; /********************** Knife Cursor ***********************/ @@ -763,7 +760,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor; + BlenderCursor[WM_CURSOR_KNIFE] = &KnifeCursor; END_CURSOR_BLOCK; @@ -825,7 +822,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor; + BlenderCursor[WM_CURSOR_VERTEX_LOOP] = &VLoopCursor; END_CURSOR_BLOCK; @@ -862,7 +859,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_TEXTEDITCURSOR] = &TextEditCursor; + BlenderCursor[WM_CURSOR_TEXT_EDIT] = &TextEditCursor; END_CURSOR_BLOCK; /********************** Paintbrush Cursor ***********************/ @@ -899,7 +896,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_PAINTBRUSHCURSOR] = &PaintBrushCursor; + BlenderCursor[WM_CURSOR_PAINT_BRUSH] = &PaintBrushCursor; END_CURSOR_BLOCK; /********************** Hand Cursor ***********************/ @@ -936,7 +933,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_HANDCURSOR] = &HandCursor; + BlenderCursor[WM_CURSOR_HAND] = &HandCursor; END_CURSOR_BLOCK; @@ -974,7 +971,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_NSEW_SCROLLCURSOR] = &NSEWScrollCursor; + BlenderCursor[WM_CURSOR_NSEW_SCROLL] = &NSEWScrollCursor; END_CURSOR_BLOCK; @@ -1012,7 +1009,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_NS_SCROLLCURSOR] = &NSScrollCursor; + BlenderCursor[WM_CURSOR_NS_SCROLL] = &NSScrollCursor; END_CURSOR_BLOCK; @@ -1050,7 +1047,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_EW_SCROLLCURSOR] = &EWScrollCursor; + BlenderCursor[WM_CURSOR_EW_SCROLL] = &EWScrollCursor; END_CURSOR_BLOCK; @@ -1088,7 +1085,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_EYEDROPPER_CURSOR] = &EyedropperCursor; + BlenderCursor[WM_CURSOR_EYEDROPPER] = &EyedropperCursor; END_CURSOR_BLOCK; @@ -1125,7 +1122,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_SWAPAREA_CURSOR] = &SwapCursor; + BlenderCursor[WM_CURSOR_SWAP_AREA] = &SwapCursor; END_CURSOR_BLOCK; @@ -1185,7 +1182,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_H_SPLITCURSOR] = &HSplitCursor; + BlenderCursor[WM_CURSOR_H_SPLIT] = &HSplitCursor; END_CURSOR_BLOCK; @@ -1245,7 +1242,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_V_SPLITCURSOR] = &VSplitCursor; + BlenderCursor[WM_CURSOR_V_SPLIT] = &VSplitCursor; END_CURSOR_BLOCK; @@ -1305,7 +1302,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_N_ARROWCURSOR] = &NArrowCursor; + BlenderCursor[WM_CURSOR_N_ARROW] = &NArrowCursor; END_CURSOR_BLOCK; @@ -1365,7 +1362,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_S_ARROWCURSOR] = &SArrowCursor; + BlenderCursor[WM_CURSOR_S_ARROW] = &SArrowCursor; END_CURSOR_BLOCK; @@ -1425,7 +1422,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_E_ARROWCURSOR] = &EArrowCursor; + BlenderCursor[WM_CURSOR_E_ARROW] = &EArrowCursor; END_CURSOR_BLOCK; @@ -1485,7 +1482,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_W_ARROWCURSOR] = &WArrowCursor; + BlenderCursor[WM_CURSOR_W_ARROW] = &WArrowCursor; END_CURSOR_BLOCK; @@ -1545,7 +1542,7 @@ void wm_init_cursor_data(void) true, }; - BlenderCursor[BC_STOPCURSOR] = &StopCursor; + BlenderCursor[WM_CURSOR_STOP] = &StopCursor; END_CURSOR_BLOCK; diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index ba6a0c4ebe1..901594850dd 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -265,7 +265,7 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *e if (opname) { BLI_strncpy(drag->opname, opname, sizeof(drag->opname)); - // WM_cursor_modal_set(win, CURSOR_COPY); + // WM_cursor_modal_set(win, WM_CURSOR_COPY); } // else // WM_cursor_modal_restore(win); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 081797542f2..2c26a15dce0 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -706,7 +706,7 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm) /* without this, cursor restore may fail, T45456 */ if (win->cursor == 0) { - win->cursor = CURSOR_STD; + win->cursor = WM_CURSOR_DEFAULT; } wm_window_ghostwindow_add(wm, "Blender", win); diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h index 6793937c413..b5604fe23b6 100644 --- a/source/blender/windowmanager/wm_cursors.h +++ b/source/blender/windowmanager/wm_cursors.h @@ -26,22 +26,6 @@ void wm_init_cursor_data(void); -#define BC_GHOST_CURSORS 1000 - -/* old cursors */ -enum { - CURSOR_FACESEL = BC_GHOST_CURSORS, - CURSOR_WAIT, - CURSOR_EDIT, - CURSOR_X_MOVE, - CURSOR_Y_MOVE, - CURSOR_HELP, - CURSOR_STD, - CURSOR_NONE, - CURSOR_PENCIL, - CURSOR_COPY, -}; - // typedef struct BCursor_s BCursor; typedef struct BCursor { @@ -65,35 +49,43 @@ typedef struct BCursor { } BCursor; -#define SYSCURSOR 1 -enum { - BC_NW_ARROWCURSOR = 2, - BC_NS_ARROWCURSOR, - BC_EW_ARROWCURSOR, - BC_WAITCURSOR, - BC_CROSSCURSOR, - BC_EDITCROSSCURSOR, - BC_BOXSELCURSOR, - BC_KNIFECURSOR, - BC_VLOOPCURSOR, - BC_TEXTEDITCURSOR, - BC_PAINTBRUSHCURSOR, - BC_HANDCURSOR, - BC_NSEW_SCROLLCURSOR, - BC_NS_SCROLLCURSOR, - BC_EW_SCROLLCURSOR, - BC_EYEDROPPER_CURSOR, - BC_SWAPAREA_CURSOR, - BC_H_SPLITCURSOR, - BC_V_SPLITCURSOR, - BC_N_ARROWCURSOR, - BC_S_ARROWCURSOR, - BC_E_ARROWCURSOR, - BC_W_ARROWCURSOR, - BC_STOPCURSOR, +typedef enum WMCursorType { + WM_CURSOR_DEFAULT = 1, + WM_CURSOR_WAIT, + WM_CURSOR_EDIT, + WM_CURSOR_X_MOVE, + WM_CURSOR_Y_MOVE, + WM_CURSOR_COPY, + + WM_CURSOR_NW_ARROW, + WM_CURSOR_NS_ARROW, + WM_CURSOR_EW_ARROW, + WM_CURSOR_CROSS, + WM_CURSOR_EDITCROSS, + WM_CURSOR_BOXSEL, + WM_CURSOR_KNIFE, + WM_CURSOR_VERTEX_LOOP, + WM_CURSOR_TEXT_EDIT, + WM_CURSOR_PAINT_BRUSH, + WM_CURSOR_HAND, + WM_CURSOR_NSEW_SCROLL, + WM_CURSOR_NS_SCROLL, + WM_CURSOR_EW_SCROLL, + WM_CURSOR_EYEDROPPER, + WM_CURSOR_SWAP_AREA, + WM_CURSOR_H_SPLIT, + WM_CURSOR_V_SPLIT, + WM_CURSOR_N_ARROW, + WM_CURSOR_S_ARROW, + WM_CURSOR_E_ARROW, + WM_CURSOR_W_ARROW, + WM_CURSOR_STOP, + + WM_CURSOR_NONE, + /* --- ALWAYS LAST ----- */ - BC_NUMCURSORS, -}; + WM_CURSOR_NUM, +} WMCursorType; struct wmEvent; struct wmWindow; |