Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h7
-rw-r--r--source/blender/windowmanager/intern/wm_window.c18
2 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 5b6f7939ab9..1f9de8040f6 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -119,6 +119,13 @@ void WM_init_splash(struct bContext *C);
void WM_init_opengl(void);
+/**
+ * Return an identifier for the underlying GHOST implementation.
+ * \warning Use of this function should be limited & never for compatibility checks.
+ * see: #GHOST_ISystem::getSystemBackend for details.
+ */
+const char *WM_ghost_backend(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 a4f92da2774..b1b13390932 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -91,6 +91,9 @@
/* the global to talk to ghost */
static GHOST_SystemHandle g_system = NULL;
+#if !(defined(WIN32) || defined(__APPLE__))
+static const char *g_system_backend_id = NULL;
+#endif
typedef enum eWinOverrideFlag {
WIN_OVERRIDE_GEOM = (1 << 0),
@@ -1552,6 +1555,9 @@ void wm_ghost_init(bContext *C)
/* This will leak memory, it's preferable to crashing. */
exit(1);
}
+#if !(defined(WIN32) || defined(__APPLE__))
+ g_system_backend_id = GHOST_SystemBackend();
+#endif
GHOST_Debug debug = {0};
if (G.debug & G_DEBUG_GHOST) {
@@ -1597,6 +1603,18 @@ void wm_ghost_exit(void)
g_system = NULL;
}
+const char *WM_ghost_backend(void)
+{
+#if !(defined(WIN32) || defined(__APPLE__))
+ return g_system_backend_id ? g_system_backend_id : "NONE";
+#else
+ /* While this could be supported, at the moment it's only needed with GHOST X11/WAYLAND
+ * to check which was selected and the API call may be removed after that's no longer needed.
+ * Use dummy values to prevent this being used on other systems. */
+ return g_system ? "DEFAULT" : "NONE";
+#endif
+}
+
/** \} */
/* -------------------------------------------------------------------- */