Merge lp:~bregma/ginn/bug-650787 into lp:ginn

Proposed by Stephen M. Webb
Status: Merged
Merged at revision: 16
Proposed branch: lp:~bregma/ginn/bug-650787
Merge into: lp:ginn
Diff against target: 66 lines (+27/-3)
3 files modified
configure.ac (+3/-0)
src/Makefile.am (+2/-2)
src/ginn.c (+22/-1)
To merge this branch: bzr merge lp:~bregma/ginn/bug-650787
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Henrik Rydberg (community) Approve
Review via email: mp+36981@code.launchpad.net

Commit message

Un-hardcoded root windowid.

Description of the change

(1) Used pkg-config to detect dependant packages so I could build on my dev machine.

(2) Asked X11 for its root window ID instead of hardcoding it to some random value (fixes LP:#650787)

To post a comment you must log in.
Revision history for this message
Henrik Rydberg (rydberg) wrote :

Line 34 has a cosmetic flaw (trailing whitespace), but otherwise great, since ginn now actually works without arguments. :-)

review: Approve
Revision history for this message
Chase Douglas (chasedouglas) wrote :

I haven't tested it, but on code review this looks good!

review: Approve
Revision history for this message
Chase Douglas (chasedouglas) wrote :

BTW, as a team we need to get into the habit of adding the bug numbers (LP: #650787) to the commit messages that fix the bugs. That will cause launchpad to close out the bugs when the fixes are merged.

Not a show stopper here, just another friendly reminder :).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2010-09-15 14:32:59 +0000
3+++ configure.ac 2010-09-29 13:21:03 +0000
4@@ -23,6 +23,9 @@
5 AC_PROG_INSTALL
6
7 PKG_CHECK_MODULES([GEIS], [libutouch-geis >= 1.0.10])
8+PKG_CHECK_MODULES([X11], [x11 >= 1.3.3])
9+PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.7.7])
10+PKG_CHECK_MODULES([XTST], [xtst >= 1.1.0])
11
12 AC_CONFIG_FILES([Makefile
13 src/Makefile
14
15=== modified file 'src/Makefile.am'
16--- src/Makefile.am 2010-09-15 14:32:59 +0000
17+++ src/Makefile.am 2010-09-29 13:21:03 +0000
18@@ -1,5 +1,5 @@
19 bin_PROGRAMS = ginn
20
21 ginn_SOURCES = ginn.c config.c xt.c
22-ginn_CFLAGS = -I/usr/include/libxml2
23-ginn_LDFLAGS = -lX11 -lXtst -lutouch-geis -lxml2 -lm
24+ginn_CFLAGS = $(GEIS_CFLAGS) $(XTST_CFLAGS) $(X11_CFLAGS) $(XML2_CFLAGS)
25+ginn_LDFLAGS = $(GEIS_LIBS) $(XTST_LIBS) $(X11_LIBS) $(XML2_LIBS)
26
27=== modified file 'src/ginn.c'
28--- src/ginn.c 2010-09-15 14:32:59 +0000
29+++ src/ginn.c 2010-09-29 13:21:03 +0000
30@@ -27,6 +27,27 @@
31 #include <stdlib.h>
32 #include <string.h>
33 #include <sys/select.h>
34+#include <X11/Xlib.h>
35+
36+
37+static Window getRootWindow()
38+{
39+ Display *display = NULL;
40+ Window window = 0;
41+
42+ display = XOpenDisplay(NULL);
43+ if (!display)
44+ {
45+ fprintf(stderr, "error opening X11 display.\n");
46+ exit(1);
47+ }
48+
49+ window = DefaultRootWindow(display);
50+
51+ XCloseDisplay(display);
52+
53+ return window;
54+}
55
56 static void
57 print_attr(GeisGestureAttr *attr)
58@@ -133,7 +154,7 @@
59 GeisXcbWinInfo xcb_win_info = {
60 .display_name = NULL,
61 .screenp = NULL,
62- .window_id = 0x296
63+ .window_id = getRootWindow()
64 };
65 GeisWinInfo win_info = {
66 GEIS_XCB_FULL_WINDOW,