WM: support checking windowing capabilities
Historically checks for windowing capabilities used platform pre-processor checks however that doesn't work when Blender is built with both X11 & Wayland. Add a capabilities flag which can be used to check which functionality is supported. This has the advantage of being more descriptive/readable.
This commit is contained in:
@@ -126,6 +126,15 @@ void WM_init_opengl(void);
|
|||||||
*/
|
*/
|
||||||
const char *WM_ghost_backend(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_check(struct bContext *C);
|
||||||
void WM_reinit_gizmomap_all(struct Main *bmain);
|
void WM_reinit_gizmomap_all(struct Main *bmain);
|
||||||
|
|
||||||
|
|||||||
@@ -1646,6 +1646,23 @@ GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gp
|
|||||||
return GHOST_kDrawingContextTypeNone;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|||||||
Reference in New Issue
Block a user