commit b9e027eeae8741ece01f80c5d5d1625b58a64eea
parent af943f96fb9e60bf7259eea08e6ef936e566413b
Author: falkTX <falktx@falktx.com>
Date: Sun, 22 Oct 2023 15:05:37 +0200
Allow to set X11 window icon for standalones
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/Makefile.base.mk b/Makefile.base.mk
@@ -601,6 +601,14 @@ ifneq ($(WINDOWS_ICON_ID),)
BUILD_CXX_FLAGS += -DDGL_WINDOWS_ICON_ID=$(WINDOWS_ICON_ID)
endif
+ifneq ($(X11_WINDOW_ICON_NAME),)
+BUILD_CXX_FLAGS += -DDGL_X11_WINDOW_ICON_NAME=$(X11_WINDOW_ICON_NAME)
+endif
+
+ifneq ($(X11_WINDOW_ICON_SIZE),)
+BUILD_CXX_FLAGS += -DDGL_X11_WINDOW_ICON_SIZE=$(X11_WINDOW_ICON_SIZE)
+endif
+
ifeq ($(USE_GLES2),true)
BUILD_CXX_FLAGS += -DDGL_USE_OPENGL3 -DDGL_USE_GLES -DDGL_USE_GLES2
endif
diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp
@@ -120,6 +120,10 @@ END_NAMESPACE_DGL
# include "../../distrho/extra/FileBrowserDialogImpl.cpp"
#endif
+#if defined(DGL_USING_X11) && defined(DGL_X11_WINDOW_ICON_NAME)
+extern const ulong* DGL_X11_WINDOW_ICON_NAME;
+#endif
+
#ifndef DISTRHO_OS_MAC
START_NAMESPACE_DGL
#endif
@@ -605,6 +609,15 @@ void puglX11SetWindowTypeAndPID(const PuglView* const view, const bool isStandal
const Atom _nwp = XInternAtom(display, "_NET_WM_PID", False);
XChangeProperty(display, impl->win, _nwp, XA_CARDINAL, 32, PropModeReplace, (const uchar*)&pid, 1);
+ #if defined(DGL_X11_WINDOW_ICON_NAME) && defined(DGL_X11_WINDOW_ICON_SIZE)
+ if (isStandalone)
+ {
+ const Atom _nwi = XInternAtom(display, "_NET_WM_ICON", False);
+ XChangeProperty(display, impl->win, _nwi, XA_CARDINAL, 32, PropModeReplace,
+ (const uchar*)DGL_X11_WINDOW_ICON_NAME, DGL_X11_WINDOW_ICON_SIZE);
+ }
+ #endif
+
const Atom _wt = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
Atom _wts[2];