From 64a114d11c9c03fb336625ad20b6563dc6b923bf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2022 11:15:10 +1100 Subject: [PATCH] GHOST/Wayland: add build option to set the XDG app-id Add WITH_GHOST_WAYLAND_APP_ID so people making custom builds may differentiate the blender instance by version/branch etc. --- CMakeLists.txt | 6 ++++++ intern/ghost/CMakeLists.txt | 5 +++++ intern/ghost/intern/GHOST_WindowWayland.cpp | 8 +++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30a186318ce..9f6217d4ce8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,6 +257,12 @@ if(UNIX AND NOT (APPLE OR HAIKU)) option(WITH_GHOST_WAYLAND_DYNLOAD "Enable runtime dynamic WAYLAND libraries loading" ON) mark_as_advanced(WITH_GHOST_WAYLAND_DYNLOAD) + + set(WITH_GHOST_WAYLAND_APP_ID "" CACHE STRING "\ +The application ID used for Blender (use default when an empty string), \ +this can be used to differentiate Blender instances by version or branch for example." + ) + mark_as_advanced(WITH_GHOST_WAYLAND_APP_ID) endif() endif() diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 5c559072625..599d5304cac 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -393,6 +393,11 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND) unset(INC_DST) add_definitions(-DWITH_GHOST_WAYLAND) + + if(NOT WITH_GHOST_WAYLAND_APP_ID STREQUAL "") + add_definitions(-DWITH_GHOST_WAYLAND_APP_ID=${WITH_GHOST_WAYLAND_APP_ID}) + endif() + endif() if(WITH_INPUT_NDOF) diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp index 63fed9a8172..07fbbc12d31 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cpp +++ b/intern/ghost/intern/GHOST_WindowWayland.cpp @@ -823,7 +823,13 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system, * simply called `blender.desktop`, so the it's important to follow that name. * Other distributions such as SNAP & FLATPAK may need to change this value T101779. * Currently there isn't a way to configure this, we may want to support that. */ - const char *xdg_app_id = "blender"; + const char *xdg_app_id = ( +#ifdef WITH_GHOST_WAYLAND_APP_ID + STRINGIFY(WITH_GHOST_WAYLAND_APP_ID) +#else + "blender" +#endif + ); #ifdef WITH_GHOST_WAYLAND_LIBDECOR if (use_libdecor) {