Arg arg;
} Key;
-/*
const char *browse[] = { "firefox", NULL };
const char *gimp[] = { "gimp", NULL };
-*/
-const char *term[] = { "xterm", NULL };
-/*
+const char *term[] = {
"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
};
-coonst char *xlock[] = { "xlock", NULL };
-*/
+const char *xlock[] = { "xlock", NULL };
static Key key[] = {
- /* modifier key function arguments */
- { ControlMask, XK_0, appendtag, { .i = Tscratch } },
- { ControlMask, XK_1, appendtag, { .i = Tdev } },
- { ControlMask, XK_2, appendtag, { .i = Twww } },
- { ControlMask, XK_3, appendtag, { .i = Twork } },
- { MODKEY, XK_0, view, { .i = Tscratch } },
- { MODKEY, XK_1, view, { .i = Tdev } },
- { MODKEY, XK_2, view, { .i = Twww } },
- { MODKEY, XK_3, view, { .i = Twork } },
- { MODKEY, XK_j, focusnext, { 0 } },
- { MODKEY, XK_k, focusprev, { 0 } },
- { MODKEY, XK_m, maximize, { 0 } },
- { MODKEY, XK_space, dotile, { 0 } },
- { MODKEY, XK_Return, zoom, { 0 } },
+ /* modifier key function arguments */
+ { ControlMask, XK_0, appendtag, { .i = Tscratch } },
+ { ControlMask, XK_1, appendtag, { .i = Tdev } },
+ { ControlMask, XK_2, appendtag, { .i = Twww } },
+ { ControlMask, XK_3, appendtag, { .i = Twork } },
+ { MODKEY, XK_0, view, { .i = Tscratch } },
+ { MODKEY, XK_1, view, { .i = Tdev } },
+ { MODKEY, XK_2, view, { .i = Twww } },
+ { MODKEY, XK_3, view, { .i = Twork } },
+ { MODKEY, XK_j, focusnext, { 0 } },
+ { MODKEY, XK_k, focusprev, { 0 } },
+ { MODKEY, XK_m, maximize, { 0 } },
+ { MODKEY, XK_space, dotile, { 0 } },
+ { MODKEY, XK_Return, zoom, { 0 } },
{ ControlMask|ShiftMask,XK_0, heretag, { .i = Tscratch } },
{ ControlMask|ShiftMask,XK_1, heretag, { .i = Tdev } },
{ ControlMask|ShiftMask,XK_2, heretag, { .i = Twww } },
{ ControlMask|ShiftMask,XK_3, heretag, { .i = Twork } },
- { MODKEY|ShiftMask, XK_0, replacetag, { .i = Tscratch } },
- { MODKEY|ShiftMask, XK_1, replacetag, { .i = Tdev } },
- { MODKEY|ShiftMask, XK_2, replacetag, { .i = Twww } },
- { MODKEY|ShiftMask, XK_3, replacetag, { .i = Twork } },
- { MODKEY|ShiftMask, XK_c, killclient, { 0 } },
- /*
- { MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } },
- { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } },
- */
- { MODKEY|ShiftMask, XK_q, quit, { 0 } },
- { MODKEY|ShiftMask, XK_space, dofloat, { 0 } },
- /*{ MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } },*/
- { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } },
+ { MODKEY|ShiftMask, XK_0, replacetag, { .i = Tscratch } },
+ { MODKEY|ShiftMask, XK_1, replacetag, { .i = Tdev } },
+ { MODKEY|ShiftMask, XK_2, replacetag, { .i = Twww } },
+ { MODKEY|ShiftMask, XK_3, replacetag, { .i = Twork } },
+ { MODKEY|ShiftMask, XK_c, killclient, { 0 } },
+ { MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } },
+ { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } },
+ { MODKEY|ShiftMask, XK_q, quit, { 0 } },
+ { MODKEY|ShiftMask, XK_space, dofloat, { 0 } },
+ { MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } },
+ { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } },
};
/* static */
static void
movemouse(Client *c)
{
- XEvent ev;
int x1, y1, ocx, ocy, di;
unsigned int dui;
Window dummy;
+ XEvent ev;
ocx = c->x;
ocy = c->y;
if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
- None, cursor[CurMove], CurrentTime) != GrabSuccess)
+ None, cursor[CurMove], CurrentTime) != GrabSuccess)
return;
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
for(;;) {
static void
resizemouse(Client *c)
{
- XEvent ev;
int ocx, ocy;
Corner sticky;
+ XEvent ev;
ocx = c->x;
ocy = c->y;
{
int x;
Arg a;
- XButtonPressedEvent *ev = &e->xbutton;
Client *c;
+ XButtonPressedEvent *ev = &e->xbutton;
if(barwin == ev->window) {
switch(ev->button) {
static void
configurerequest(XEvent *e)
{
+ Client *c;
XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc;
- Client *c;
ev->value_mask &= ~CWSibling;
if((c = getclient(ev->window))) {
static void
enternotify(XEvent *e)
{
- XCrossingEvent *ev = &e->xcrossing;
Client *c;
+ XCrossingEvent *ev = &e->xcrossing;
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
return;
static void
expose(XEvent *e)
{
- XExposeEvent *ev = &e->xexpose;
Client *c;
+ XExposeEvent *ev = &e->xexpose;
if(ev->count == 0) {
if(barwin == ev->window)
static void
keypress(XEvent *e)
{
- XKeyEvent *ev = &e->xkey;
static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0;
unsigned int i;
KeySym keysym;
+ XKeyEvent *ev = &e->xkey;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < len; i++)
static void
maprequest(XEvent *e)
{
- XMapRequestEvent *ev = &e->xmaprequest;
static XWindowAttributes wa;
+ XMapRequestEvent *ev = &e->xmaprequest;
if(!XGetWindowAttributes(dpy, ev->window, &wa))
return;
static void
propertynotify(XEvent *e)
{
- XPropertyEvent *ev = &e->xproperty;
- Window trans;
Client *c;
+ Window trans;
+ XPropertyEvent *ev = &e->xproperty;
if(ev->state == PropertyDelete)
return; /* ignore */
/* static */
-static Bool otherwm;
static int (*xerrorxlib)(Display *, XErrorEvent *);
+static Bool otherwm;
static void
cleanup()
scan()
{
unsigned int i, num;
- Window *wins;
+ Window *wins, d1, d2;
XWindowAttributes wa;
- Window d1, d2;
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for(i = 0; i < num; i++) {
static int
win_property(Window w, Atom a, Atom t, long l, unsigned char **prop)
{
- Atom real;
- int format;
+ int status, format;
unsigned long res, extra;
- int status;
+ Atom real;
status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
&res, &extra, prop);
int
getproto(Window w)
{
- unsigned char *protocols;
- long res;
int protos = 0;
int i;
+ long res;
+ unsigned char *protocols;
res = win_property(w, wmatom[WMProtocols], XA_ATOM, 20L, &protocols);
if(res <= 0) {
xerror(Display *dpy, XErrorEvent *ee)
{
if(ee->error_code == BadWindow
- || (ee->request_code == X_SetInputFocus
- && ee->error_code == BadMatch)
- || (ee->request_code == X_PolyText8
- && ee->error_code == BadDrawable)
- || (ee->request_code == X_PolyFillRectangle
- && ee->error_code == BadDrawable)
- || (ee->request_code == X_PolySegment
- && ee->error_code == BadDrawable)
- || (ee->request_code == X_ConfigureWindow
- && ee->error_code == BadMatch)
- || (ee->request_code == X_GrabKey
- && ee->error_code == BadAccess))
+ || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
+ || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable)
+ || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable)
+ || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable)
+ || (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch)
+ || (ee->request_code == X_GrabKey && ee->error_code == BadAccess))
return 0;
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() */
}
main(int argc, char *argv[])
{
int i, n;
- fd_set rd;
- XSetWindowAttributes wa;
unsigned int mask;
+ fd_set rd;
Bool readstdin = True;
Window w;
XEvent ev;
+ XSetWindowAttributes wa;
for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
switch (argv[i][1]) {
issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
- wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
- | LeaveWindowMask;
+ wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask;
wa.cursor = cursor[CurNormal];
-
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
strcpy(stext, "dwm-"VERSION);
-
scan();
/* main event loop, reads status text from stdin as well */