summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Gjengset <jon@thesquareplanet.com>2013-09-09 18:14:59 +0100
committerJon Gjengset <jon@thesquareplanet.com>2013-09-09 18:15:04 +0100
commit77a869fd4612c0cdffdee2f19ae5db3dda77adb6 (patch)
tree03d8e017697e0cf5f2ee0363e2ce8622159febf2
parentMove bugs to Github issues #1 and #2 (diff)
downloadmktrayicon-77a869fd4612c0cdffdee2f19ae5db3dda77adb6.tar.gz
mktrayicon-77a869fd4612c0cdffdee2f19ae5db3dda77adb6.tar.bz2
mktrayicon-77a869fd4612c0cdffdee2f19ae5db3dda77adb6.zip
Avoid X11 threading errors; fixes #1
Thanks: http://stackoverflow.com/a/18690540/472927
-rw-r--r--Makefile2
-rw-r--r--README.md4
-rw-r--r--mktrayicon.c2
3 files changed, 3 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index a267dc1..d5b434c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
mktrayicon: mktrayicon.c
- ${CC} `pkg-config --cflags gtk+-3.0` -o $@ $< `pkg-config --libs gtk+-3.0`
+ ${CC} `pkg-config --cflags gtk+-3.0` -o $@ $< `pkg-config --libs gtk+-3.0` `pkg-config --cflags --libs x11`
clean:
rm mktrayicon
diff --git a/README.md b/README.md
index 5d058f2..1c01c0b 100644
--- a/README.md
+++ b/README.md
@@ -80,8 +80,4 @@ This is my first time using the GTK+ C library, and I've got to say it is less
than pleasant to work with. My biggest issue has been trying to do blocking IO
without blocking the GUI thread, as GTK seems to not like that.
-There are bound to be bugs, but the most important ones for now are
-[#1](https://github.com/Jonhoo/mktrayicon/issues/1) and
-[#2](https://github.com/Jonhoo/mktrayicon/issues/2).
-
**Patches are very welcome!**
diff --git a/mktrayicon.c b/mktrayicon.c
index 4b3e955..063eccb 100644
--- a/mktrayicon.c
+++ b/mktrayicon.c
@@ -4,6 +4,7 @@
*/
#include <gtk/gtk.h>
#include <glib.h>
+#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
@@ -180,6 +181,7 @@ int main(int argc, char **argv)
FILE *fifo;
GThread *reader;
+ XInitThreads(); /* see http://stackoverflow.com/a/18690540/472927 */
gtk_init(&argc, &argv);
if (argc == 4 && strcmp(argv[1], "-i") == 0) {
bgstack15