void-packages/srcpkgs/xob/patches/0002-Set-a-WM_CLASS-for-the...

41 lines
1.2 KiB
Diff

From 1cadc7055718138f6ea31765970ca72b7414532e Mon Sep 17 00:00:00 2001
From: Florent C <florentc@users.noreply.github.com>
Date: Wed, 22 Aug 2018 17:02:05 +0200
Subject: [PATCH] Fix #3: Set a WM_CLASS for the bar X window
---
src/display.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/display.c b/src/display.c
index db451e0..a229647 100644
--- src/display.c
+++ src/display.c
@@ -17,6 +17,8 @@
#include "display.h"
+#include <X11/Xutil.h>
+
/* Keep value in range */
static int fit_in(int value, int min, int max)
{
@@ -133,6 +135,16 @@ display_context_t init(style_t conf)
DefaultVisual(dc.x.display, dc.x.screen_number), CWOverrideRedirect,
&window_attributes);
+ /* Set a WM_CLASS for the window */
+ XClassHint *class_hint = XAllocClassHint();
+ if (class_hint != NULL)
+ {
+ class_hint->res_name = DEFAULT_CONFIG_APPNAME;
+ class_hint->res_class = DEFAULT_CONFIG_APPNAME;
+ XSetClassHint(dc.x.display, dc.x.window, class_hint);
+ XFree(class_hint);
+ }
+
/* The new window is not mapped yet */
dc.x.mapped = False;