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:
authorCampbell Barton <campbell@blender.org>2022-10-10 02:56:05 +0300
committerCampbell Barton <campbell@blender.org>2022-10-10 03:22:41 +0300
commita24f11e0ec96ef9f4298f5ffe754146aa8319b72 (patch)
tree063916e2a4f122e04b79c61526627f0c9da6de69 /intern/ghost
parent210f4db81c8d5501b27e75f7e9718fb1c52a5d8a (diff)
UI: show the windowing environment in the "About" splash
Show the windowing environment on non MS-Windows/Apple systems, since X11/WAYLAND are selected startup there was no convenient way for users to know which back-end was being used. Include the windowing environment in the About splash & system-info.txt since it will be useful for handling bug reports. This commit adds a private API call not intended for general use as I would like to be able to remove this later and it's only needed in the specific case of testing if Blender is using WAYLAND or X11 (which maybe be used via XWayland). Python scripts can already inspect the system to check which windowing environment used, the API call is mainly useful for troubleshooting.
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/GHOST_C-api.h4
-rw-r--r--intern/ghost/GHOST_ISystem.h10
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp7
-rw-r--r--intern/ghost/intern/GHOST_ISystem.cpp11
4 files changed, 31 insertions, 1 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index c9d18be750d..7fda535a7ac 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -36,6 +36,10 @@ extern GHOST_SystemHandle GHOST_CreateSystemBackground(void);
*/
extern void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug);
+#if !(defined(WIN32) || defined(__APPLE__))
+extern const char *GHOST_SystemBackend(void);
+#endif
+
/**
* Disposes the one and only system.
* \param systemhandle: The handle to the system.
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 0bf540bd4b6..9fb94ed1525 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -134,6 +134,15 @@ class GHOST_ISystem {
* \return A pointer to the system.
*/
static GHOST_ISystem *getSystem();
+ /**
+ * Return an identifier for the one and only system.
+ * \warning while it may be tempting this should never be used to check for supported features,
+ * in that case, the GHOST API should be extended to query capabilities.
+ * This is needed for X11/WAYLAND on Unix, without this - there is no convenient way for users to
+ * check if WAYLAND or XWAYLAND are in use since they are dynamically selected at startup.
+ * When dynamically switching between X11/WAYLAND is removed, this function can go too.
+ */
+ static const char *getSystemBackend();
static GHOST_TBacktraceFn getBacktraceFn();
static void setBacktraceFn(GHOST_TBacktraceFn backtrace_fn);
@@ -515,6 +524,7 @@ class GHOST_ISystem {
/** The one and only system */
static GHOST_ISystem *m_system;
+ static const char *m_system_backend_id;
/** Function to call that sets the back-trace. */
static GHOST_TBacktraceFn m_backtrace_fn;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 69fc6b5f2d0..158e979cdf2 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -52,6 +52,13 @@ GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
return system->disposeSystem();
}
+#if !(defined(WIN32) || defined(__APPLE__))
+const char *GHOST_SystemBackend()
+{
+ return GHOST_ISystem::getSystemBackend();
+}
+#endif
+
void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
const char *title,
const char *message,
diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp
index 304d7f0abe6..0a35d1af5a4 100644
--- a/intern/ghost/intern/GHOST_ISystem.cpp
+++ b/intern/ghost/intern/GHOST_ISystem.cpp
@@ -30,6 +30,7 @@
#endif
GHOST_ISystem *GHOST_ISystem::m_system = nullptr;
+const char *GHOST_ISystem::m_system_backend_id = nullptr;
GHOST_TBacktraceFn GHOST_ISystem::m_backtrace_fn = nullptr;
@@ -122,7 +123,10 @@ GHOST_TSuccess GHOST_ISystem::createSystem(bool verbose)
m_system = new GHOST_SystemCocoa();
#endif
- if ((m_system == nullptr) && verbose) {
+ if (m_system) {
+ m_system_backend_id = backends_attempted[backends_attempted_num - 1];
+ }
+ else if (verbose) {
fprintf(stderr, "GHOST: failed to initialize display for back-end(s): [");
for (int i = 0; i < backends_attempted_num; i++) {
if (i != 0) {
@@ -186,6 +190,11 @@ GHOST_ISystem *GHOST_ISystem::getSystem()
return m_system;
}
+const char *GHOST_ISystem::getSystemBackend()
+{
+ return m_system_backend_id;
+}
+
GHOST_TBacktraceFn GHOST_ISystem::getBacktraceFn()
{
return GHOST_ISystem::m_backtrace_fn;