commit 30070515a5bd9e5a42343c206fe67cbe2160b998
parent ef01f3c72a195dbce682184c842b81b17d7d7ad1
Author: uosis <uosisl@gmail.com>
Date: Mon, 30 Sep 2019 14:43:30 -0600
set window class
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/xsel.c b/xsel.c
@@ -31,6 +31,7 @@
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
+#include <X11/Xutil.h>
#include "xsel.h"
@@ -2028,6 +2029,7 @@ main(int argc, char *argv[])
Bool want_clipboard = False, do_delete = False;
Window root;
Atom selection = XA_PRIMARY, test_atom;
+ XClassHint * class_hints;
int black;
int i, s=0;
unsigned char * old_sel = NULL, * new_sel = NULL;
@@ -2170,6 +2172,16 @@ main(int argc, char *argv[])
print_debug (D_INFO, "Window id: 0x%x (unmapped)", window);
+ /* Set window class */
+ class_hints = XAllocClassHint();
+ if (class_hints==NULL) {
+ exit_err ("Can't allocate class hints memory\n");
+ }
+ class_hints->res_name = "xsel";
+ class_hints->res_class = "XSel";
+ XSetClassHint(display, window, class_hints);
+ XFree(class_hints);
+
/* Get a timestamp */
XSelectInput (display, window, PropertyChangeMask);
timestamp = get_timestamp ();