Importing wm2-2
12 files changed, 151 insertions(+), 208 deletions(-)

M Border.C
M Border.h
M Buttons.C
M Client.C
M Client.h
M Config.h
M Events.C
M Main.C
M Makefile
M Manager.C
M Manager.h
M README
M Border.C +13 -2
@@ 559,6 559,11 @@ void Border::setFrameVisibility(Boolean 
     XRectangle r;
     RectangleList rl;
 
+    if (CONFIG_PROD_SHAPE) {
+	shapeParent(w, h);
+	shapeTab(w, h);
+    }
+
     if (isTransient()) {
 	setTransientFrameVisibility(visible, w, h);
 	return;

          
@@ 676,11 681,11 @@ void Border::configure(int x, int y, int
 	if (!isTransient()) {
 	    XSelectInput(display(), m_tab,
 			 ExposureMask | ButtonPressMask | ButtonReleaseMask |
-			 EnterWindowMask | LeaveWindowMask);
+			 EnterWindowMask/* | LeaveWindowMask*/);
 	}
 
 	XSelectInput(display(), m_button,
-		     ButtonPressMask | ButtonReleaseMask | LeaveWindowMask);
+		     ButtonPressMask | ButtonReleaseMask/* | LeaveWindowMask*/);
 	XSelectInput(display(), m_resize, ButtonPressMask | ButtonReleaseMask);
 	mask |= CWX | CWY | CWWidth | CWHeight | CWBorderWidth;
     }

          
@@ 779,6 784,12 @@ void Border::mapRaised()
 }
 
 
+void Border::lower()
+{
+    XLowerWindow(display(), m_parent);
+}
+
+
 void Border::unmap()
 {
     if (m_parent == root()) {

          
M Border.h +3 -1
@@ 13,9 13,9 @@ public:
     Border(Client *const, Window child);
     ~Border();
 
-
     void map();
     void unmap();
+    void lower();
     void mapRaised();
     void decorate(Boolean active, int w, int h);
     void reparent();

          
@@ 45,6 45,8 @@ public:
 	return isTransient() ? m_transientFrameWidth + 1 :
 	    m_tabWidth + m_frameWidth + 1;
     }
+
+    Boolean coordsInHole(int, int); // in Events.C of all places
     
 private:
     Client *m_client;

          
M Buttons.C +5 -0
@@ 31,6 31,11 @@ void Client::eventButton(XButtonEvent *e
 {
     if (e->type != ButtonPress) return;
 
+    if (e->button == Button3) {
+	lower();
+	return;
+    }
+
     mapRaised();
 
     if (e->button == Button1) {

          
M Client.C +11 -3
@@ 14,7 14,7 @@ Client::Client(WindowManager *const wm, 
     m_revert(0),
     m_fixedSize(False),
     m_state(WithdrawnState),
-    m_initialising(False),
+    m_managed(False),
     m_reparenting(False),
     m_colormap(None),
     m_colormapWinCount(0),

          
@@ 247,7 247,7 @@ void Client::manage(Boolean mapped)
 	activeClient()->installColormap();
     }
 
-    m_initialising = True;
+    m_managed = True;
 }
 
 

          
@@ 267,6 267,8 @@ void Client::activate()
 	return;
     }
 
+    if (!m_managed || isHidden() || isWithdrawn()) return;
+
     if (isActive()) {
 	decorate(True);
 	if (CONFIG_RAISE_ON_FOCUS) mapRaised();

          
@@ 547,7 549,7 @@ void Client::getColormaps(void)
     Window *cw;
     XWindowAttributes attr;
 
-    if (!m_initialising) {
+    if (!m_managed) {
 	XGetWindowAttributes(display(), m_window, &attr);
 	m_colormap = attr.colormap;
 

          
@@ 712,3 714,9 @@ void Client::ensureVisible()
     if (m_x != px || m_y != py) m_border->moveTo(m_x, m_y);
 }
 
+
+void Client::lower()
+{
+    m_border->lower();
+}
+

          
M Client.h +10 -14
@@ 25,6 25,7 @@ public:
     void rename();
     void kill();
     void mapRaised();		// without activating
+    void lower();
 
     void move(XButtonEvent *);		// event for grab timestamp & coords
     void resize(XButtonEvent *, Boolean, Boolean);

          
@@ 39,16 40,13 @@ public:
     Client *revertTo() { return m_revert; }
     void setRevertTo(Client *c) { m_revert = c; }
 
-    Boolean isHidden()    { return (m_state == IconicState);    }
-    Boolean isWithdrawn() { return (m_state == WithdrawnState); }
-    Boolean isNormal()    { return (m_state == NormalState);    }
-    Boolean isTransient() { return (m_transient != None);       }
+    Boolean isHidden()     { return (m_state == IconicState);    }
+    Boolean isWithdrawn()  { return (m_state == WithdrawnState); }
+    Boolean isNormal()     { return (m_state == NormalState);    }
+    Boolean isTransient()  { return (m_transient != None);       }
     Window  transientFor() { return m_transient; }
     Boolean isFixedSize()  { return m_fixedSize; }
 
-    Boolean isInitialising() { return m_initialising; }
-    Boolean isReparenting()  { return m_reparenting;  }
-
     const char *label()    { return m_label;    }
     const char *name()     { return m_name;     }
     const char *iconName() { return m_iconName; }

          
@@ 73,19 71,16 @@ public:
     void eventMapRequest(XMapRequestEvent *);
     void eventConfigureRequest(XConfigureRequestEvent *);
     void eventUnmap(XUnmapEvent *);
-    void eventCreate(XCreateWindowEvent *);
     void eventColormap(XColormapEvent *);
     void eventProperty(XPropertyEvent *);
     void eventEnter(XCrossingEvent *);
     void eventFocusIn(XFocusInEvent *);
-//    void eventShapeNotify(XShapeEvent *);
     void eventExposure(XExposeEvent *);
 
+protected:      // cravenly submitting to gcc's warnings
+    ~Client();
+
 private:
-    // gcc says: class Client only defines a private destructor and
-    // has no friends.  I don't think that's very nice of gcc.  My
-    // code always has plenty of friends.
-    ~Client();
 
     Window m_window;
     Window m_transient;

          
@@ 104,10 99,11 @@ private:
     int m_minWidth;
     int m_minHeight;
     void fixResizeDimensions(int &, int &, int &, int &);
+    Boolean coordsInHole(int, int);
 
     int m_state;
     int m_protocol;
-    Boolean m_initialising;
+    Boolean m_managed;
     Boolean m_reparenting;
 
     char *m_name;

          
M Config.h +8 -1
@@ 25,7 25,14 @@ 
 #define CONFIG_MENU_BACKGROUND    "gray80"
 #define CONFIG_MENU_BORDERS       "black"
 
-#define CONFIG_EVERYTHING_ON_ROOT_MENU    True
+#define CONFIG_EVERYTHING_ON_ROOT_MENU True
+
+// If CONFIG_PROD_SHAPE is True, all frame element shapes will be
+// recalculated afresh every time their focus changes.  This will
+// probably slow things down hideously, but has been reported as
+// necessary on some systems (possibly SunOS 4.x with OpenWindows).
+
+#define CONFIG_PROD_SHAPE False
 
 #endif
 

          
M Events.C +32 -59
@@ 3,9 3,6 @@ 
 #include "Client.h"
 
 
-// hack:
-static unsigned long swallowNextEnterEvent = 0L;
-
 
 int WindowManager::loop()
 {

          
@@ 92,15 89,15 @@ int WindowManager::loop()
 	case ConfigureNotify:
 	case MapNotify:
 	case MappingNotify:
-
-#ifdef DEBUG_EV
-	    trace("ignore", 0, &ev);
-#endif
 	    break;
 
 	default:
-	    if (ev.type == m_shapeEvent) eventShapeNotify((XShapeEvent *)&ev);
-	    else fprintf(stderr, "wm2: unsupported event type %d\n", ev.type);
+//	    if (ev.type == m_shapeEvent) eventShapeNotify((XShapeEvent *)&ev);
+	    if (ev.type == m_shapeEvent) {
+		fprintf(stderr, "wm2: shaped windows are not supported\n");
+	    } else {
+		fprintf(stderr, "wm2: unsupported event type %d\n", ev.type);
+	    }
 	    break;
 	}
     }

          
@@ 204,7 201,7 @@ void Client::eventConfigureRequest(XConf
 	sendConfigureNotify();
     }
 
-    if (m_initialising) {
+    if (m_managed) {
 	wc.x = m_border->xIndent();
 	wc.y = m_border->yIndent();
     } else {

          
@@ 263,11 260,7 @@ void Client::eventMapRequest(XMapRequest
 	mapRaised();
 	setState(NormalState);
 
-	if (CONFIG_CLICK_TO_FOCUS)/* ||
-	    (m_transient != None && activeClient() &&
-	     m_transient == activeClient()->m_window))*/ {
-	    activate();
-	}
+	if (CONFIG_CLICK_TO_FOCUS) activate();
 	break;
 
     case IconicState:

          
@@ 286,8 279,6 @@ void WindowManager::eventUnmap(XUnmapEve
 
 void Client::eventUnmap(XUnmapEvent *e)
 {
-    swallowNextEnterEvent = 0L;
-
     switch (m_state) {
 
     case IconicState:

          
@@ 311,21 302,6 @@ void WindowManager::eventCreate(XCreateW
 {
     if (e->override_redirect) return;
     Client *c = windowToClient(e->window, True);
-    if (c) c->eventCreate(e);
-}
-
-
-void Client::eventCreate(XCreateWindowEvent *)
-{
-    if (!CONFIG_CLICK_TO_FOCUS) {
-	Window r, ch;
-	int x = -1, y = -1, wx, wy;
-	unsigned int k;
-	XQueryPointer(display(), root(), &r, &ch, &x, &y, &wx, &wy, &k);
-	if (x > m_x && y > m_y && x < m_x + m_w && y < m_y + m_h) {
-	    activate();
-	}
-    }
 }
 
 

          
@@ 334,7 310,6 @@ void WindowManager::eventDestroy(XDestro
     Client *c = windowToClient(e->window);
 
     if (c) {
-	swallowNextEnterEvent = 0L;
 
 	for (int i = m_clients.count()-1; i >= 0; --i) {
 	    if (m_clients.item(i) == c) {

          
@@ 454,10 429,9 @@ void WindowManager::eventReparent(XRepar
 
 void WindowManager::eventEnter(XCrossingEvent *e)
 {
-//    if (e->detail == NotifyVirtual || e->detail == NotifyNonlinearVirtual) {
-//	return;
-//    }
+    if (e->type != EnterNotify) return;
 
+    while (XCheckMaskEvent(m_display, EnterWindowMask, (XEvent *)e));
     m_currentTime = e->time;	// not CurrentTime
 
     Client *c = windowToClient(e->window);

          
@@ 467,30 441,19 @@ void WindowManager::eventEnter(XCrossing
 
 void Client::eventEnter(XCrossingEvent *e)
 {
-    long s = swallowNextEnterEvent;
+    // first, big checks so as not to allow focus to change "through"
+    // the hole in the tab
 
-    if (s == 0L && e->type == LeaveNotify) {
+    if (!isActive() && activeClient() && activeClient()->isNormal() &&
+	!activeClient()->isTransient()) {
 
-	if (!CONFIG_CLICK_TO_FOCUS &&
-	    e->window != m_window && e->window != parent() &&
-	    // must be tab or button
-	    ((e->x > 1 && e->x < m_border->xIndent() &&
-	      e->y > 1 && e->y < m_border->xIndent()) ||
-	     (e->x > m_border->xIndent() - m_border->yIndent() &&
-	      e->x < m_border->xIndent() + m_w &&
-	      e->y > 1 && e->y < m_border->yIndent()))) {
+	int x, y;
+	Window c;
 
-	    swallowNextEnterEvent = e->time; // so you can reach the button!
-	}
-	return;
-
-    } else if (s != 0L) {
+	XTranslateCoordinates
+	    (display(), activeClient()->parent(), e->window, 0, 0, &x, &y, &c);
 
-	swallowNextEnterEvent = 0L;
-
-	if (e->time <= s || e->time - s < 500L) {
-	    return;
-	}
+	if (activeClient()->coordsInHole(e->x - x, e->y - y)) return;
     }
 
     if (e->type == EnterNotify && !isActive() && !CONFIG_CLICK_TO_FOCUS) {

          
@@ 499,6 462,19 @@ void Client::eventEnter(XCrossingEvent *
 }
 
 
+Boolean Client::coordsInHole(int x, int y)	// relative to parent
+{
+    return m_border->coordsInHole(x, y);
+}
+
+
+Boolean Border::coordsInHole(int x, int y)	// this is all a bit of a hack
+{
+    return (x > 1 && x < m_tabWidth-1 &&
+	    y > 1 && y < m_tabWidth-1);
+}
+
+
 void WindowManager::eventFocusIn(XFocusInEvent *e)
 {
     if (e->detail != NotifyNonlinearVirtual) return;

          
@@ 532,6 508,3 @@ void Client::eventExposure(XExposeEvent 
 }
 
 
-
-// don't handle these (yet?)
-void WindowManager::eventShapeNotify(XShapeEvent *) { }

          
M Main.C +7 -2
@@ 1,14 1,19 @@ 
 
 #include "Manager.h"
 
+#include "Client.h"
+#include "Border.h"
+
 int main(int argc, char **argv)
 {
+    int i;
+    
     if (argc > 1) {
-	for (int i = strlen(argv[0])-1; i > 0 && argv[0][i] != '/'; --i);
+	for (i = strlen(argv[0])-1; i > 0 && argv[0][i] != '/'; --i);
 	fprintf(stderr, "usage: %s\n", argv[0] + (i > 0) + i);
 	exit(2);
     }
-
+    
     WindowManager manager;
     return 0;
 }

          
M Makefile +3 -92
@@ 1,7 1,7 @@ 
 
 LIBS	= -lXext -lX11 -lXmu -lm
-CC	= ncc
-CCC	= NCC
+CC	= gcc
+CCC	= gcc
 CFLAGS	= -O2
 OBJECTS	= Border.o Buttons.o Client.o Events.o Main.o Manager.o Rotated.o listimpl.o
 

          
@@ 12,7 12,7 @@ OBJECTS	= Border.o Buttons.o Client.o Ev
 	$(CCC) -c $(CFLAGS) $<
 
 wm2:	$(OBJECTS)
-	$(CCC) -o wm2 $(OBJECTS) $(LIBS)
+	mv -f wm2 wm2.old ; $(CCC) -o wm2 $(OBJECTS) $(LIBS)
 
 depend:
 	makedepend -- $(CFLAGS) -- *.C

          
@@ 20,92 20,3 @@ depend:
 clean:
 	rm -f *.o wm2 core
 
-# DO NOT DELETE
-
-Border.o: Border.h General.h /usr/include/unistd.h /usr/include/sys/types.h
-Border.o: /usr/include/sgidefs.h /usr/include/sys/bsd_types.h
-Border.o: /usr/include/sys/select.h /usr/include/sys/time.h
-Border.o: /usr/include/stdio.h /usr/include/signal.h
-Border.o: /usr/include/sys/signal.h /usr/include/sys/siginfo.h
-Border.o: /usr/include/errno.h /usr/include/sys/errno.h /usr/include/stdlib.h
-Border.o: /usr/include/X11/X.h /usr/include/X11/Xlib.h
-Border.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
-Border.o: /usr/include/stddef.h /usr/include/X11/Xos.h /usr/include/string.h
-Border.o: /usr/include/fcntl.h /usr/include/sys/fcntl.h
-Border.o: /usr/include/X11/Xutil.h /usr/include/X11/Xatom.h
-Border.o: /usr/include/X11/extensions/shape.h Config.h Rotated.h Client.h
-Border.o: Manager.h listmacro.h
-Buttons.o: Manager.h General.h /usr/include/unistd.h /usr/include/sys/types.h
-Buttons.o: /usr/include/sgidefs.h /usr/include/sys/bsd_types.h
-Buttons.o: /usr/include/sys/select.h /usr/include/sys/time.h
-Buttons.o: /usr/include/stdio.h /usr/include/signal.h
-Buttons.o: /usr/include/sys/signal.h /usr/include/sys/siginfo.h
-Buttons.o: /usr/include/errno.h /usr/include/sys/errno.h
-Buttons.o: /usr/include/stdlib.h /usr/include/X11/X.h /usr/include/X11/Xlib.h
-Buttons.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
-Buttons.o: /usr/include/stddef.h /usr/include/X11/Xos.h /usr/include/string.h
-Buttons.o: /usr/include/fcntl.h /usr/include/sys/fcntl.h
-Buttons.o: /usr/include/X11/Xutil.h /usr/include/X11/Xatom.h
-Buttons.o: /usr/include/X11/extensions/shape.h Config.h listmacro.h Client.h
-Buttons.o: Border.h Rotated.h
-Client.o: Manager.h General.h /usr/include/unistd.h /usr/include/sys/types.h
-Client.o: /usr/include/sgidefs.h /usr/include/sys/bsd_types.h
-Client.o: /usr/include/sys/select.h /usr/include/sys/time.h
-Client.o: /usr/include/stdio.h /usr/include/signal.h
-Client.o: /usr/include/sys/signal.h /usr/include/sys/siginfo.h
-Client.o: /usr/include/errno.h /usr/include/sys/errno.h /usr/include/stdlib.h
-Client.o: /usr/include/X11/X.h /usr/include/X11/Xlib.h
-Client.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
-Client.o: /usr/include/stddef.h /usr/include/X11/Xos.h /usr/include/string.h
-Client.o: /usr/include/fcntl.h /usr/include/sys/fcntl.h
-Client.o: /usr/include/X11/Xutil.h /usr/include/X11/Xatom.h
-Client.o: /usr/include/X11/extensions/shape.h Config.h listmacro.h Client.h
-Client.o: Border.h Rotated.h
-Events.o: Manager.h General.h /usr/include/unistd.h /usr/include/sys/types.h
-Events.o: /usr/include/sgidefs.h /usr/include/sys/bsd_types.h
-Events.o: /usr/include/sys/select.h /usr/include/sys/time.h
-Events.o: /usr/include/stdio.h /usr/include/signal.h
-Events.o: /usr/include/sys/signal.h /usr/include/sys/siginfo.h
-Events.o: /usr/include/errno.h /usr/include/sys/errno.h /usr/include/stdlib.h
-Events.o: /usr/include/X11/X.h /usr/include/X11/Xlib.h
-Events.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
-Events.o: /usr/include/stddef.h /usr/include/X11/Xos.h /usr/include/string.h
-Events.o: /usr/include/fcntl.h /usr/include/sys/fcntl.h
-Events.o: /usr/include/X11/Xutil.h /usr/include/X11/Xatom.h
-Events.o: /usr/include/X11/extensions/shape.h Config.h listmacro.h Client.h
-Events.o: Border.h Rotated.h
-Main.o: Manager.h General.h /usr/include/unistd.h /usr/include/sys/types.h
-Main.o: /usr/include/sgidefs.h /usr/include/sys/bsd_types.h
-Main.o: /usr/include/sys/select.h /usr/include/sys/time.h
-Main.o: /usr/include/stdio.h /usr/include/signal.h /usr/include/sys/signal.h
-Main.o: /usr/include/sys/siginfo.h /usr/include/errno.h
-Main.o: /usr/include/sys/errno.h /usr/include/stdlib.h /usr/include/X11/X.h
-Main.o: /usr/include/X11/Xlib.h /usr/include/X11/Xfuncproto.h
-Main.o: /usr/include/X11/Xosdefs.h /usr/include/stddef.h
-Main.o: /usr/include/X11/Xos.h /usr/include/string.h /usr/include/fcntl.h
-Main.o: /usr/include/sys/fcntl.h /usr/include/X11/Xutil.h
-Main.o: /usr/include/X11/Xatom.h /usr/include/X11/extensions/shape.h Config.h
-Main.o: listmacro.h
-Manager.o: Manager.h General.h /usr/include/unistd.h /usr/include/sys/types.h
-Manager.o: /usr/include/sgidefs.h /usr/include/sys/bsd_types.h
-Manager.o: /usr/include/sys/select.h /usr/include/sys/time.h
-Manager.o: /usr/include/stdio.h /usr/include/signal.h
-Manager.o: /usr/include/sys/signal.h /usr/include/sys/siginfo.h
-Manager.o: /usr/include/errno.h /usr/include/sys/errno.h
-Manager.o: /usr/include/stdlib.h /usr/include/X11/X.h /usr/include/X11/Xlib.h
-Manager.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
-Manager.o: /usr/include/stddef.h /usr/include/X11/Xos.h /usr/include/string.h
-Manager.o: /usr/include/fcntl.h /usr/include/sys/fcntl.h
-Manager.o: /usr/include/X11/Xutil.h /usr/include/X11/Xatom.h
-Manager.o: /usr/include/X11/extensions/shape.h Config.h listmacro.h Client.h
-Manager.o: Border.h Rotated.h /usr/include/X11/Xproto.h
-Manager.o: /usr/include/X11/Xmd.h /usr/include/X11/Xprotostr.h
-Manager.o: /usr/include/sys/wait.h Cursors.h
-Rotated.o: /usr/include/X11/Xlib.h /usr/include/sys/types.h
-Rotated.o: /usr/include/sgidefs.h /usr/include/sys/bsd_types.h
-Rotated.o: /usr/include/sys/select.h /usr/include/X11/X.h
-Rotated.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
-Rotated.o: /usr/include/stddef.h /usr/include/X11/Xutil.h
-Rotated.o: /usr/include/stdlib.h /usr/include/string.h /usr/include/stdio.h
-Rotated.o: Rotated.h
-listimpl.o: /usr/include/stdio.h /usr/include/stdlib.h /usr/include/sgidefs.h

          
M Manager.C +36 -17
@@ 27,10 27,34 @@ implementPList(ClientList, Client);
 WindowManager::WindowManager() :
     m_menuGC(0), m_menuWindow(0), m_menuFont(0)
 {
-    fprintf(stderr, "wm2: Copyright (c) 1996 Chris Cannam\n"
+    fprintf(stderr, "\nwm2: Copyright (c) 1996 Chris Cannam\n"
 	    "     Parts derived from 9wm Copyright (c) 1994-96 David Hogan\n"
 	    "     %s\n     Copying and redistribution encouraged.  "
-	    "No warranty\n\n", XV_COPYRIGHT);
+	    "No warranty.\n", XV_COPYRIGHT);
+
+    if (CONFIG_CLICK_TO_FOCUS) {
+	if (CONFIG_RAISE_ON_FOCUS) {
+	    fprintf(stderr, "     Click to focus.  ");
+	} else {
+	    fatal("can't have click to focus without auto-raise");
+	}
+    } else {
+	if (CONFIG_RAISE_ON_FOCUS) {
+	    fprintf(stderr, "     Focus follows, auto-raise.  ");
+	} else {
+	    fprintf(stderr, "     Focus follows pointer.  ");
+	}
+    }
+
+    if (CONFIG_PROD_SHAPE) {
+	fprintf(stderr, "Shape prodding.  ");
+    }
+
+    if (CONFIG_EVERYTHING_ON_ROOT_MENU) {
+	fprintf(stderr, "All clients on menu.\n\n");
+    } else {
+	fprintf(stderr, "Hidden clients only on menu.\n\n");
+    }
 
     m_display = XOpenDisplay(NULL);
     if (!m_display) fatal("can't open display");

          
@@ 197,11 221,12 @@ void WindowManager::initialiseScreen()
     m_defaultColormap = DefaultColormap(m_display, i);
     m_minimumColormaps = MinCmapsOfScreen(ScreenOfDisplay(m_display, i));
 
-    unsigned long blackPixel = BlackPixel(m_display, i);
-    unsigned long whitePixel = WhitePixel(m_display, i);
+    XColor black, white, temp;
 
-    XColor black = { blackPixel, 0, 0, 0, 7, ' ' };
-    XColor white = { whitePixel, 0xffff, 0xffff, 0xffff, 7, ' ' };
+    if (!XAllocNamedColor(m_display, m_defaultColormap, "black", &black, &temp))
+	fatal("couldn't load colour \"black\"!");
+    if (!XAllocNamedColor(m_display, m_defaultColormap, "white", &white, &temp))
+	fatal("couldn't load colour \"white\"!");
 
     m_cursor = makeCursor
 	(m_display, m_root, cursor_bits, cursor_mask_bits,

          
@@ 236,20 261,20 @@ void WindowManager::initialiseScreen()
     XChangeWindowAttributes(m_display, m_root, CWCursor | CWEventMask, &attr);
     XSync(m_display, False);
 
-    XColor nearest, ideal;
+    XColor nearest;
 
     if (!XAllocNamedColor(m_display, m_defaultColormap,
-			  CONFIG_MENU_FOREGROUND, &nearest, &ideal)) {
+			  CONFIG_MENU_FOREGROUND, &nearest, &temp)) {
 	fatal("couldn't load menu foreground colour");
     } else m_menuForegroundPixel = nearest.pixel;
     
     if (!XAllocNamedColor(m_display, m_defaultColormap,
-			  CONFIG_MENU_BACKGROUND, &nearest, &ideal)) {
+			  CONFIG_MENU_BACKGROUND, &nearest, &temp)) {
 	fatal("couldn't load menu background colour");
     } else m_menuBackgroundPixel = nearest.pixel;
     
     if (!XAllocNamedColor(m_display, m_defaultColormap,
-			  CONFIG_MENU_BORDERS, &nearest, &ideal)) {
+			  CONFIG_MENU_BORDERS, &nearest, &temp)) {
 	fatal("couldn't load menu border colour");
     } else m_menuBorderPixel = nearest.pixel;
 

          
@@ 381,11 406,6 @@ void WindowManager::installColormap(Colo
     }
 }
 
-void WindowManager::clearColormapFocus()
-{
-    installColormap(None);
-}
-
 void WindowManager::clearFocus()
 {
     static Window w = 0;

          
@@ 405,7 425,7 @@ void WindowManager::clearFocus()
 	    }
 	}
 
-	clearColormapFocus();
+	installColormap(None);
     }
 
     if (w == 0) {

          
@@ 509,7 529,6 @@ void WindowManager::spawn()
 		char *pstring = (char *)malloc(strlen(displayName) + 10);
 		sprintf(pstring, "DISPLAY=%s", displayName);
 		putenv(pstring);
-		free(pstring);
 	    }
 
 	    if (CONFIG_EXEC_USING_SHELL) {

          
M Manager.h +2 -8
@@ 14,20 14,15 @@ public:
     WindowManager();
     ~WindowManager();
 
-    void clearFocus();
-    void clearColormapFocus();
-
     void fatal(const char *);
 
-    int timestamp(Boolean reset);
-    Boolean initialising() { return m_initialising; }
-
     // for call from Client and within:
 
     Client *windowToClient(Window, Boolean create = False);
-    Client *selectClient(Boolean needRelease, Boolean *shift);
     Client *activeClient() { return m_activeClient; }
     Boolean raiseTransients(Client *); // true if raised any
+    int timestamp(Boolean reset);
+    void clearFocus();
 
     void setActiveClient(Client *const c) { m_activeClient = c; }
 

          
@@ 117,7 112,6 @@ private:
     void eventEnter(XCrossingEvent *);
     void eventReparent(XReparentEvent *);
     void eventFocusIn(XFocusInEvent *);
-    void eventShapeNotify(XShapeEvent *);
 };
 
 #endif

          
M README +21 -9
@@ 21,14 21,21 @@ wm2 provides:
   -- No virtual desktop, toolbars or integrated applications.
 
 
+This release
+============
+
+This is the second release of wm2.  It differs in some ways from the
+first release.
+
+
 Building wm2
 ============
 
 You will need a Unix machine, X libraries and a C++ compiler such as
-gcc.  You will also need a mouse, with a button.  Your X server and
-libraries must be R4 or newer and must support the Shape extension.
-wm2 does NOT support multi-screen displays, because I don't have
-anything to test multi-screen code on.
+gcc.  You will also need a mouse, with at least one button.  Your X
+server and libraries must be R4 or newer and must support the Shape
+extension.  wm2 does NOT support multi-screen displays, because I
+don't have anything to test multi-screen code on.
 
 wm2 makes relatively heavy demands on the performance of your X
 server, because of the use of shaped windows, but it shouldn't place

          
@@ 62,10 69,12 @@ Available window manipulations are:
  -- To focus a window: depends on the focus policy you selected
     in Config.h before compiling.  The default distribution has
     focus-follows-pointer; if you prefer click-to-focus, edit
-    and rebuild.
+    and rebuild.  You can also choose focus-follows with auto-
+    raise, which should work a bit better in the second release
+    than it did in the first.
 
- -- To raise a window: click on its tab or frame.  (Depends on
-    your Config.h, though -- you can have raise-on-focus.)
+ -- To raise a window: click on its tab or frame, unless you have
+    auto-raise on focus set in Config.h.
 
  -- To move a window: make sure it's in focus, then click and drag
     on its tab.

          
@@ 90,8 99,11 @@ Available window manipulations are:
     click and drag on the bottom-left or top-right corner of
     the enclosing window frame.
 
-All move and resize operations are opaque.  There is no way to
-lower a window (apart from by raising others over it).
+ -- To lower a window: click with the right mouse button on its
+    tab or frame.  (This is the only new feature in the second
+    release.)
+
+All move and resize operations are opaque.
 
 
 Credits