[hackers] [wmii] Rewrote draw_frame, and removed per-frame BlitzBrushes

From: Kris Maglione <jg_AT_suckless.org>
Date: Tue Feb 20 23:35:20 2007

changeset: 1914:f42f097627f2
parent: 1912:d1f81815a442
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Feb 20 17:31:42 2007 -0500
summary: Rewrote draw_frame, and removed per-frame BlitzBrushes

diff -r 0881719c95c9 -r f42f097627f2 event.c
--- a/event.c Tue Feb 20 19:24:45 2007 +0100
+++ b/event.c Tue Feb 20 17:31:42 2007 -0500
@@ -69,10 +69,10 @@ buttonpress(XEvent *e) {
                         if(ev->button == Button1) {
                                 if(frame_to_top(f))
                                         restack_view(f->view);
- if(ispointinrect(ev->x, ev->y, &f->grabbox.rect))
+ if(ispointinrect(ev->x, ev->y, &f->grabbox))
                                         do_mouse_resize(f->client, True, CENTER);
                                 else if(!ev->subwindow
- && !ispointinrect(ev->x, ev->y, &f->titlebar.rect))
+ && !ispointinrect(ev->x, ev->y, &f->titlebar))
                                         do_mouse_resize(f->client, False,
                                                 quadofcoord(&f->rect, ev->x_root, ev->y_root));
                                 if(f->client != sel_client())
diff -r 0881719c95c9 -r f42f097627f2 frame.c
--- a/frame.c Tue Feb 20 19:24:45 2007 +0100
+++ b/frame.c Tue Feb 20 17:31:42 2007 -0500
@@ -24,14 +24,6 @@ create_frame(Client *c, View *v) {
                 f->revert.height = f->rect.height += frame_delta_h();
         }
         f->collapsed = False;
- f->tile.blitz = &blz;
- f->tile.drawable = pmap;
- f->tile.gc = c->gc;
- f->tile.font = &def.font;
- f->tile.color = def.normcolor;
- f->tile.border = False;
- f->grabbox = f->titlebar = f->tile;
- f->titlebar.align = WEST;
 
         return f;
 }
@@ -211,38 +203,47 @@ frame_delta_h() {
 
 void
 draw_frame(Frame *f) {
+ BlitzBrush br = { 0 };
+
+ br.blitz = &blz;
+ br.font = &def.font;
+ br.drawable = pmap;
+ br.gc = f->client->gc;
         if(f->client == screen->focus)
- f->grabbox.color = f->tile.color = f->titlebar.color = def.focuscolor;
+ br.color = def.focuscolor;
         else
- f->grabbox.color = f->tile.color = f->titlebar.color = def.normcolor;
+ br.color = def.normcolor;
+
+ br.rect = f->rect;
+ br.rect.x = 0;
+ br.rect.y = 0;
+ draw_tile(&br);
+
+ br.rect.x += def.font.height - 3;
+ br.rect.width -= br.rect.x;
+ br.rect.height = labelh(&def.font);
+ draw_label(&br, f->client->name);
+
+ br.border = 1;
+ br.rect.width += br.rect.x;
+ br.rect.x = 0;
+ f->titlebar.x = br.rect.x + 1;
+ f->titlebar.height = br.rect.height - 1;
+ f->titlebar.y = br.rect.y + 1;
+ f->titlebar.width = br.rect.width - 2;
+ draw_border(&br);
+ br.rect.height = f->rect.height;
+ draw_border(&br);
+
         if(f->client->urgent)
- f->grabbox.color.bg = f->grabbox.color.fg;
-
- if(def.border) {
- f->tile.border = 1;
- f->tile.rect = f->rect;
- f->tile.rect.x = f->tile.rect.y = 0;
- }
- f->grabbox.rect = f->tile.rect;
- f->grabbox.rect.x += 2;
- f->grabbox.rect.y += 2;
- f->grabbox.rect.height = labelh(&def.font) - 4;
- f->grabbox.rect.width = def.font.height - 3;
- f->grabbox.border = 1;
- f->titlebar.rect.x = f->grabbox.rect.x + f->grabbox.rect.width;
- f->titlebar.rect.y = f->tile.rect.y;
- f->titlebar.rect.width = f->rect.width - f->titlebar.rect.x;
- f->titlebar.rect.height = labelh(&def.font);
- f->titlebar.border = 0;
- draw_tile(&f->tile);
- draw_label(&f->titlebar, f->client->name);
- draw_border(&f->tile);
- /* XXX: Hack */
- f->titlebar.rect.x = 0;
- f->titlebar.rect.width = f->rect.width;
- f->titlebar.border = 1;
- draw_border(&f->titlebar);
- draw_tile(&f->grabbox);
+ br.color.bg = br.color.fg;
+ br.rect.x = 2;
+ br.rect.y = 2;
+ br.rect.height = labelh(&def.font) - 4;
+ br.rect.width = def.font.height - 3;
+ f->grabbox = br.rect;
+ draw_tile(&br);
+
         XCopyArea(
                 /* display */ blz.dpy,
                 /* src */ pmap,
diff -r 0881719c95c9 -r f42f097627f2 rc/status
--- a/rc/status Tue Feb 20 19:24:45 2007 +0100
+++ b/rc/status Tue Feb 20 17:31:42 2007 -0500
@@ -1,9 +1,15 @@
 #!/bin/sh
 # periodically print date and load average to the bar
 
+status() {
+ echo -n `uptime | sed 's/.*://; s/,//g'`
+ echo -n ' | '
+ echo -n `date`
+}
+
 wmiir remove /rbar/status 2>/dev/null && sleep 2
 echo $WMII_SELCOLORS | wmiir create /rbar/status
-while wmiir xwrite /rbar/status "$WMII_NORMCOLORS" `date` `uptime | sed 's/.*://; s/,//g'`
+while wmiir xwrite /rbar/status "$WMII_NORMCOLORS" `status`
 do
         sleep 1
 done
diff -r 0881719c95c9 -r f42f097627f2 wmii.1
--- a/wmii.1 Tue Feb 20 19:24:45 2007 +0100
+++ b/wmii.1 Tue Feb 20 17:31:42 2007 -0500
@@ -13,7 +13,7 @@ any executable file. It is executed usu
 any executable file. It is executed usually by selecting it from the
 actions menu.
 You can customize an action by copying it from the global action
-directory CONFPREFIX/wmii-3.5 to $HOME/.wmii-3.5 and then editing the copy to
+directory CONFPREFIX/wmii-CONFVERSION to $HOME/.wmii-CONFVERSION and then editing the copy to
 fit your needs. Of course you can also create your own actions there; make
 sure that they are executable.
 .P
@@ -177,10 +177,10 @@ bindings, the bar labels, etc.
 /tmp/ns.$USER.${DISPLAY%.0}/wmii
 The wmii socket file which provides a 9P service.
 .TP
-CONFPREFIX/wmii-3.5
+CONFPREFIX/wmii-CONFVERSION
 Global action directory.
 .TP
-$HOME/.wmii-3.5
+$HOME/.wmii-CONFVERSION
 User-specific action directory. Actions are first searched here.
 .SH ENVIRONMENT
 .TP
diff -r 0881719c95c9 -r f42f097627f2 wmii.h
--- a/wmii.h Tue Feb 20 19:24:45 2007 +0100
+++ b/wmii.h Tue Feb 20 17:31:42 2007 -0500
@@ -140,9 +140,8 @@ struct Frame {
         XRectangle revert;
         Client *client;
         Bool collapsed;
- BlitzBrush tile;
- BlitzBrush grabbox;
- BlitzBrush titlebar;
+ XRectangle grabbox;
+ XRectangle titlebar;
 };
 
 struct Client {
Received on Tue Feb 20 2007 - 23:35:20 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:34 UTC