summaryrefslogtreecommitdiff
blob: 1e767ad918feb236c611468a9a7a98f7c6119fb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- llpp/link.c
+++ llpp/link.c
@@ -2792,6 +2792,32 @@
     CAMLreturn (Val_unit);
 }
 
+#if !defined (_WIN32) && !defined (__APPLE__)
+#undef pixel
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <GL/glx.h>
+
+static void set_wm_class (void)
+{
+    Display *dpy;
+    Window win;
+    int screen;
+    XClassHint hint;
+
+    dpy = XOpenDisplay (getenv ("DISPLAY"));
+    screen = DefaultScreen (dpy);
+    hint.res_name = "llpp";
+    hint.res_class = "llpp";
+    win = glXGetCurrentDrawable ();
+    XSetClassHint (dpy, win, &hint);
+    XCloseDisplay (dpy);
+}
+#else
+#define set_wm_class()
+#endif
+
 CAMLprim value ml_init (value pipe_v, value params_v)
 {
     CAMLparam2 (pipe_v, params_v);
@@ -2852,5 +2878,6 @@
         errx (1, "pthread_create: %s", strerror (ret));
     }
 
+    set_wm_class ();
     CAMLreturn (Val_unit);
 }