summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
committerarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
commit95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6 (patch)
tree98283068f4576b8b2e825dd5eff0eb6e94ddbdc0
parentnew stuff (diff)
downloaddwm-95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6.tar.gz
dwm-95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6.zip
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
Diffstat (limited to '')
-rw-r--r--client.c32
-rw-r--r--config.arg.h18
-rw-r--r--config.h18
-rw-r--r--draw.c1
-rw-r--r--dwm.h4
-rw-r--r--event.c65
-rw-r--r--main.c15
-rw-r--r--tag.c17
-rw-r--r--util.c1
9 files changed, 92 insertions, 79 deletions
diff --git a/client.c b/client.c
index 5912c77..b6bda92 100644
--- a/client.c
+++ b/client.c
@@ -3,7 +3,6 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5#include "dwm.h" 5#include "dwm.h"
6
7#include <stdlib.h> 6#include <stdlib.h>
8#include <string.h> 7#include <string.h>
9#include <X11/Xatom.h> 8#include <X11/Xatom.h>
@@ -219,7 +218,7 @@ manage(Window w, XWindowAttributes *wa)
219 c->h = wa->height; 218 c->h = wa->height;
220 c->th = bh; 219 c->th = bh;
221 220
222 c->border = 1; 221 c->border = 0;
223 setsize(c); 222 setsize(c);
224 223
225 if(c->h != sh && c->y < bh) 224 if(c->h != sh && c->y < bh)
@@ -254,8 +253,7 @@ manage(Window w, XWindowAttributes *wa)
254 if(!c->isfloat) 253 if(!c->isfloat)
255 c->isfloat = trans 254 c->isfloat = trans
256 || (c->maxw && c->minw && 255 || (c->maxw && c->minw &&
257 c->maxw == c->minw && c->maxh == c->minh) 256 c->maxw == c->minw && c->maxh == c->minh);
258 || (c->w == sw && c->h == sh);
259 settitle(c); 257 settitle(c);
260 arrange(NULL); 258 arrange(NULL);
261 259
@@ -271,7 +269,7 @@ resize(Client *c, Bool sizehints, Corner sticky)
271{ 269{
272 int bottom = c->y + c->h; 270 int bottom = c->y + c->h;
273 int right = c->x + c->w; 271 int right = c->x + c->w;
274 XConfigureEvent e; 272 /*XConfigureEvent e;*/
275 XWindowChanges wc; 273 XWindowChanges wc;
276 274
277 if(sizehints) { 275 if(sizehints) {
@@ -302,21 +300,11 @@ resize(Client *c, Bool sizehints, Corner sticky)
302 wc.y = c->y; 300 wc.y = c->y;
303 wc.width = c->w; 301 wc.width = c->w;
304 wc.height = c->h; 302 wc.height = c->h;
305 wc.border_width = 1; 303 if(c->w == sw && c->h == sh)
306 XConfigureWindow(dpy, c->win, 304 wc.border_width = 0;
307 CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); 305 else
308 306 wc.border_width = 1;
309 e.type = ConfigureNotify; 307 XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
310 e.event = c->win;
311 e.window = c->win;
312 e.x = c->x;
313 e.y = c->y;
314 e.width = c->w;
315 e.height = c->h;
316 e.border_width = c->border;
317 e.above = None;
318 e.override_redirect = False;
319 XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
320 XSync(dpy, False); 308 XSync(dpy, False);
321} 309}
322 310
@@ -403,8 +391,8 @@ togglemax(Arg *arg)
403 oh = sel->h; 391 oh = sel->h;
404 sel->x = sx; 392 sel->x = sx;
405 sel->y = sy + bh; 393 sel->y = sy + bh;
406 sel->w = sw - 2 * sel->border; 394 sel->w = sw - 2;
407 sel->h = sh - 2 * sel->border - bh; 395 sel->h = sh - 2 - bh;
408 396
409 higher(sel); 397 higher(sel);
410 resize(sel, False, TopLeft); 398 resize(sel, False, TopLeft);
diff --git a/config.arg.h b/config.arg.h
index 80d4918..933bcfb 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -3,15 +3,6 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5 5
6#define DEFMODE dotile /* dofloat */
7#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
8#define BGCOLOR "#0a2c2d"
9#define FGCOLOR "#ddeeee"
10#define BORDERCOLOR "#176164"
11#define MODKEY Mod1Mask
12#define NUMLOCKMASK Mod2Mask
13#define MASTERW 52 /* percent */
14
15enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; 6enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
16#define TAGS \ 7#define TAGS \
17char *tags[TLast] = { \ 8char *tags[TLast] = { \
@@ -21,7 +12,16 @@ char *tags[TLast] = { \
21 [Twork] = "work", \ 12 [Twork] = "work", \
22 [Tmisc] = "misc", \ 13 [Tmisc] = "misc", \
23}; 14};
15
16#define DEFMODE dotile /* dofloat */
24#define DEFTAG Tdev 17#define DEFTAG Tdev
18#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
19#define BGCOLOR "#0a2c2d"
20#define FGCOLOR "#ddeeee"
21#define BORDERCOLOR "#176164"
22#define MODKEY Mod1Mask
23#define NUMLOCKMASK Mod2Mask
24#define MASTERW 52 /* percent */
25 25
26#define KEYS \ 26#define KEYS \
27 const char *browse[] = { "firefox", NULL }; \ 27 const char *browse[] = { "firefox", NULL }; \
diff --git a/config.h b/config.h
index d9070e3..1e8cb39 100644
--- a/config.h
+++ b/config.h
@@ -3,15 +3,6 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5 5
6#define DEFMODE dotile /* dofloat */
7#define FONT "fixed"
8#define BGCOLOR "#666699"
9#define FGCOLOR "#eeeeee"
10#define BORDERCOLOR "#9999CC"
11#define MODKEY Mod1Mask
12#define NUMLOCKMASK Mod2Mask
13#define MASTERW 52 /* percent */
14
15enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; 6enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
16#define TAGS \ 7#define TAGS \
17char *tags[TLast] = { \ 8char *tags[TLast] = { \
@@ -21,7 +12,16 @@ char *tags[TLast] = { \
21 [Twork] = "work", \ 12 [Twork] = "work", \
22 [Tmisc] = "misc", \ 13 [Tmisc] = "misc", \
23}; 14};
15
16#define DEFMODE dotile /* dofloat */
24#define DEFTAG Tdev 17#define DEFTAG Tdev
18#define FONT "fixed"
19#define BGCOLOR "#666699"
20#define FGCOLOR "#eeeeee"
21#define BORDERCOLOR "#9999CC"
22#define MODKEY Mod1Mask
23#define NUMLOCKMASK Mod2Mask
24#define MASTERW 52 /* percent */
25 25
26#define KEYS \ 26#define KEYS \
27 const char *term[] = { "xterm", NULL }; \ 27 const char *term[] = { "xterm", NULL }; \
diff --git a/draw.c b/draw.c
index 4f8594c..4ba5cd6 100644
--- a/draw.c
+++ b/draw.c
@@ -3,7 +3,6 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5#include "dwm.h" 5#include "dwm.h"
6
7#include <stdio.h> 6#include <stdio.h>
8#include <string.h> 7#include <string.h>
9#include <X11/Xlocale.h> 8#include <X11/Xlocale.h>
diff --git a/dwm.h b/dwm.h
index 0ed778c..803fe9f 100644
--- a/dwm.h
+++ b/dwm.h
@@ -3,8 +3,8 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5 5
6#include <X11/Xlib.h>
7#include CONFIG 6#include CONFIG
7#include <X11/Xlib.h>
8 8
9/* mask shorthands, used in event.c and client.c */ 9/* mask shorthands, used in event.c and client.c */
10#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask) 10#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
@@ -57,8 +57,8 @@ struct Client {
57 int tx, ty, tw, th; /* title */ 57 int tx, ty, tw, th; /* title */
58 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 58 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
59 int grav; 59 int grav;
60 unsigned int border;
61 long flags; 60 long flags;
61 unsigned int border;
62 Bool isfloat; 62 Bool isfloat;
63 Bool ismax; 63 Bool ismax;
64 Client *next; 64 Client *next;
diff --git a/event.c b/event.c
index faee103..0c159c7 100644
--- a/event.c
+++ b/event.c
@@ -3,7 +3,6 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5#include "dwm.h" 5#include "dwm.h"
6
7#include <stdlib.h> 6#include <stdlib.h>
8#include <X11/keysym.h> 7#include <X11/keysym.h>
9#include <X11/Xatom.h> 8#include <X11/Xatom.h>
@@ -151,32 +150,60 @@ configurerequest(XEvent *e)
151{ 150{
152 Client *c; 151 Client *c;
153 XConfigureRequestEvent *ev = &e->xconfigurerequest; 152 XConfigureRequestEvent *ev = &e->xconfigurerequest;
153 XEvent synev;
154 XWindowChanges wc; 154 XWindowChanges wc;
155 unsigned long newmask;
155 156
156 ev->value_mask &= ~CWSibling;
157 if((c = getclient(ev->window))) { 157 if((c = getclient(ev->window))) {
158 gravitate(c, True); 158 gravitate(c, True);
159 if(ev->value_mask & CWX) 159 if(c->isfloat) {
160 c->x = ev->x; 160 if(ev->value_mask & CWX)
161 if(ev->value_mask & CWY) 161 c->x = ev->x;
162 c->y = ev->y; 162 if(ev->value_mask & CWY)
163 if(ev->value_mask & CWWidth) 163 c->y = ev->y;
164 c->w = ev->width; 164 if(ev->value_mask & CWWidth)
165 if(ev->value_mask & CWHeight) 165 c->w = ev->width;
166 c->h = ev->height; 166 if(ev->value_mask & CWHeight)
167 c->h = ev->height;
168 }
167 if(ev->value_mask & CWBorderWidth) 169 if(ev->value_mask & CWBorderWidth)
168 c->border = 1; 170 c->border = ev->border_width;
169 gravitate(c, False); 171 gravitate(c, False);
172
170 resize(c, True, TopLeft); 173 resize(c, True, TopLeft);
171 }
172 174
173 wc.x = ev->x; 175 wc.x = c->x;
174 wc.y = ev->y; 176 wc.y = c->y;
175 wc.width = ev->width; 177 wc.width = c->w;
176 wc.height = ev->height; 178 wc.height = c->h;
177 wc.border_width = 1; 179 newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
178 XConfigureWindow(dpy, ev->window, 180 if(newmask)
179 CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); 181 XConfigureWindow(dpy, c->win, newmask, &wc);
182 else {
183 synev.type = ConfigureNotify;
184 synev.xconfigure.display = dpy;
185 synev.xconfigure.event = c->win;
186 synev.xconfigure.window = c->win;
187 synev.xconfigure.x = c->x;
188 synev.xconfigure.y = c->y;
189 synev.xconfigure.width = c->w;
190 synev.xconfigure.height = c->h;
191 synev.xconfigure.border_width = c->border;
192 synev.xconfigure.above = None;
193 /* Send synthetic ConfigureNotify */
194 XSendEvent(dpy, c->win, True, NoEventMask, &synev);
195 }
196 }
197 else {
198 wc.x = ev->x;
199 wc.y = ev->y;
200 wc.width = ev->width;
201 wc.height = ev->height;
202 wc.border_width = ev->border_width;
203 wc.sibling = ev->above;
204 wc.stack_mode = ev->detail;
205 XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
206 }
180 XSync(dpy, False); 207 XSync(dpy, False);
181} 208}
182 209
diff --git a/main.c b/main.c
index 86d72fa..33a2a9a 100644
--- a/main.c
+++ b/main.c
@@ -4,7 +4,6 @@
4 */ 4 */
5 5
6#include "dwm.h" 6#include "dwm.h"
7
8#include <errno.h> 7#include <errno.h>
9#include <stdio.h> 8#include <stdio.h>
10#include <stdlib.h> 9#include <stdlib.h>
@@ -15,7 +14,6 @@
15#include <X11/Xatom.h> 14#include <X11/Xatom.h>
16#include <X11/Xproto.h> 15#include <X11/Xproto.h>
17 16
18
19/* static */ 17/* static */
20 18
21static int (*xerrorxlib)(Display *, XErrorEvent *); 19static int (*xerrorxlib)(Display *, XErrorEvent *);
@@ -165,6 +163,7 @@ main(int argc, char *argv[])
165 int i; 163 int i;
166 unsigned int mask; 164 unsigned int mask;
167 fd_set rd; 165 fd_set rd;
166 Bool readin = True;
168 Window w; 167 Window w;
169 XEvent ev; 168 XEvent ev;
170 XSetWindowAttributes wa; 169 XSetWindowAttributes wa;
@@ -251,7 +250,8 @@ main(int argc, char *argv[])
251 /* main event loop, reads status text from stdin as well */ 250 /* main event loop, reads status text from stdin as well */
252 while(running) { 251 while(running) {
253 FD_ZERO(&rd); 252 FD_ZERO(&rd);
254 FD_SET(STDIN_FILENO, &rd); 253 if(readin)
254 FD_SET(STDIN_FILENO, &rd);
255 FD_SET(ConnectionNumber(dpy), &rd); 255 FD_SET(ConnectionNumber(dpy), &rd);
256 256
257 i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); 257 i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
@@ -267,11 +267,12 @@ main(int argc, char *argv[])
267 (handler[ev.type])(&ev); /* call handler */ 267 (handler[ev.type])(&ev); /* call handler */
268 } 268 }
269 } 269 }
270 if(FD_ISSET(STDIN_FILENO, &rd)) { 270 if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
271 if(!fgets(stext, sizeof(stext), stdin)) 271 readin = NULL != fgets(stext, sizeof(stext), stdin);
272 break; 272 if(readin)
273 else
274 stext[strlen(stext) - 1] = 0; 273 stext[strlen(stext) - 1] = 0;
274 else
275 strcpy(stext, "broken pipe");
275 drawstatus(); 276 drawstatus();
276 } 277 }
277 } 278 }
diff --git a/tag.c b/tag.c
index f6c33ea..f4ddfd9 100644
--- a/tag.c
+++ b/tag.c
@@ -3,7 +3,6 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5#include "dwm.h" 5#include "dwm.h"
6
7#include <regex.h> 6#include <regex.h>
8#include <stdio.h> 7#include <stdio.h>
9#include <string.h> 8#include <string.h>
@@ -86,26 +85,26 @@ dotile(Arg *arg)
86 if(n == 1) { 85 if(n == 1) {
87 c->x = sx; 86 c->x = sx;
88 c->y = sy + bh; 87 c->y = sy + bh;
89 c->w = sw - 2 * c->border; 88 c->w = sw - 2;
90 c->h = sh - 2 * c->border - bh; 89 c->h = sh - 2 - bh;
91 } 90 }
92 else if(i == 0) { 91 else if(i == 0) {
93 c->x = sx; 92 c->x = sx;
94 c->y = sy + bh; 93 c->y = sy + bh;
95 c->w = mw - 2 * c->border; 94 c->w = mw - 2;
96 c->h = sh - 2 * c->border - bh; 95 c->h = sh - 2 - bh;
97 } 96 }
98 else if(h > bh) { 97 else if(h > bh) {
99 c->x = sx + mw; 98 c->x = sx + mw;
100 c->y = sy + (i - 1) * h + bh; 99 c->y = sy + (i - 1) * h + bh;
101 c->w = w - 2 * c->border; 100 c->w = w - 2;
102 c->h = h - 2 * c->border; 101 c->h = h - 2;
103 } 102 }
104 else { /* fallback if h < bh */ 103 else { /* fallback if h < bh */
105 c->x = sx + mw; 104 c->x = sx + mw;
106 c->y = sy + bh; 105 c->y = sy + bh;
107 c->w = w - 2 * c->border; 106 c->w = w - 2;
108 c->h = sh - 2 * c->border - bh; 107 c->h = sh - 2 - bh;
109 } 108 }
110 resize(c, False, TopLeft); 109 resize(c, False, TopLeft);
111 i++; 110 i++;
diff --git a/util.c b/util.c
index 6eb19b4..7aff2aa 100644
--- a/util.c
+++ b/util.c
@@ -3,7 +3,6 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5#include "dwm.h" 5#include "dwm.h"
6
7#include <stdarg.h> 6#include <stdarg.h>
8#include <stdio.h> 7#include <stdio.h>
9#include <stdlib.h> 8#include <stdlib.h>