Cleanup: use a system method to access the APP_ID

Move the app-id out window initialization code.
Make it possible for other methods to access the APP_ID.
This commit is contained in:
Campbell Barton 2023-03-28 16:05:31 +11:00
parent 10b03e66b9
commit 4ee705ca4f
3 changed files with 23 additions and 14 deletions

@ -6821,6 +6821,26 @@ struct zwp_pointer_gestures_v1 *GHOST_SystemWayland::wp_pointer_gestures()
return display_->wp_pointer_gestures;
}
/* This value is expected to match the base name of the `.desktop` file. see #101805.
*
* NOTE: the XDG desktop-entry-spec defines that this should follow the "reverse DNS" convention.
* For e.g. `org.blender.Blender` - however the `.desktop` file distributed with Blender is
* 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 #101779.
* Currently there isn't a way to configure this, we may want to support that. */
static const char *ghost_wl_app_id = (
#ifdef WITH_GHOST_WAYLAND_APP_ID
STRINGIFY(WITH_GHOST_WAYLAND_APP_ID)
#else
"blender"
#endif
);
const char *GHOST_SystemWayland::xdg_app_id()
{
return ghost_wl_app_id;
}
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
libdecor *GHOST_SystemWayland::libdecor_context()

@ -192,6 +192,8 @@ class GHOST_SystemWayland : public GHOST_System {
struct wl_shm *wl_shm() const;
static const char *xdg_app_id();
/* WAYLAND utility functions. */
/**

@ -823,20 +823,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
* when the `window_->scale` changed. */
const int32_t size_min[2] = {320, 240};
/* This value is expected to match the base name of the `.desktop` file. see #101805.
*
* NOTE: the XDG desktop-entry-spec defines that this should follow the "reverse DNS" convention.
* For e.g. `org.blender.Blender` - however the `.desktop` file distributed with Blender is
* 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 #101779.
* Currently there isn't a way to configure this, we may want to support that. */
const char *xdg_app_id = (
#ifdef WITH_GHOST_WAYLAND_APP_ID
STRINGIFY(WITH_GHOST_WAYLAND_APP_ID)
#else
"blender"
#endif
);
const char *xdg_app_id = GHOST_SystemWayland::xdg_app_id();
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
if (use_libdecor) {