1
0

applied nsz's style.diff patch

This commit is contained in:
Anselm R Garbe 2008-05-13 14:33:02 +01:00
parent 6b79f3f326
commit d7cc0f6416

27
dwm.c
View File

@ -595,7 +595,7 @@ drawtext(const char *text, unsigned long col[ColLast], Bool invert) {
x = dc.x + (h / 2); x = dc.x + (h / 2);
/* shorten text if necessary */ /* shorten text if necessary */
for(; len && (w = textnw(buf, len)) > dc.w - h; len--); for(; len && (w = textnw(buf, len)) > dc.w - h; len--);
if (!len) if(!len)
return; return;
if(len < olen) { if(len < olen) {
if(len > 1) if(len > 1)
@ -782,21 +782,21 @@ grabbuttons(Client *c, Bool focused) {
int i, j; int i, j;
unsigned int buttons[] = { Button1, Button2, Button3 }; unsigned int buttons[] = { Button1, Button2, Button3 };
unsigned int modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask, unsigned int modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask,
MODKEY|numlockmask|LockMask} ; MODKEY|numlockmask|LockMask} ;
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
if(focused) if(focused)
for(i = 0; i < LENGTH(buttons); i++) for(i = 0; i < LENGTH(buttons); i++)
for(j = 0; j < LENGTH(modifiers); j++) for(j = 0; j < LENGTH(modifiers); j++)
XGrabButton(dpy, buttons[i], modifiers[j], c->win, False, XGrabButton(dpy, buttons[i], modifiers[j], c->win, False,
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
else else
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
} }
void void
grabkeys(void) { grabkeys(void) {
unsigned int i, j; unsigned int i, j;
KeyCode code; KeyCode code;
XModifierKeymap *modmap; XModifierKeymap *modmap;
@ -1041,7 +1041,7 @@ monocle(void) {
Client *c; Client *c;
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if((lt->isfloating || !c->isfloating) && isvisible(c, NULL)) if((lt->isfloating || !c->isfloating) && isvisible(c, NULL))
resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS); resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS);
} }
@ -1055,7 +1055,7 @@ movemouse(Client *c) {
ocx = nx = c->x; ocx = nx = c->x;
ocy = ny = c->y; ocy = ny = c->y;
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[CurMove], CurrentTime) != GrabSuccess) None, cursor[CurMove], CurrentTime) != GrabSuccess)
return; return;
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
for(;;) { for(;;) {
@ -1221,7 +1221,7 @@ resizemouse(Client *c) {
ocx = c->x; ocx = c->x;
ocy = c->y; ocy = c->y;
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[CurResize], CurrentTime) != GrabSuccess) None, cursor[CurResize], CurrentTime) != GrabSuccess)
return; return;
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
for(;;) { for(;;) {
@ -1351,7 +1351,7 @@ scan(void) {
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for(i = 0; i < num; i++) { for(i = 0; i < num; i++) {
if(!XGetWindowAttributes(dpy, wins[i], &wa) if(!XGetWindowAttributes(dpy, wins[i], &wa)
|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
continue; continue;
if(wa.map_state == IsViewable || getstate(wins[i]) == IconicState) if(wa.map_state == IsViewable || getstate(wins[i]) == IconicState)
manage(wins[i], &wa); manage(wins[i], &wa);
@ -1360,7 +1360,7 @@ scan(void) {
if(!XGetWindowAttributes(dpy, wins[i], &wa)) if(!XGetWindowAttributes(dpy, wins[i], &wa))
continue; continue;
if(XGetTransientForHint(dpy, wins[i], &d1) if(XGetTransientForHint(dpy, wins[i], &d1)
&& (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)) && (wa.map_state == IsViewable || getstate(wins[i]) == IconicState))
manage(wins[i], &wa); manage(wins[i], &wa);
} }
} }
@ -1479,8 +1479,8 @@ setup(void) {
wa.event_mask = ButtonPressMask|ExposureMask; wa.event_mask = ButtonPressMask|ExposureMask;
barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen), barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, barwin, cursor[CurNormal]); XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin); XMapRaised(dpy, barwin);
strcpy(stext, "dwm-"VERSION); strcpy(stext, "dwm-"VERSION);
@ -1704,7 +1704,6 @@ unmapnotify(XEvent *e) {
void void
updatebar(void) { updatebar(void) {
if(dc.drawable != 0) if(dc.drawable != 0)
XFreePixmap(dpy, dc.drawable); XFreePixmap(dpy, dc.drawable);
dc.drawable = XCreatePixmap(dpy, root, bw, bh, DefaultDepth(dpy, screen)); dc.drawable = XCreatePixmap(dpy, root, bw, bh, DefaultDepth(dpy, screen));
@ -1839,7 +1838,7 @@ xerror(Display *dpy, XErrorEvent *ee) {
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) || (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
return 0; return 0;
fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n",
ee->request_code, ee->error_code); ee->request_code, ee->error_code);
return xerrorxlib(dpy, ee); /* may call exit */ return xerrorxlib(dpy, ee); /* may call exit */
} }