Blender V5.3
wm_cursors.cc File Reference
#include <cstring>
#include "GHOST_IWindow.hh"
#include "GHOST_Types.hh"
#include "BLI_string_utf8.hh"
#include "BLI_utildefines.hh"
#include "DNA_listBase.h"
#include "DNA_userdef_types.h"
#include "DNA_workspace_types.h"
#include "BKE_global.hh"
#include "BKE_main.hh"
#include "BLF_api.hh"
#include "nanosvgrast.h"
#include "svg_cursors.h"
#include "WM_api.hh"
#include "WM_types.hh"
#include "wm_cursors.hh"
#include "wm_window.hh"

Go to the source code of this file.

Classes

struct  blender::BCursor

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define CURSOR_TEXT_BUFFER_SIZE   24

Functions

static GHOST_TStandardCursor blender::convert_to_ghost_standard_cursor (wmCursorType curs)
static int blender::wm_cursor_size (const wmWindow *win)
static void blender::cursor_bitmap_rgba_flip_y (uint8_t *buffer, const size_t size[2])
static uint8_t * blender::cursor_bitmap_from_svg (const char *svg, const int cursor_size, uint8_t *(*alloc_fn)(size_t size), int r_bitmap_size[2])
static void blender::cursor_rgba_to_xbm_32 (const uint8_t *rgba, const int bitmap_size[2], uint8_t *bitmap, uint8_t *mask)
static bool blender::window_set_custom_cursor_generator (wmWindow *win, const BCursor &cursor)
static bool blender::window_set_custom_cursor_pixmap (wmWindow *win, const BCursor &cursor)
static bool blender::window_set_custom_cursor (wmWindow *win, const BCursor &cursor)
void blender::WM_cursor_set (wmWindow *win, int curs)
bool blender::WM_cursor_set_from_tool (wmWindow *win, const ScrArea *area, const ARegion *region)
bool blender::WM_cursor_modal_is_set_ok (const wmWindow *win)
void blender::WM_cursor_modal_set (wmWindow *win, int val)
void blender::WM_cursor_modal_restore (wmWindow *win)
void blender::WM_cursor_wait (bool val)
void blender::WM_cursor_grab_enable (wmWindow *win, const eWM_CursorWrapAxis wrap, const rcti *wrap_region, const bool hide)
void blender::WM_cursor_grab_disable (wmWindow *win, const int mouse_ungrab_xy[2])
static void blender::wm_cursor_warp_relative (wmWindow *win, int x, int y)
bool blender::wm_cursor_arrow_move (wmWindow *win, const wmEvent *event)
static bool blender::wm_cursor_time_large (wmWindow *win, uint32_t nr)
static void blender::wm_cursor_time_small (wmWindow *win, uint32_t nr)
static uint8_t * blender::cursor_bitmap_from_text (const char *text, const int cursor_size, const int cursor_size_max, int font_id, uint8_t *(*alloc_fn)(size_t size), int r_bitmap_size[2])
static bool blender::wm_cursor_text_generator (wmWindow *win, const char *text, int font_id)
static bool blender::wm_cursor_text_pixmap (wmWindow *win, const char *text, int font_id)
static bool blender::wm_cursor_text (wmWindow *win, const char *text, int font_id)
static void blender::wm_cursor_number_impl (wmWindow *win, int nr, bool is_percentage)
void blender::WM_cursor_time (wmWindow *win, int nr)
void blender::WM_cursor_progress (wmWindow *win, float progress_factor)
static void blender::wm_add_cursor (wmCursorType cursor, const char *svg_source, const float2 &hotspot, bool can_invert=false)
void blender::wm_init_cursor_data ()

Variables

constexpr int blender::CURSOR_HARDWARE_SIZE_MAX = 255
static BCursor blender::g_cursors [WM_CURSOR_NUM] = {{nullptr}}

Detailed Description

Cursor pixmap and cursor utility functions to change the cursor.

Multiple types of mouse cursors are supported. Cursors provided by the OS are preferred. The availability of these are checked with #GHOST_HasCursorShape(). These cursors can include platform-specific custom cursors. For example, on MacOS we provide vector PDF files.

If the OS cannot provide a built-in or custom platform cursor, then we use our own internal custom cursors. These are defined in SVG files. The hot-spot for these are set during definition in #wm_init_cursor_data.

Definition in file wm_cursors.cc.

Macro Definition Documentation

◆ CURSOR_TEXT_BUFFER_SIZE

#define CURSOR_TEXT_BUFFER_SIZE   24

The maximum size of cursor text (in bytes). Can remain small as it's unlikely we can ever show much text in a cursor.

Definition at line 62 of file wm_cursors.cc.

Referenced by blender::wm_cursor_number_impl(), and blender::wm_cursor_text_generator().