I recently tried to build wmii-hg on my funtoo laptop, but was met with a multitude of `undefined reference to blah' errors.
I hacked together a fix that allows wmii-hg to compile on my machine. I had to add some things to INCLUDE and LIBS. I also ifdef'd the xinerama code that I could find and added XINERAMALIBS and XINERAMAFLAGS to config.mk. You can enable Xinerama by uncommenting those; just like in dwm. I'm sure there's a better way to do that, but it's all I could think of atm. I've attached the diff with the changes I've made. -- I am a man who does not exist for others.
diff -r 5973799cd90a cmd/menu/main.c
--- a/cmd/menu/main.c Mon Jan 25 02:01:19 2010 -0500
+++ b/cmd/menu/main.c Wed Mar 17 11:46:57 2010 -0400
@@ -12,6 +12,9 @@
#include <bio.h>
#include <clientutil.h>
#include "fns.h"
+#ifdef XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
#define link _link
static const char version[] = "wimenu-"VERSION", "COPYRIGHT"\n";
@@ -195,7 +198,9 @@
Point p;
int i, n;
+#ifdef XINERAMA
rects = xinerama_screens(&n);
+#endif
if (screen_hint >= 0 && screen_hint < n)
/* We were given a valid screen index, use that. */
i = screen_hint;
diff -r 5973799cd90a cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Mon Jan 25 02:01:19 2010 -0500
+++ b/cmd/wmii/bar.c Wed Mar 17 11:46:57 2010 -0400
@@ -3,6 +3,7 @@
*/
#include "dat.h"
#include "fns.h"
+#include <X11/Xlib.h>
static Handlers handlers;
diff -r 5973799cd90a cmd/wmii/client.c
--- a/cmd/wmii/client.c Mon Jan 25 02:01:19 2010 -0500
+++ b/cmd/wmii/client.c Wed Mar 17 11:46:57 2010 -0400
@@ -6,6 +6,7 @@
#include <ctype.h>
#include <strings.h>
#include <X11/Xatom.h>
+#include <X11/Xlib.h>
#include "fns.h"
#define Mbsearch(k, l, cmp) bsearch(k, l, nelem(l), sizeof(*l), cmp)
diff -r 5973799cd90a cmd/wmii/main.c
--- a/cmd/wmii/main.c Mon Jan 25 02:01:19 2010 -0500
+++ b/cmd/wmii/main.c Wed Mar 17 11:46:57 2010 -0400
@@ -14,6 +14,9 @@
#include <sys/stat.h>
#include <unistd.h>
#include "fns.h"
+#ifdef XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
static const char
version[] = "wmii-"VERSION", "COPYRIGHT"\n";
@@ -177,7 +180,9 @@
#endif
/* Reallocate screens, zero any new ones. */
+#ifdef XINERAMA
rects = xinerama_screens(&n);
+#endif
m = max(n, nscreens);
screens = erealloc(screens, (m + 1) * sizeof *screens);
screens[m] = nil;
diff -r 5973799cd90a cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Mon Jan 25 02:01:19 2010 -0500
+++ b/cmd/wmii/x11.c Wed Mar 17 11:46:57 2010 -0400
@@ -10,6 +10,7 @@
#include <unistd.h>
#include <bio.h>
#include "fns.h"
+#include <X11/Xlib.h>
#undef pointerwin
const Point ZP = {0, 0};
diff -r 5973799cd90a cmd/wmii/xext.c
--- a/cmd/wmii/xext.c Mon Jan 25 02:01:19 2010 -0500
+++ b/cmd/wmii/xext.c Wed Mar 17 11:46:57 2010 -0400
@@ -4,8 +4,12 @@
#define _X11_VISIBLE
#include "dat.h"
#include <X11/extensions/Xrender.h>
+#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
+#endif
#include "fns.h"
+#include <X11/extensions/shape.h>
+
#if RANDR_MAJOR < 1
# error XRandR versions less than 1.0 are not supported
@@ -15,14 +19,18 @@
static bool randr_event_p(XEvent *e);
static void randr_init(void);
static void render_init(void);
+#ifdef XINERAMA
static void xinerama_init(void);
+#endif
typedef void (*EvHandler)(XEvent*);
static EvHandler randr_handlers[RRNumberEvents];
bool have_RandR;
bool have_render;
+#ifdef XINERAMA
bool have_xinerama;
+#endif
int randr_eventbase;
static void
@@ -36,7 +44,9 @@
xext_init(void) {
randr_init();
render_init();
+#ifdef XINERAMA
xinerama_init();
+#endif
}
void
@@ -120,6 +130,7 @@
&& f->direct.alphaMask;
}
+#ifdef XINERAMA
static void
xinerama_init(void) {
int base;
@@ -157,4 +168,5 @@
*np = n;
return rects;
}
+#endif
diff -r 5973799cd90a cmd/wmii9menu.c
--- a/cmd/wmii9menu.c Mon Jan 25 02:01:19 2010 -0500
+++ b/cmd/wmii9menu.c Wed Mar 17 11:46:57 2010 -0400
@@ -47,6 +47,9 @@
#include <clientutil.h>
#include <util.h>
#include <x11.h>
+#ifdef XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
char version[] = "wmii9menu-" VERSION " ©2009 Kris Maglione, ©1994 David
Hogan, Arnold Robbins";
@@ -87,7 +90,9 @@
/* xext.c */
void xext_init(void);
+#ifdef XINERAMA
Rectangle* xinerama_screens(int*);
+#endif
/* geom.c */
bool rect_haspoint_p(Point, Rectangle);
@@ -101,7 +106,9 @@
Point p;
int i, n;
+#ifdef XINERAMA
rects = xinerama_screens(&n);
+#endif
p = querypointer(&scr.root);
for(i=0; i < n; i++) {
if(rect_haspoint_p(p, rects[i]))
diff -r 5973799cd90a config.mk
--- a/config.mk Mon Jan 25 02:01:19 2010 -0500
+++ b/config.mk Wed Mar 17 11:46:57 2010 -0400
@@ -8,16 +8,20 @@
ETC = $(PREFIX)/etc
LIBDIR = $(PREFIX)/lib
INCLUDE = $(PREFIX)/include
+
+# Xinerama, un-comment if you want it
+#XINERAMALIBS = -L${X11LIB} -lXinerama
+#XINERAMAFLAGS = -DXINERAMA
# Includes and libs
-INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
-LIBS = -L$(ROOT)/lib -L/usr/lib
+INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
-I/usr/include/freetype2
+LIBS = -L$(ROOT)/lib -L/usr/lib -lX11 ${XINERAMALIBS} -lXrender -lXft
-lfontconfig -lfreetype -lXext -lXrandr
TERMINAL = xterm
# Flags
include $(ROOT)/mk/gcc.mk
-CFLAGS += $(DEBUGCFLAGS) -O0
+CFLAGS += $(DEBUGCFLAGS) ${XINERAMAFLAGS} -O0
LDFLAGS += -g
SOLDFLAGS += $(LDFLAGS)
pgpeqNNJv5ZW2.pgp
Description: PGP signature
