dwm-meillo

changeset 164:21071ae1fe68

made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
author arg@10ksloc.org
date Wed, 02 Aug 2006 16:32:05 +0200
parents e2e1de08341d
children 4d828b431b72
files client.c config.arg.h config.h draw.c dwm.h event.c main.c tag.c util.c
diffstat 9 files changed, 92 insertions(+), 79 deletions(-) [+]
line diff
     1.1 --- a/client.c	Wed Aug 02 13:05:04 2006 +0200
     1.2 +++ b/client.c	Wed Aug 02 16:32:05 2006 +0200
     1.3 @@ -3,7 +3,6 @@
     1.4   * See LICENSE file for license details.
     1.5   */
     1.6  #include "dwm.h"
     1.7 -
     1.8  #include <stdlib.h>
     1.9  #include <string.h>
    1.10  #include <X11/Xatom.h>
    1.11 @@ -219,7 +218,7 @@
    1.12  	c->h = wa->height;
    1.13  	c->th = bh;
    1.14  
    1.15 -	c->border = 1;
    1.16 +	c->border = 0;
    1.17  	setsize(c);
    1.18  
    1.19  	if(c->h != sh && c->y < bh)
    1.20 @@ -254,8 +253,7 @@
    1.21  	if(!c->isfloat)
    1.22  		c->isfloat = trans
    1.23  			|| (c->maxw && c->minw &&
    1.24 -				c->maxw == c->minw && c->maxh == c->minh)
    1.25 -			|| (c->w == sw && c->h == sh);
    1.26 +				c->maxw == c->minw && c->maxh == c->minh);
    1.27  	settitle(c);
    1.28  	arrange(NULL);
    1.29  
    1.30 @@ -271,7 +269,7 @@
    1.31  {
    1.32  	int bottom = c->y + c->h;
    1.33  	int right = c->x + c->w;
    1.34 -	XConfigureEvent e;
    1.35 +	/*XConfigureEvent e;*/
    1.36  	XWindowChanges wc;
    1.37  
    1.38  	if(sizehints) {
    1.39 @@ -302,21 +300,11 @@
    1.40  	wc.y = c->y;
    1.41  	wc.width = c->w;
    1.42  	wc.height = c->h;
    1.43 -	wc.border_width = 1;
    1.44 -	XConfigureWindow(dpy, c->win,
    1.45 -			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
    1.46 -
    1.47 -	e.type = ConfigureNotify;
    1.48 -	e.event = c->win;
    1.49 -	e.window = c->win;
    1.50 -	e.x = c->x;
    1.51 -	e.y = c->y;
    1.52 -	e.width = c->w;
    1.53 -	e.height = c->h;
    1.54 -	e.border_width = c->border;
    1.55 -	e.above = None;
    1.56 -	e.override_redirect = False;
    1.57 -	XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
    1.58 +	if(c->w == sw && c->h == sh)
    1.59 +		wc.border_width = 0;
    1.60 +	else
    1.61 +		wc.border_width = 1;
    1.62 +	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
    1.63  	XSync(dpy, False);
    1.64  }
    1.65  
    1.66 @@ -403,8 +391,8 @@
    1.67  		oh = sel->h;
    1.68  		sel->x = sx;
    1.69  		sel->y = sy + bh;
    1.70 -		sel->w = sw - 2 * sel->border;
    1.71 -		sel->h = sh - 2 * sel->border - bh;
    1.72 +		sel->w = sw - 2;
    1.73 +		sel->h = sh - 2 - bh;
    1.74  
    1.75  		higher(sel);
    1.76  		resize(sel, False, TopLeft);
     2.1 --- a/config.arg.h	Wed Aug 02 13:05:04 2006 +0200
     2.2 +++ b/config.arg.h	Wed Aug 02 16:32:05 2006 +0200
     2.3 @@ -3,15 +3,6 @@
     2.4   * See LICENSE file for license details.
     2.5   */
     2.6  
     2.7 -#define DEFMODE			dotile /* dofloat */
     2.8 -#define FONT			"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
     2.9 -#define BGCOLOR			"#0a2c2d"
    2.10 -#define FGCOLOR			"#ddeeee"
    2.11 -#define BORDERCOLOR		"#176164"
    2.12 -#define MODKEY			Mod1Mask
    2.13 -#define NUMLOCKMASK		Mod2Mask
    2.14 -#define MASTERW			52 /* percent */
    2.15 -
    2.16  enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
    2.17  #define TAGS \
    2.18  char *tags[TLast] = { \
    2.19 @@ -21,7 +12,16 @@
    2.20  	[Twork] = "work", \
    2.21  	[Tmisc] = "misc", \
    2.22  };
    2.23 +
    2.24 +#define DEFMODE			dotile /* dofloat */
    2.25  #define DEFTAG			Tdev
    2.26 +#define FONT			"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
    2.27 +#define BGCOLOR			"#0a2c2d"
    2.28 +#define FGCOLOR			"#ddeeee"
    2.29 +#define BORDERCOLOR		"#176164"
    2.30 +#define MODKEY			Mod1Mask
    2.31 +#define NUMLOCKMASK		Mod2Mask
    2.32 +#define MASTERW			52 /* percent */
    2.33  
    2.34  #define KEYS \
    2.35  	const char *browse[] = { "firefox", NULL }; \
     3.1 --- a/config.h	Wed Aug 02 13:05:04 2006 +0200
     3.2 +++ b/config.h	Wed Aug 02 16:32:05 2006 +0200
     3.3 @@ -3,15 +3,6 @@
     3.4   * See LICENSE file for license details.
     3.5   */
     3.6  
     3.7 -#define DEFMODE			dotile /* dofloat */
     3.8 -#define FONT			"fixed"
     3.9 -#define BGCOLOR			"#666699"
    3.10 -#define FGCOLOR			"#eeeeee"
    3.11 -#define BORDERCOLOR		"#9999CC"
    3.12 -#define MODKEY			Mod1Mask
    3.13 -#define NUMLOCKMASK		Mod2Mask
    3.14 -#define MASTERW			52 /* percent */
    3.15 -
    3.16  enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
    3.17  #define TAGS \
    3.18  char *tags[TLast] = { \
    3.19 @@ -21,7 +12,16 @@
    3.20  	[Twork] = "work", \
    3.21  	[Tmisc] = "misc", \
    3.22  };
    3.23 +
    3.24 +#define DEFMODE			dotile /* dofloat */
    3.25  #define DEFTAG			Tdev
    3.26 +#define FONT			"fixed"
    3.27 +#define BGCOLOR			"#666699"
    3.28 +#define FGCOLOR			"#eeeeee"
    3.29 +#define BORDERCOLOR		"#9999CC"
    3.30 +#define MODKEY			Mod1Mask
    3.31 +#define NUMLOCKMASK		Mod2Mask
    3.32 +#define MASTERW			52 /* percent */
    3.33  
    3.34  #define KEYS \
    3.35  	const char *term[] = { "xterm", NULL }; \
     4.1 --- a/draw.c	Wed Aug 02 13:05:04 2006 +0200
     4.2 +++ b/draw.c	Wed Aug 02 16:32:05 2006 +0200
     4.3 @@ -3,7 +3,6 @@
     4.4   * See LICENSE file for license details.
     4.5   */
     4.6  #include "dwm.h"
     4.7 -
     4.8  #include <stdio.h>
     4.9  #include <string.h>
    4.10  #include <X11/Xlocale.h>
     5.1 --- a/dwm.h	Wed Aug 02 13:05:04 2006 +0200
     5.2 +++ b/dwm.h	Wed Aug 02 16:32:05 2006 +0200
     5.3 @@ -3,8 +3,8 @@
     5.4   * See LICENSE file for license details.
     5.5   */
     5.6  
     5.7 +#include CONFIG
     5.8  #include <X11/Xlib.h>
     5.9 -#include CONFIG
    5.10  
    5.11  /* mask shorthands, used in event.c and client.c */
    5.12  #define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
    5.13 @@ -57,8 +57,8 @@
    5.14  	int tx, ty, tw, th; /* title */
    5.15  	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
    5.16  	int grav;
    5.17 +	long flags; 
    5.18  	unsigned int border;
    5.19 -	long flags; 
    5.20  	Bool isfloat;
    5.21  	Bool ismax;
    5.22  	Client *next;
     6.1 --- a/event.c	Wed Aug 02 13:05:04 2006 +0200
     6.2 +++ b/event.c	Wed Aug 02 16:32:05 2006 +0200
     6.3 @@ -3,7 +3,6 @@
     6.4   * See LICENSE file for license details.
     6.5   */
     6.6  #include "dwm.h"
     6.7 -
     6.8  #include <stdlib.h>
     6.9  #include <X11/keysym.h>
    6.10  #include <X11/Xatom.h>
    6.11 @@ -151,32 +150,60 @@
    6.12  {
    6.13  	Client *c;
    6.14  	XConfigureRequestEvent *ev = &e->xconfigurerequest;
    6.15 +	XEvent synev;
    6.16  	XWindowChanges wc;
    6.17 +	unsigned long newmask;
    6.18  
    6.19 -	ev->value_mask &= ~CWSibling;
    6.20  	if((c = getclient(ev->window))) {
    6.21  		gravitate(c, True);
    6.22 -		if(ev->value_mask & CWX)
    6.23 -			c->x = ev->x;
    6.24 -		if(ev->value_mask & CWY)
    6.25 -			c->y = ev->y;
    6.26 -		if(ev->value_mask & CWWidth)
    6.27 -			c->w = ev->width;
    6.28 -		if(ev->value_mask & CWHeight)
    6.29 -			c->h = ev->height;
    6.30 +		if(c->isfloat) {
    6.31 +			if(ev->value_mask & CWX)
    6.32 +				c->x = ev->x;
    6.33 +			if(ev->value_mask & CWY)
    6.34 +				c->y = ev->y;
    6.35 +			if(ev->value_mask & CWWidth)
    6.36 +				c->w = ev->width;
    6.37 +			if(ev->value_mask & CWHeight)
    6.38 +				c->h = ev->height;
    6.39 +		}
    6.40  		if(ev->value_mask & CWBorderWidth)
    6.41 -			c->border = 1;
    6.42 +			c->border = ev->border_width;
    6.43  		gravitate(c, False);
    6.44 +
    6.45  		resize(c, True, TopLeft);
    6.46 +
    6.47 +		wc.x = c->x;
    6.48 +		wc.y = c->y;
    6.49 +		wc.width = c->w;
    6.50 +		wc.height = c->h;
    6.51 +		newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
    6.52 +		if(newmask)
    6.53 +			XConfigureWindow(dpy, c->win, newmask, &wc);
    6.54 +		else {
    6.55 +			synev.type = ConfigureNotify;
    6.56 +			synev.xconfigure.display = dpy;
    6.57 +			synev.xconfigure.event = c->win;
    6.58 +			synev.xconfigure.window = c->win;
    6.59 +			synev.xconfigure.x = c->x;
    6.60 +			synev.xconfigure.y = c->y;
    6.61 +			synev.xconfigure.width = c->w;
    6.62 +			synev.xconfigure.height = c->h;
    6.63 +			synev.xconfigure.border_width = c->border;
    6.64 +			synev.xconfigure.above = None;
    6.65 +			/* Send synthetic ConfigureNotify */
    6.66 +			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
    6.67 +		}
    6.68  	}
    6.69 -
    6.70 -	wc.x = ev->x;
    6.71 -	wc.y = ev->y;
    6.72 -	wc.width = ev->width;
    6.73 -	wc.height = ev->height;
    6.74 -	wc.border_width = 1;
    6.75 -	XConfigureWindow(dpy, ev->window,
    6.76 -			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
    6.77 +	else {
    6.78 +		wc.x = ev->x;
    6.79 +		wc.y = ev->y;
    6.80 +		wc.width = ev->width;
    6.81 +		wc.height = ev->height;
    6.82 +		wc.border_width = ev->border_width;
    6.83 +		wc.sibling = ev->above;
    6.84 +		wc.stack_mode = ev->detail;
    6.85 +		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
    6.86 +	}
    6.87  	XSync(dpy, False);
    6.88  }
    6.89  
     7.1 --- a/main.c	Wed Aug 02 13:05:04 2006 +0200
     7.2 +++ b/main.c	Wed Aug 02 16:32:05 2006 +0200
     7.3 @@ -4,7 +4,6 @@
     7.4   */
     7.5  
     7.6  #include "dwm.h"
     7.7 -
     7.8  #include <errno.h>
     7.9  #include <stdio.h>
    7.10  #include <stdlib.h>
    7.11 @@ -15,7 +14,6 @@
    7.12  #include <X11/Xatom.h>
    7.13  #include <X11/Xproto.h>
    7.14  
    7.15 -
    7.16  /* static */
    7.17  
    7.18  static int (*xerrorxlib)(Display *, XErrorEvent *);
    7.19 @@ -165,6 +163,7 @@
    7.20  	int i;
    7.21  	unsigned int mask;
    7.22  	fd_set rd;
    7.23 +	Bool readin = True;
    7.24  	Window w;
    7.25  	XEvent ev;
    7.26  	XSetWindowAttributes wa;
    7.27 @@ -251,7 +250,8 @@
    7.28  	/* main event loop, reads status text from stdin as well */
    7.29  	while(running) {
    7.30  		FD_ZERO(&rd);
    7.31 -		FD_SET(STDIN_FILENO, &rd);
    7.32 +		if(readin)
    7.33 +			FD_SET(STDIN_FILENO, &rd);
    7.34  		FD_SET(ConnectionNumber(dpy), &rd);
    7.35  
    7.36  		i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
    7.37 @@ -267,11 +267,12 @@
    7.38  						(handler[ev.type])(&ev); /* call handler */
    7.39  				}
    7.40  			}
    7.41 -			if(FD_ISSET(STDIN_FILENO, &rd)) {
    7.42 -				if(!fgets(stext, sizeof(stext), stdin))
    7.43 -					break;
    7.44 +			if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
    7.45 +				readin = NULL != fgets(stext, sizeof(stext), stdin);
    7.46 +				if(readin)
    7.47 +					stext[strlen(stext) - 1] = 0;
    7.48  				else 
    7.49 -					stext[strlen(stext) - 1] = 0;
    7.50 +					strcpy(stext, "broken pipe");
    7.51  				drawstatus();
    7.52  			}
    7.53  		}
     8.1 --- a/tag.c	Wed Aug 02 13:05:04 2006 +0200
     8.2 +++ b/tag.c	Wed Aug 02 16:32:05 2006 +0200
     8.3 @@ -3,7 +3,6 @@
     8.4   * See LICENSE file for license details.
     8.5   */
     8.6  #include "dwm.h"
     8.7 -
     8.8  #include <regex.h>
     8.9  #include <stdio.h>
    8.10  #include <string.h>
    8.11 @@ -86,26 +85,26 @@
    8.12  			if(n == 1) {
    8.13  				c->x = sx;
    8.14  				c->y = sy + bh;
    8.15 -				c->w = sw - 2 * c->border;
    8.16 -				c->h = sh - 2 * c->border - bh;
    8.17 +				c->w = sw - 2;
    8.18 +				c->h = sh - 2 - bh;
    8.19  			}
    8.20  			else if(i == 0) {
    8.21  				c->x = sx;
    8.22  				c->y = sy + bh;
    8.23 -				c->w = mw - 2 * c->border;
    8.24 -				c->h = sh - 2 * c->border - bh;
    8.25 +				c->w = mw - 2;
    8.26 +				c->h = sh - 2 - bh;
    8.27  			}
    8.28  			else if(h > bh) {
    8.29  				c->x = sx + mw;
    8.30  				c->y = sy + (i - 1) * h + bh;
    8.31 -				c->w = w - 2 * c->border;
    8.32 -				c->h = h - 2 * c->border;
    8.33 +				c->w = w - 2;
    8.34 +				c->h = h - 2;
    8.35  			}
    8.36  			else { /* fallback if h < bh */
    8.37  				c->x = sx + mw;
    8.38  				c->y = sy + bh;
    8.39 -				c->w = w - 2 * c->border;
    8.40 -				c->h = sh - 2 * c->border - bh;
    8.41 +				c->w = w - 2;
    8.42 +				c->h = sh - 2 - bh;
    8.43  			}
    8.44  			resize(c, False, TopLeft);
    8.45  			i++;
     9.1 --- a/util.c	Wed Aug 02 13:05:04 2006 +0200
     9.2 +++ b/util.c	Wed Aug 02 16:32:05 2006 +0200
     9.3 @@ -3,7 +3,6 @@
     9.4   * See LICENSE file for license details.
     9.5   */
     9.6  #include "dwm.h"
     9.7 -
     9.8  #include <stdarg.h>
     9.9  #include <stdio.h>
    9.10  #include <stdlib.h>