several bugfixes 1d729384
Anselm R Garbe · 2009-07-01 19:15 3 file(s) · +10 −21
config.def.h +0 −2
68 68
	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
69 69
	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
70 70
	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
71 -
#ifdef XINERAMA
72 71
	{ MODKEY,                       XK_w,      focusmon,       {.ui = 0 } },
73 72
	{ MODKEY,                       XK_e,      focusmon,       {.ui = 1 } },
74 73
	{ MODKEY|ShiftMask,             XK_w,      tagmon,         {.ui = 0 } },
75 74
	{ MODKEY|ShiftMask,             XK_e,      tagmon,         {.ui = 1 } },
76 -
#endif /* XINERAMA */
77 75
	TAGKEYS(                        XK_1,                      0)
78 76
	TAGKEYS(                        XK_2,                      1)
79 77
	TAGKEYS(                        XK_3,                      2)
config.mk +2 −2
11 11
X11LIB = /usr/X11R6/lib
12 12
13 13
# Xinerama, un-comment if you want it
14 -
#XINERAMALIBS = -L${X11LIB} -lXinerama
15 -
#XINERAMAFLAGS = -DXINERAMA
14 +
XINERAMALIBS = -L${X11LIB} -lXinerama
15 +
XINERAMAFLAGS = -DXINERAMA
16 16
17 17
# includes and libs
18 18
INCS = -I. -I/usr/include -I${X11INC}
dwm.c +8 −17
172 172
static void expose(XEvent *e);
173 173
static void focus(Client *c);
174 174
static void focusin(XEvent *e);
175 +
static void focusmon(const Arg *arg);
175 176
static void focusstack(const Arg *arg);
176 177
static unsigned long getcolor(const char *colstr);
177 178
static Bool getrootpointer(int *x, int *y);
179 180
static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
180 181
static void grabbuttons(Client *c, Bool focused);
181 182
static void grabkeys(void);
183 +
static Monitor *idxtomon(unsigned int n);
182 184
static void initfont(const char *fontstr);
183 185
static Bool isprotodel(Client *c);
184 186
static void keypress(XEvent *e);
206 208
static void sigchld(int signal);
207 209
static void spawn(const Arg *arg);
208 210
static void tag(const Arg *arg);
211 +
static void tagmon(const Arg *arg);
209 212
static int textnw(const char *text, unsigned int len);
210 213
static void tile(Monitor *);
211 214
static void togglebar(const Arg *arg);
230 233
static int xerrordummy(Display *dpy, XErrorEvent *ee);
231 234
static int xerrorstart(Display *dpy, XErrorEvent *ee);
232 235
static void zoom(const Arg *arg);
233 -
#ifdef XINERAMA
234 -
static void focusmon(const Arg *arg);
235 -
static Monitor *idxtomon(unsigned int n);
236 -
static void tagmon(const Arg *arg);
237 -
#endif /* XINERAMA */
238 236
239 237
/* variables */
240 238
static char stext[256];
309 307
	*h = MAX(1, *h);
310 308
311 309
	if(*x > m->mx + m->mw)
312 -
		*x = m->mw - WIDTH(c);
310 +
		*x = m->mx + m->mw - WIDTH(c);
313 311
	if(*y > m->my + m->mh)
314 -
		*y = m->mh - HEIGHT(c);
312 +
		*y = m->my + m->mh - HEIGHT(c);
315 313
	if(*x + *w + 2 * c->bw < m->mx)
316 314
		*x = m->mx;
317 315
	if(*y + *h + 2 * c->bw < m->my)
636 634
	}
637 635
638 636
	dc.x = 0;
639 -
#ifdef XINERAMA
640 637
	if(mons->next) { /* more than a single monitor */
641 638
		char buf[2];
642 639
		buf[0] = m->screen_number + '0';
645 642
		drawtext(buf, selmon == m ? dc.sel : dc.norm, True);
646 643
		dc.x += dc.w;
647 644
	}
648 -
#endif /* XINERAMA */
649 645
	m->btx = dc.x;
650 646
	for(i = 0; i < LENGTH(tags); i++) {
651 647
		dc.w = TEXTW(tags[i]);
803 799
		XSetInputFocus(dpy, selmon->sel->win, RevertToPointerRoot, CurrentTime);
804 800
}
805 801
806 -
#ifdef XINERAMA
807 802
void
808 803
focusmon(const Arg *arg) {
809 804
	Monitor *m;
814 809
	selmon = m;
815 810
	focus(NULL);
816 811
}
817 -
#endif /* XINERAMA */
818 812
819 813
void
820 814
focusstack(const Arg *arg) {
943 937
	}
944 938
}
945 939
946 -
#ifdef XINERAMA
947 940
Monitor *
948 941
idxtomon(unsigned int n) {
949 942
	unsigned int i;
952 945
	for(m = mons, i = 0; m && i != n; m = m->next, i++);
953 946
	return m;
954 947
}
955 -
#endif /* XINERAMA */
956 948
957 949
void
958 950
initfont(const char *fontstr) {
1378 1370
sendmon(Client *c, Monitor *m) {
1379 1371
	if(c->mon == m)
1380 1372
		return;
1373 +
	unfocus(c);
1381 1374
	detach(c);
1382 1375
	detachstack(c);
1383 1376
	c->mon = m;
1531 1524
	}
1532 1525
}
1533 1526
1534 -
#ifdef XINERAMA
1535 1527
void
1536 1528
tagmon(const Arg *arg) {
1537 1529
	Monitor *m;
1540 1532
		return;
1541 1533
	sendmon(selmon->sel, m);
1542 1534
}
1543 -
#endif /* XINERAMA */
1544 1535
1545 1536
int
1546 1537
textnw(const char *text, unsigned int len) {
1736 1727
	/* default monitor setup */
1737 1728
	{
1738 1729
		m->screen_number = 0;
1739 -
		m->wx = 0;
1730 +
		m->mx = m->wx = 0;
1740 1731
		m->my = m->wy = 0;
1741 -
		m->ww = sw;
1732 +
		m->mw = m->ww = sw;
1742 1733
		m->mh = m->wh = sh;
1743 1734
	}
1744 1735