summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dwm.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/dwm.c b/dwm.c
index 61ac193..abdaa6c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -172,6 +172,7 @@ static void enternotify(XEvent *e);
172static void expose(XEvent *e); 172static void expose(XEvent *e);
173static void focus(Client *c); 173static void focus(Client *c);
174static void focusin(XEvent *e); 174static void focusin(XEvent *e);
175static void focusmon(const Arg *arg);
175static void focusstack(const Arg *arg); 176static void focusstack(const Arg *arg);
176static unsigned long getcolor(const char *colstr); 177static unsigned long getcolor(const char *colstr);
177static Bool getrootpointer(int *x, int *y); 178static Bool getrootpointer(int *x, int *y);
@@ -179,6 +180,7 @@ static long getstate(Window w);
179static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); 180static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
180static void grabbuttons(Client *c, Bool focused); 181static void grabbuttons(Client *c, Bool focused);
181static void grabkeys(void); 182static void grabkeys(void);
183static Monitor *idxtomon(unsigned int n);
182static void initfont(const char *fontstr); 184static void initfont(const char *fontstr);
183static Bool isprotodel(Client *c); 185static Bool isprotodel(Client *c);
184static void keypress(XEvent *e); 186static void keypress(XEvent *e);
@@ -206,6 +208,7 @@ static void showhide(Client *c);
206static void sigchld(int signal); 208static void sigchld(int signal);
207static void spawn(const Arg *arg); 209static void spawn(const Arg *arg);
208static void tag(const Arg *arg); 210static void tag(const Arg *arg);
211static void tagmon(const Arg *arg);
209static int textnw(const char *text, unsigned int len); 212static int textnw(const char *text, unsigned int len);
210static void tile(Monitor *); 213static void tile(Monitor *);
211static void togglebar(const Arg *arg); 214static void togglebar(const Arg *arg);
@@ -230,11 +233,6 @@ static int xerror(Display *dpy, XErrorEvent *ee);
230static int xerrordummy(Display *dpy, XErrorEvent *ee); 233static int xerrordummy(Display *dpy, XErrorEvent *ee);
231static int xerrorstart(Display *dpy, XErrorEvent *ee); 234static int xerrorstart(Display *dpy, XErrorEvent *ee);
232static void zoom(const Arg *arg); 235static void zoom(const Arg *arg);
233#ifdef XINERAMA
234static void focusmon(const Arg *arg);
235static Monitor *idxtomon(unsigned int n);
236static void tagmon(const Arg *arg);
237#endif /* XINERAMA */
238 236
239/* variables */ 237/* variables */
240static char stext[256]; 238static char stext[256];
@@ -309,9 +307,9 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h) {
309 *h = MAX(1, *h); 307 *h = MAX(1, *h);
310 308
311 if(*x > m->mx + m->mw) 309 if(*x > m->mx + m->mw)
312 *x = m->mw - WIDTH(c); 310 *x = m->mx + m->mw - WIDTH(c);
313 if(*y > m->my + m->mh) 311 if(*y > m->my + m->mh)
314 *y = m->mh - HEIGHT(c); 312 *y = m->my + m->mh - HEIGHT(c);
315 if(*x + *w + 2 * c->bw < m->mx) 313 if(*x + *w + 2 * c->bw < m->mx)
316 *x = m->mx; 314 *x = m->mx;
317 if(*y + *h + 2 * c->bw < m->my) 315 if(*y + *h + 2 * c->bw < m->my)
@@ -636,7 +634,6 @@ drawbar(Monitor *m) {
636 } 634 }
637 635
638 dc.x = 0; 636 dc.x = 0;
639#ifdef XINERAMA
640 if(mons->next) { /* more than a single monitor */ 637 if(mons->next) { /* more than a single monitor */
641 char buf[2]; 638 char buf[2];
642 buf[0] = m->screen_number + '0'; 639 buf[0] = m->screen_number + '0';
@@ -645,7 +642,6 @@ drawbar(Monitor *m) {
645 drawtext(buf, selmon == m ? dc.sel : dc.norm, True); 642 drawtext(buf, selmon == m ? dc.sel : dc.norm, True);
646 dc.x += dc.w; 643 dc.x += dc.w;
647 } 644 }
648#endif /* XINERAMA */
649 m->btx = dc.x; 645 m->btx = dc.x;
650 for(i = 0; i < LENGTH(tags); i++) { 646 for(i = 0; i < LENGTH(tags); i++) {
651 dc.w = TEXTW(tags[i]); 647 dc.w = TEXTW(tags[i]);
@@ -803,7 +799,6 @@ focusin(XEvent *e) { /* there are some broken focus acquiring clients */
803 XSetInputFocus(dpy, selmon->sel->win, RevertToPointerRoot, CurrentTime); 799 XSetInputFocus(dpy, selmon->sel->win, RevertToPointerRoot, CurrentTime);
804} 800}
805 801
806#ifdef XINERAMA
807void 802void
808focusmon(const Arg *arg) { 803focusmon(const Arg *arg) {
809 Monitor *m; 804 Monitor *m;
@@ -814,7 +809,6 @@ focusmon(const Arg *arg) {
814 selmon = m; 809 selmon = m;
815 focus(NULL); 810 focus(NULL);
816} 811}
817#endif /* XINERAMA */
818 812
819void 813void
820focusstack(const Arg *arg) { 814focusstack(const Arg *arg) {
@@ -943,7 +937,6 @@ grabkeys(void) {
943 } 937 }
944} 938}
945 939
946#ifdef XINERAMA
947Monitor * 940Monitor *
948idxtomon(unsigned int n) { 941idxtomon(unsigned int n) {
949 unsigned int i; 942 unsigned int i;
@@ -952,7 +945,6 @@ idxtomon(unsigned int n) {
952 for(m = mons, i = 0; m && i != n; m = m->next, i++); 945 for(m = mons, i = 0; m && i != n; m = m->next, i++);
953 return m; 946 return m;
954} 947}
955#endif /* XINERAMA */
956 948
957void 949void
958initfont(const char *fontstr) { 950initfont(const char *fontstr) {
@@ -1378,6 +1370,7 @@ void
1378sendmon(Client *c, Monitor *m) { 1370sendmon(Client *c, Monitor *m) {
1379 if(c->mon == m) 1371 if(c->mon == m)
1380 return; 1372 return;
1373 unfocus(c);
1381 detach(c); 1374 detach(c);
1382 detachstack(c); 1375 detachstack(c);
1383 c->mon = m; 1376 c->mon = m;
@@ -1531,7 +1524,6 @@ tag(const Arg *arg) {
1531 } 1524 }
1532} 1525}
1533 1526
1534#ifdef XINERAMA
1535void 1527void
1536tagmon(const Arg *arg) { 1528tagmon(const Arg *arg) {
1537 Monitor *m; 1529 Monitor *m;
@@ -1540,7 +1532,6 @@ tagmon(const Arg *arg) {
1540 return; 1532 return;
1541 sendmon(selmon->sel, m); 1533 sendmon(selmon->sel, m);
1542} 1534}
1543#endif /* XINERAMA */
1544 1535
1545int 1536int
1546textnw(const char *text, unsigned int len) { 1537textnw(const char *text, unsigned int len) {
@@ -1736,9 +1727,9 @@ updategeom(void) {
1736 /* default monitor setup */ 1727 /* default monitor setup */
1737 { 1728 {
1738 m->screen_number = 0; 1729 m->screen_number = 0;
1739 m->wx = 0; 1730 m->mx = m->wx = 0;
1740 m->my = m->wy = 0; 1731 m->my = m->wy = 0;
1741 m->ww = sw; 1732 m->mw = m->ww = sw;
1742 m->mh = m->wh = sh; 1733 m->mh = m->wh = sh;
1743 } 1734 }
1744 1735