about summary refs log tree commit diff stats
path: root/client.c
Commit message (Collapse)AuthorAgeFilesLines
* removed TLast tag enum, now tags is simple defined as char *[] array, the ↵arg@10ksloc.org2006-08-031-1/+3
| | | | rest is calculated correctly, rules take an int array for the tags
* changed Client->tags and Rule->tags to be Bool (I'll also try to remove the ↵arg@10ksloc.org2006-08-031-1/+1
| | | | TLast enum)
* made fullscreen apps working fine in floating mode (there is no sane way to ↵arg@10ksloc.org2006-08-021-22/+10
| | | | 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
* new stuffarg@10ksloc.org2006-08-021-15/+21
|
* implemented focus on enterwindow on titlebarsarg@10ksloc.org2006-08-021-1/+1
|
* reverting to old resize policyarg@10ksloc.org2006-08-021-11/+19
|
* new resize stuff (using XConfigureWindow instead of XSendEvent)arg@10ksloc.org2006-08-021-19/+11
|
* renamed WM_PROTOCOL_DELWIN into PROTODELWINarg@10ksloc.org2006-08-011-1/+1
|
* removed artefacts of single-linked list (thanx to Jukka, I must have been mad)arg@10ksloc.org2006-08-011-8/+3
|
* uppercasing all define'd values (uppercase-prefixed should only be enum ↵arg@10ksloc.org2006-08-011-3/+3
| | | | field qualifiers)
* applied Sanders patchesarg@10ksloc.org2006-08-011-3/+3
|
* committed a patch which fixes the hints of Jukkaarg@10ksloc.org2006-08-011-34/+8
|
* sanitization of several clunky stuff, removed heretag (rarely of use), ↵arg@10ksloc.org2006-07-211-2/+15
| | | | simplified pop(), changed shortcuts to always contain MODKEY
* applied sanders no_sizehints for tiled mode patch (thx!)arg@10ksloc.org2006-07-201-10/+10
|
* serious mistake in pop() (forgot to set c->prev to NULL on pop)arg@10ksloc.org2006-07-201-0/+1
|
* using double-linked list in order to get correct prev focus handlingarg@10ksloc.org2006-07-201-15/+31
|
* made status bar drawing more robust, implemented togglemax and togglemode, ↵arg@10ksloc.org2006-07-201-15/+38
| | | | works quite well
* cleaned up codearg@10ksloc.org2006-07-201-6/+10
|
* removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling ↵arg@10ksloc.org2006-07-201-76/+52
| | | | remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
* implemented regexp matching for rulesarg@10ksloc.org2006-07-191-2/+3
|
* applied Jukka's patch with s/ModKeyMask/MODKEY/garg@10ksloc.org2006-07-191-3/+3
|
* fixed the bug mentioned by Sanderarg@10ksloc.org2006-07-191-3/+7
|
* refactored Sanders code somewhatarg@10ksloc.org2006-07-191-2/+2
|
* implemented fallback for too many clients in stacked modearg@10ksloc.org2006-07-191-2/+3
|
* and another fix...arg@10ksloc.org2006-07-191-1/+1
|
* yet another typo fixarg@10ksloc.org2006-07-191-2/+2
|
* fixed a typoarg@10ksloc.org2006-07-191-1/+1
|
* floating clients get random (x,y) offsets nowarg@10ksloc.org2006-07-191-0/+7
|
* applied Sanders resize patch, fixed lower bugarg@10ksloc.org2006-07-191-2/+8
|
* implemened distinguishing float/managed geometries of clients (works quite well)Anselm R. Garbe2006-07-181-48/+68
|
* pop on heretagAnselm R. Garbe2006-07-181-7/+14
|
* added heretag command which allows to tag a client of a foreign tag with ↵Anselm R. Garbe2006-07-181-4/+4
| | | | current tag
* another XSyncAnselm R. Garbe2006-07-161-0/+1
|
* several additions in mouse handling ;)Anselm R. Garbe2006-07-161-6/+7
|
* fixed XSync handling and finished man pageAnselm R. Garbe2006-07-151-4/+3
|
* sanitized other stuffAnselm R. Garbe2006-07-151-2/+2
|
* proceeded with cleaning up, sorting functions, etcAnselm R. Garbe2006-07-151-205/+206
|
* rearranged several stuffAnselm R. Garbe2006-07-151-58/+87
|
* sanitized namesAnselm R. Garbe2006-07-141-14/+14
|
* rearrangedAnselm R. Garbe2006-07-141-227/+3
|
* bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) modeAnselm R. Garbe2006-07-141-0/+2
|
* fixed crash on zoom if only 1 client existsAnselm R. Garbe2006-07-141-3/+9
|
* removed a bunch of lines through swap removalAnselm R. Garbe2006-07-141-2/+2
|
* searching for a better way to discard enter notifiesAnselm R. Garbe2006-07-141-13/+11
|
* focus on view change as wellAnselm R. Garbe2006-07-141-0/+3
|
* made stdin reader more robustAnselm R. Garbe2006-07-141-4/+9
|
* implemented bar for dwm (I miss status text), I plan that status text is ↵Anselm R. Garbe2006-07-141-12/+18
| | | | read from stdin in dwm
* continued with man pageAnselm R. Garbe2006-07-141-1/+1
|
* except improvements to the mouse handling this is already nearly feature ↵Anselm R. Garbe2006-07-131-0/+5
| | | | complete
* added mini stuffAnselm R. Garbe2006-07-131-20/+31
|
span> Display *dpy; DC dc = {0}; Window root, barwin; int getproto(Window w) { int protos = 0; int i; long res; unsigned char *protocols; res = win_property(w, wmatom[WMProtocols], XA_ATOM, 20L, &protocols); if(res <= 0) { return protos; } for(i = 0; i < res; i++) { if(protocols[i] == wmatom[WMDelete]) protos |= PROTODELWIN; } free((char *) protocols); return protos; } void sendevent(Window w, Atom a, long value) { XEvent e; e.type = ClientMessage; e.xclient.window = w; e.xclient.message_type = a; e.xclient.format = 32; e.xclient.data.l[0] = value; e.xclient.data.l[1] = CurrentTime; XSendEvent(dpy, w, False, NoEventMask, &e); XSync(dpy, False); } void quit(Arg *arg) { running = False; } /* * There's no way to check accesses to destroyed windows, thus those cases are * ignored (especially on UnmapNotify's). Other types of errors call Xlibs * default error handler, which calls exit(). */ int 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)) return 0; fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", ee->request_code, ee->error_code); return xerrorxlib(dpy, ee); /* may call exit() */ } int main(int argc, char *argv[]) { int i; unsigned int mask; fd_set rd; Bool readin = True; Window w; XEvent ev; XSetWindowAttributes wa; if(argc == 2 && !strncmp("-v", argv[1], 3)) { fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout); exit(EXIT_SUCCESS); } else if(argc != 1) eprint("usage: dwm [-v]\n"); dpy = XOpenDisplay(0); if(!dpy) eprint("dwm: cannot connect X server\n"); screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); /* check if another WM is already running */ otherwm = False; XSetErrorHandler(xerrorstart); /* this causes an error if some other WM is running */ XSelectInput(dpy, root, SubstructureRedirectMask); XSync(dpy, False); if(otherwm) eprint("dwm: another window manager is already running\n"); XSetErrorHandler(NULL); xerrorxlib = XSetErrorHandler(xerror); /* init atoms */ wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast); /* init cursors */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); grabkeys(); /* style */ dc.bg = getcolor(BGCOLOR); dc.fg = getcolor(FGCOLOR); dc.border = getcolor(BORDERCOLOR); setfont(FONT); sx = sy = 0; sw = DisplayWidth(dpy, screen); sh = DisplayHeight(dpy, screen); mw = (sw * MASTERW) / 100; wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; bx = by = 0; bw = sw; dc.h = bh = dc.font.height + 4; barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); XDefineCursor(dpy, barwin, cursor[CurNormal]); XMapRaised(dpy, barwin); dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); dc.gc = XCreateGC(dpy, root, 0, 0); drawstatus(); issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); 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 */ while(running) { FD_ZERO(&rd); if(readin) FD_SET(STDIN_FILENO, &rd); FD_SET(ConnectionNumber(dpy), &rd); i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); if(i == -1 && errno == EINTR) continue; if(i < 0) eprint("select failed\n"); else if(i > 0) { if(FD_ISSET(ConnectionNumber(dpy), &rd)) { while(XPending(dpy)) { XNextEvent(dpy, &ev); if(handler[ev.type]) (handler[ev.type])(&ev); /* call handler */ } } if(readin && FD_ISSET(STDIN_FILENO, &rd)) { readin = NULL != fgets(stext, sizeof(stext), stdin); if(readin) stext[strlen(stext) - 1] = 0; else strcpy(stext, "broken pipe"); drawstatus(); } } } cleanup(); XCloseDisplay(dpy); return 0; }