WMProperties and symlink testing. - thinglaunch - A simple command and password… | |
git clone git://bitreich.org/thinglaunch | |
Log | |
Files | |
Refs | |
Tags | |
LICENSE | |
--- | |
commit 5502b4594bac02c6091df6479aad7e9f7a754899 | |
parent 3a05486d691e4aa86d34a43eb4346ea9b49b40b2 | |
Author: Christoph Lohmann <[email protected]> | |
Date: Sun, 27 Mar 2011 20:15:39 +0200 | |
WMProperties and symlink testing. | |
Diffstat: | |
M Makefile | 2 +- | |
M thinglaunch.c | 16 +++++++++++++++- | |
2 files changed, 16 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
@@ -28,7 +28,7 @@ ${OBJ}: config.mk | |
${NAME}: ${OBJ} | |
@echo CC -o $@ | |
@${CC} -o $@ ${OBJ} ${LDFLAGS} | |
- @ln -s ${NAME} thingaskpass | |
+ @[ ! -e thingaskpass ] && ln -s ${NAME} thingaskpass | |
clean: | |
@echo cleaning | |
diff --git a/thinglaunch.c b/thinglaunch.c | |
@@ -23,6 +23,8 @@ | |
#include "config.h" | |
unsigned long getcolor(const char *colstr); | |
+XIMStyle choosebetterstyle(XIMStyle style1, XIMStyle style2); | |
+void initim(void); | |
void createwindow(void); | |
void setupgc(void); | |
void eventloop(void); | |
@@ -42,6 +44,7 @@ XFontStruct *font_info; | |
XFontSet fontset; | |
int screen, issecret = 0, tostdout = 0; | |
unsigned long fgcol, bgcol; | |
+static char *name = "thinglaunch"; | |
#define MAXCMD 255 | |
#define WINWIDTH 640 | |
@@ -212,6 +215,8 @@ createwindow(void) | |
int top, left; | |
XSizeHints *win_size_hints; | |
XSetWindowAttributes attrib; | |
+ XClassHint *ch; | |
+ XTextProperty str; | |
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) | |
fprintf(stderr, "warning: no locale support.\n"); | |
@@ -258,9 +263,18 @@ createwindow(void) | |
win_size_hints->min_width = win_size_hints->max_width = WINWIDTH; | |
win_size_hints->min_height = win_size_hints->max_height = WINHEIGHT; | |
- XSetWMNormalHints(dpy, win, win_size_hints); | |
+ | |
+ XStringListToTextProperty(&name, 1, &str); | |
+ ch = XAllocClassHint(); | |
+ ch->res_class = name; | |
+ ch->res_name = name; | |
+ | |
+ XSetWMProperties(dpy, win, &str, &str, NULL, 0, win_size_hints, | |
+ NULL, ch); | |
XFree(win_size_hints); | |
+ XFree(ch); | |
+ XFree(str.value); | |
XMapWindow(dpy, win); | |
} |