about summary refs log tree commit diff stats
path: root/client.c
Commit message (Expand)AuthorAgeFilesLines
* 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 read...Anselm R. Garbe2006-07-141-12/+18
* continued with man pageAnselm R. Garbe2006-07-141-1/+1
* except improvements to the mouse handling this is already nearly feature comp...Anselm R. Garbe2006-07-131-0/+5
* added mini stuffAnselm R. Garbe2006-07-131-20/+31
* fixed several things, nearly feature completeAnselm R. Garbe2006-07-131-25/+30
* new stuffAnselm R. Garbe2006-07-131-44/+78
* several other additions/fixes, dwm is quite usable alreadyAnselm R. Garbe2006-07-131-95/+140
* implemented tagging a clientAnselm R. Garbe2006-07-131-57/+113
* added xlock command (I need it regularly)Anselm R. Garbe2006-07-131-20/+10
* added pointer warps on kb-driven/manage-driven focusAnselm R. Garbe2006-07-131-0/+3
* changed back to urxvt, dwm has no problems with it, because it doesn't use fr...Anselm R. Garbe2006-07-131-1/+1
* changed default colorsAnselm R. Garbe2006-07-131-7/+8
* added logo+descriptionAnselm R. Garbe2006-07-131-22/+33
* new stuff (some warning elimination)Anselm R. Garbe2006-07-131-3/+3
* removed unnecessary crapAnselm R. Garbe2006-07-131-20/+14
* before leaning things upAnselm R. Garbe2006-07-131-9/+52
* new stuff, fixed several issuesAnselm R. Garbe2006-07-121-2/+2
* added gravity stuffAnselm R. Garbe2006-07-121-5/+67
* added maxAnselm R. Garbe2006-07-121-0/+12
* added grid mode on Mod1Mask gAnselm R. Garbe2006-07-121-1/+69
* simplified several portions of code through replacing rect structs with x,y,h...Anselm R. Garbe2006-07-121-22/+42
* some more additions/fixesAnselm R. Garbe2006-07-121-2/+11
* fixed several other stuff, coming closer to something usefulAnselm R. Garbe2006-07-111-13/+16
* implemented draw_client stuffAnselm R. Garbe2006-07-111-15/+49
* made code more readableAnselm R. Garbe2006-07-111-20/+30
* added basic mouse support (actually we don't need more)Anselm R. Garbe2006-07-111-4/+7
* added mouse-based resizalsAnselm R. Garbe2006-07-111-2/+30
* several changes, new stuffAnselm R. Garbe2006-07-111-0/+5
* added bar event timerAnselm R. Garbe2006-07-111-0/+9
* added protocol killing stuffAnselm R. Garbe2006-07-111-7/+26
* changed how manage client worksAnselm R. Garbe2006-07-111-12/+33
* fixed several stuff (gridwm gets better and better)Anselm R. Garbe2006-07-111-2/+10
* new stuffAnselm R. Garbe2006-07-111-1/+1
* added several other stuffAnselm R. Garbe2006-07-101-0/+89
class="n">XGCValues gcv; XRectangle r = { dc.x, dc.y, dc.w, dc.h }; XSetForeground(dpy, dc.gc, dc.bg); XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); w = 0; if(border) drawborder(); if(!text) return; len = strlen(text); if(len >= sizeof(buf)) len = sizeof(buf) - 1; memcpy(buf, text, len); buf[len] = 0; h = dc.font.ascent + dc.font.descent; y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; x = dc.x + (h / 2); /* shorten text if necessary */ while(len && (w = textnw(&dc.font, buf, len)) > dc.w - h) buf[--len] = 0; if(w > dc.w) return; /* too long */ gcv.foreground = dc.fg; gcv.background = dc.bg; if(dc.font.set) { XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); } else { gcv.font = dc.font.xfont->fid; XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); } } static unsigned long xinitcolors(Colormap cmap, const char *colstr) { XColor color; XAllocNamedColor(dpy, cmap, colstr, &color, &color); return color.pixel; } void initcolors(const char *bg, const char *fg, const char *border) { Colormap cmap = DefaultColormap(dpy, screen); dc.bg = xinitcolors(cmap, bg); dc.fg = xinitcolors(cmap, fg); dc.border = xinitcolors(cmap, border); } unsigned int textnw(Fnt *font, char *text, unsigned int len) { XRectangle r; if(font->set) { XmbTextExtents(font->set, text, len, NULL, &r); return r.width; } return XTextWidth(font->xfont, text, len); } unsigned int textw(Fnt *font, char *text) { return textnw(font, text, strlen(text)); } unsigned int texth(Fnt *font) { return font->height + 4; } void initfont(Fnt *font, const char *fontstr) { char **missing, *def; int i, n; missing = NULL; setlocale(LC_ALL, ""); if(font->set) XFreeFontSet(dpy, font->set); font->set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); if(missing) { while(n--) fprintf(stderr, "missing fontset: %s\n", missing[n]); XFreeStringList(missing); if(font->set) { XFreeFontSet(dpy, font->set); font->set = NULL; } } if(font->set) { XFontSetExtents *font_extents; XFontStruct **xfonts; char **font_names; font->ascent = font->descent = 0; font_extents = XExtentsOfFontSet(font->set); n = XFontsOfFontSet(font->set, &xfonts, &font_names); for(i = 0, font->ascent = 0, font->descent = 0; i < n; i++) { if(font->ascent < (*xfonts)->ascent) font->ascent = (*xfonts)->ascent; if(font->descent < (*xfonts)->descent) font->descent = (*xfonts)->descent; xfonts++; } } else { if(font->xfont) XFreeFont(dpy, font->xfont); font->xfont = NULL; font->xfont = XLoadQueryFont(dpy, fontstr); if (!font->xfont) font->xfont = XLoadQueryFont(dpy, "fixed"); if (!font->xfont) error("error, cannot init 'fixed' font\n"); font->ascent = font->xfont->ascent; font->descent = font->xfont->descent; } font->height = font->ascent + font->descent; }