Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
rearranged several stuff
[dwm.git]
/
draw.c
diff --git
a/draw.c
b/draw.c
index
5bb6fc2
..
4c47c1a
100644
(file)
--- a/
draw.c
+++ b/
draw.c
@@
-11,44
+11,55
@@
#include "dwm.h"
void
#include "dwm.h"
void
-draw_bar()
+drawall()
+{
+ Client *c;
+
+ for(c = clients; c; c = getnext(c->next))
+ drawtitle(c);
+ drawstatus();
+}
+
+void
+drawstatus()
{
int i;
{
int i;
+ Bool istile = arrange == dotile;
dc.x = dc.y = 0;
dc.w = bw;
dc.x = dc.y = 0;
dc.w = bw;
- drawtext(NULL,
Fals
e, False);
+ drawtext(NULL,
!istil
e, False);
- if(arrange == floating) {
- dc.w = textw("~");
- drawtext("~", False, False);
- }
- else
- dc.w = 0;
+ dc.w = 0;
for(i = 0; i < TLast; i++) {
dc.x += dc.w;
dc.w = textw(tags[i]);
for(i = 0; i < TLast; i++) {
dc.x += dc.w;
dc.w = textw(tags[i]);
- drawtext(tags[i], i == tsel, True);
+ if(istile)
+ drawtext(tags[i], (i == tsel), True);
+ else
+ drawtext(tags[i], (i != tsel), True);
}
if(sel) {
dc.x += dc.w;
dc.w = textw(sel->name);
}
if(sel) {
dc.x += dc.w;
dc.w = textw(sel->name);
- drawtext(sel->name,
Tru
e, True);
+ drawtext(sel->name,
istil
e, True);
}
dc.w = textw(stext);
dc.x = bx + bw - dc.w;
}
dc.w = textw(stext);
dc.x = bx + bw - dc.w;
- drawtext(stext,
Fals
e, False);
+ drawtext(stext,
!istil
e, False);
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XFlush(dpy);
}
void
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XFlush(dpy);
}
void
-draw
_client
(Client *c)
+draw
title
(Client *c)
{
int i;
{
int i;
+ Bool istile = arrange == dotile;
+
if(c == sel) {
if(c == sel) {
- draw
_bar
();
+ draw
status
();
XUnmapWindow(dpy, c->title);
XSetWindowBorder(dpy, c->win, dc.fg);
return;
XUnmapWindow(dpy, c->title);
XSetWindowBorder(dpy, c->win, dc.fg);
return;
@@
-64,12
+75,12
@@
draw_client(Client *c)
if(c->tags[i]) {
dc.x += dc.w;
dc.w = textw(c->tags[i]);
if(c->tags[i]) {
dc.x += dc.w;
dc.w = textw(c->tags[i]);
- drawtext(c->tags[i],
Fals
e, True);
+ drawtext(c->tags[i],
!istil
e, True);
}
}
dc.x += dc.w;
dc.w = textw(c->name);
}
}
dc.x += dc.w;
dc.w = textw(c->name);
- drawtext(c->name,
Fals
e, True);
+ drawtext(c->name,
!istil
e, True);
XCopyArea(dpy, dc.drawable, c->title, dc.gc,
0, 0, c->tw, c->th, 0, 0);
XFlush(dpy);
XCopyArea(dpy, dc.drawable, c->title, dc.gc,
0, 0, c->tw, c->th, 0, 0);
XFlush(dpy);
@@
-145,7
+156,7
@@
drawtext(const char *text, Bool invert, Bool border)
}
unsigned long
}
unsigned long
-
ini
tcolor(const char *colstr)
+
ge
tcolor(const char *colstr)
{
XColor color;
Colormap cmap = DefaultColormap(dpy, screen);
{
XColor color;
Colormap cmap = DefaultColormap(dpy, screen);
@@
-172,7
+183,7
@@
textw(char *text)
}
void
}
void
-
ini
tfont(const char *fontstr)
+
se
tfont(const char *fontstr)
{
char **missing, *def;
int i, n;
{
char **missing, *def;
int i, n;
@@
-215,7
+226,7
@@
initfont(const char *fontstr)
if (!dc.font.xfont)
dc.font.xfont = XLoadQueryFont(dpy, "fixed");
if (!dc.font.xfont)
if (!dc.font.xfont)
dc.font.xfont = XLoadQueryFont(dpy, "fixed");
if (!dc.font.xfont)
- e
rror
("error, cannot init 'fixed' font\n");
+ e
print
("error, cannot init 'fixed' font\n");
dc.font.ascent = dc.font.xfont->ascent;
dc.font.descent = dc.font.xfont->descent;
}
dc.font.ascent = dc.font.xfont->ascent;
dc.font.descent = dc.font.xfont->descent;
}