Permalink
Browse files

* if no window has focus, focus is given to new windows

* if the focused window is closed and no previous window has ever had focus, focus is given to the first client
* integrated changes from Jeffrey Drake (thanks!):
	* fonts now closed properly on exit
* integrated more changes from Antti Nykänen:
	* fixed a compiler warning
* integrated more changes from David Lawrence Ramsey:
	* fixed a compiler warning
	* changes to the Makefile
	* many other misc changes!
  • Loading branch information...
1 parent d071d24 commit 86de0f702be4fcab2d528dda902d941b6fbeb598 @nickgravgaard committed Nov 12, 2006
Showing with 223 additions and 151 deletions.
  1. +14 −0 CHANGELOG
  2. +16 −9 Makefile
  3. +1 −1 README
  4. +6 −7 client.c
  5. +25 −25 events.c
  6. +5 −6 main.c
  7. +7 −7 manage.c
  8. +53 −55 menufile.c
  9. +37 −6 misc.c
  10. +7 −11 new.c
  11. +2 −2 taskbar.c
  12. +1 −1 windowlab.1x
  13. +49 −21 windowlab.h
View
@@ -1,3 +1,17 @@
+1.34 (2006-11-12)
+
+* if no window has focus, focus is given to new windows
+* if the focused window is closed and no previous window has ever had focus, focus is given to the first client
+* integrated changes from Jeffrey Drake (thanks!):
+ * fonts now closed properly on exit
+* integrated more changes from Antti Nyk�nen:
+ * fixed a compiler warning
+* integrated more changes from David Lawrence Ramsey:
+ * fixed a compiler warning
+ * changes to the Makefile
+ * many other misc changes!
+
+
1.33 (2005-10-16)
* integrated changes from Dushkin (thanks!):
View
@@ -4,13 +4,23 @@
DEFINES += -DSHAPE
EXTRA_LIBS += -lXext
+# Set this to the hardcoded location of all files if it's not /
+PREFIX =
+
+# Set this to the location of the X installation you want to compile against
+XROOT = /usr/X11R6
+
+# Set this to the location of the global configuration files
+SYSCONFDIR = $(PREFIX)/etc/X11/windowlab
+
# Information about the location of the menurc file
ifndef MENURC
-MENURC = /etc/X11/windowlab/windowlab.menurc
+MENURC = $(SYSCONFDIR)/windowlab.menurc
endif
+
DEFINES += -DDEF_MENURC="\"$(MENURC)\""
-# Uncomment to add MWM hints supports (needs Lesstif headers)
+# Uncomment to add MWM hints support
#DEFINES += -DMWM_HINTS
# Uncomment to add freetype support (requires XFree86 4.0.2 or later)
@@ -22,19 +32,16 @@ DEFINES += -DDEF_MENURC="\"$(MENURC)\""
# Uncomment for debugging info (abandon all hope, ye who enter here)
#DEFINES += -DDEBUG
-# Set this to the location of the X installation you want to compile against
-XROOT = /usr/X11R6
-
# --------------------------------------------------------------------
CC = gcc
ifndef CFLAGS
CFLAGS = -g -O2 -Wall -W
endif
-BINDIR = $(DESTDIR)$(XROOT)/bin
-MANDIR = $(DESTDIR)$(XROOT)/man/man1
-CFGDIR = $(DESTDIR)/etc/X11/windowlab
+BINDIR = $(DESTDIR)$(PREFIX)$(XROOT)/bin
+MANDIR = $(DESTDIR)$(PREFIX)$(XROOT)/man/man1
+CFGDIR = $(DESTDIR)$(SYSCONFDIR)
INCLUDES = -I$(XROOT)/include $(EXTRA_INC)
LDPATH = -L$(XROOT)/lib
LIBS = -lX11 $(EXTRA_LIBS)
@@ -54,7 +61,7 @@ $(OBJS): %.o: %.c $(HEADERS)
install: all
mkdir -p $(BINDIR) && install -m 755 -s $(PROG) $(BINDIR)
- mkdir -p $(MANDIR) && install -m 644 $(MANPAGE) $(MANDIR) && gzip -9vf $(MANDIR)/$(MANPAGE)
+ mkdir -p $(MANDIR) && install -m 644 $(MANPAGE) $(MANDIR) && gzip -9vfn $(MANDIR)/$(MANPAGE)
mkdir -p $(CFGDIR) && cp -i windowlab.menurc $(CFGDIR)/windowlab.menurc && chmod 644 $(CFGDIR)/windowlab.menurc
clean:
View
@@ -1,5 +1,5 @@
WINDOWLAB
-Copyright (c) 2001-2005 Nick Gravgaard
+Copyright (c) 2001-2006 Nick Gravgaard
View
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
- * Copyright (c) 2001-2005 Nick Gravgaard
+ * Copyright (c) 2001-2006 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
@@ -15,10 +15,9 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <X11/Xmd.h>
#include "windowlab.h"
Client *find_client(Window w, int mode)
@@ -35,7 +34,7 @@ Client *find_client(Window w, int mode)
c = c->next;
}
}
- else //WINDOW
+ else // WINDOW
{
while (c != NULL)
{
@@ -49,7 +48,7 @@ Client *find_client(Window w, int mode)
return NULL;
}
-/* Attempt to follow the ICCCM by explicity specifying 32 bits for
+/* Attempt to follow the ICCCM by explicitly specifying 32 bits for
* this property. Does this goof up on 64 bit systems? */
void set_wm_state(Client *c, int state)
@@ -240,7 +239,7 @@ void redraw(Client *c)
* left corner of the window when there is no WM needs to match up
* with the top left of our fram once we manage it, and likewise with
* SouthWest and the bottom right (these are the only values I ever
- * use, but the others should be obvious.) Our titlebar is on the top
+ * use, but the others should be obvious). Our titlebar is on the top
* so we only have to adjust in the first case. */
void gravitate(Client *c, int multiplier)
@@ -337,7 +336,7 @@ void check_focus(Client *c)
Client *get_prev_focused(void)
{
Client *c = head_client;
- Client *prev_focused = NULL;
+ Client *prev_focused = head_client; // return head_client if nothing else has been given focus earlier
unsigned int highest = 0;
while (c != NULL)
{
View
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
- * Copyright (c) 2001-2005 Nick Gravgaard
+ * Copyright (c) 2001-2006 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <X11/Xatom.h>
@@ -153,40 +153,40 @@ static void handle_button_press(XButtonEvent *e)
{
switch (e->button)
{
- case Button1:
+ case Button1: // left mouse button
lclick_taskbar(e->x);
break;
- case Button3:
+ case Button3: // right mouse button
rclick_taskbar(e->x);
break;
case Button4: // mouse wheel up
cycle_previous();
break;
- case Button5:
- cycle_next(); // mouse wheel down
+ case Button5: // mouse wheel down
+ cycle_next();
break;
}
}
else
{
// pass event on
- XAllowEvents(dsply, ReplayPointer, CurrentTime);
- if (e->button == Button1)
- {
- c = find_client(e->window, FRAME);
- if (c != NULL)
- {
- // click-to-focus
- check_focus(c);
- if (e->y < BARHEIGHT() && c != fullscreen_client)
- {
- handle_windowbar_click(e, c);
- }
- }
- }
- else if (e->button == Button3)
- {
- rclick_root();
+ XAllowEvents(dsply, ReplayPointer, CurrentTime);
+ if (e->button == Button1)
+ {
+ c = find_client(e->window, FRAME);
+ if (c != NULL)
+ {
+ // click-to-focus
+ check_focus(c);
+ if (e->y < BARHEIGHT() && c != fullscreen_client)
+ {
+ handle_windowbar_click(e, c);
+ }
+ }
+ }
+ else if (e->button == Button3)
+ {
+ rclick_root();
}
}
}
@@ -306,7 +306,7 @@ static void draw_button(Client *c, GC *detail_gc, GC *background_gc, unsigned in
* For clients we manage, we need to fiddle with the frame and the
* client window, and for unmanaged windows we have to pass along
* everything unchanged. Thankfully, we can reuse (a) the
- * XWindowChanges struct and (c) the code to configure the client
+ * XWindowChanges struct and (b) the code to configure the client
* window in both cases.
*
* Most of the assignments here are going to be garbage, but only the
@@ -400,7 +400,7 @@ static void handle_configure_request(XConfigureRequestEvent *e)
XConfigureWindow(dsply, e->window, e->value_mask, &wc);
}
-/* Two possiblilies if a client is asking to be mapped. One is that
+/* Two possibilities if a client is asking to be mapped. One is that
* it's a new window, so we handle that if it isn't in our clients
* list anywhere. The other is that it already exists and wants to
* de-iconify, which is simple to take care of. */
View
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
- * Copyright (c) 2001-2005 Nick Gravgaard
+ * Copyright (c) 2001-2006 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <string.h>
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
OPT_STR("-display", opt_display)
if (strcmp(argv[i], "-about") == 0)
{
- printf("WindowLab " VERSION " (" RELEASEDATE "), Copyright (c) 2001-2005 Nick Gravgaard\nWindowLab comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; view the LICENCE file for details.\n");
+ printf("WindowLab " VERSION " (" RELEASEDATE "), Copyright (c) 2001-2006 Nick Gravgaard\nWindowLab comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; view the LICENCE file for details.\n");
exit(0);
}
// shouldn't get here; must be a bad option
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
make_taskbar();
scan_wins();
do_event_loop();
- return 1; //just another brick in the -Wall
+ return 1; // just another brick in the -Wall
}
static void scan_wins(void)
@@ -204,8 +204,7 @@ static void setup_display(void)
resize_curs = XCreateFontCursor(dsply, XC_fleur);
- /* find out which modifier is NumLock - we'll use this when grabbing
- * every combination of modifiers we can think of */
+ /* find out which modifier is NumLock - we'll use this when grabbing every combination of modifiers we can think of */
modmap = XGetModifierMapping(dsply);
for (i = 0; i < 8; i++)
{
View
@@ -1,5 +1,5 @@
/* WindowLab - an X11 window manager
- * Copyright (c) 2001-2005 Nick Gravgaard
+ * Copyright (c) 2001-2006 Nick Gravgaard
* me at nickgravgaard.com
* http://nickgravgaard.com/windowlab/
*
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "windowlab.h"
@@ -40,8 +40,7 @@ void raise_lower(Client *c)
}
}
-/* Increment ignore_unmap here and decrement it in handle_unmap_event in
- * events.c */
+/* increment ignore_unmap here and decrement it in handle_unmap_event in events.c */
void hide(Client *c)
{
@@ -300,11 +299,11 @@ void resize(Client *c, int x, int y)
XMapRaised(dsply, resizebar_win);
#ifdef XFT
- // temporarily swap drawables in order to draw on the resize windows XFT context
+ // temporarily swap drawables in order to draw on the resize window's XFT context
XftDrawChange(c->xftdraw, (Drawable) resizebar_win);
#endif
- // hide real windows frame
+ // hide real window's frame
XUnmapWindow(dsply, c->frame);
do
@@ -469,7 +468,7 @@ void resize(Client *c, int x, int y)
XMoveResizeWindow(dsply, c->frame, c->x, c->y - BARHEIGHT(), c->width, c->height + BARHEIGHT());
XResizeWindow(dsply, c->window, c->width, c->height);
- // unhide real windows frame
+ // unhide real window's frame
XMapWindow(dsply, c->frame);
XSetInputFocus(dsply, c->window, RevertToNone, CurrentTime);
@@ -586,6 +585,7 @@ void write_titletext(Client *c, Window bar_win)
if (!c->trans && c->name != NULL)
{
#ifdef XFT
+ (void) bar_win; // fixes a warning
XftDrawString8(c->xftdraw, &xft_detail, xftfont, SPACE, SPACE + xftfont->ascent, (unsigned char *)c->name, strlen(c->name));
#else
XDrawString(dsply, bar_win, text_gc, SPACE, SPACE + font->ascent, c->name, strlen(c->name));
Oops, something went wrong.

0 comments on commit 86de0f7

Please sign in to comment.