diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 264b76472f7..df5659845fe 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -126,6 +126,15 @@ void WM_init_opengl(void); */ const char *WM_ghost_backend(void); +typedef enum eWM_CapabilitiesFlag { + /** Ability to warp the cursor (set it's location). */ + WM_CAPABILITY_CURSOR_WARP = (1 << 0), + /** Ability to access window positions & move them. */ + WM_CAPABILITY_WINDOW_POSITION = (1 << 1), +} eWM_CapabilitiesFlag; + +eWM_CapabilitiesFlag WM_capabilities_flag(void); + void WM_check(struct bContext *C); void WM_reinit_gizmomap_all(struct Main *bmain); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index f5dc18bb16e..7ee074660b0 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1646,6 +1646,23 @@ GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gp return GHOST_kDrawingContextTypeNone; } +eWM_CapabilitiesFlag WM_capabilities_flag(void) +{ + static eWM_CapabilitiesFlag flag = -1; + if (flag != -1) { + return flag; + } + + flag = 0; + if (GHOST_SupportsCursorWarp()) { + flag |= WM_CAPABILITY_CURSOR_WARP; + } + if (GHOST_SupportsWindowPosition()) { + flag |= WM_CAPABILITY_WINDOW_POSITION; + } + return flag; +} + /** \} */ /* -------------------------------------------------------------------- */