[hackers] [swk] fix button widget boundaries || pancake<nopcode.org>

From: <hg_AT_suckless.org>
Date: Tue, 24 Aug 2010 17:08:01 +0000 (UTC)

changeset: 63:cda24b52df4a
tag: tip
user: pancake<nopcode.org>
date: Tue Aug 24 19:04:00 2010 +0200
files: swk.c
description:
fix button widget boundaries

diff -r 7789f576b969 -r cda24b52df4a swk.c
--- a/swk.c Tue Aug 24 18:34:44 2010 +0200
+++ b/swk.c Tue Aug 24 19:04:00 2010 +0200
@@ -5,6 +5,7 @@
 #include "swk.h"
 #include "config.h"
 
+#define BORDERCOLOR ((e->win->box==e->box)?ColorHI:ColorFG)
 static void setscrollbox(int delta);
 static SwkWindow *w = NULL;
 static int running = 0;
@@ -411,9 +412,7 @@
                 swk_gi_text(r, e->box->text);
                 r.x--;
                 r.w--;
- if(e->win->box == e->box)
- swk_gi_rect(r, ColorHI);
- else swk_gi_rect(r, ColorFG);
+ swk_gi_rect(r, BORDERCOLOR);
                 break;
         default:
                 break;
@@ -427,15 +426,13 @@
         case EExpose:
                 e->box->r.h = 3;
                 r = e->box->r;
- r.x += 3;
- r.y += 1;
+ r.x += 2;
+ r.y++;
                 swk_gi_text(r, e->box->text);
- r.y -= 1;
- r.x -= 1;
+ r.x--;
+ r.y--;
                 r.w--;
- if(e->win->box == e->box)
- swk_gi_rect(r, ColorHI);
- else swk_gi_rect(r, ColorFG);
+ swk_gi_rect(r, BORDERCOLOR);
                 break;
         default:
                 break;
@@ -482,9 +479,7 @@
         switch(e->type) {
         case EExpose:
                 r = e->box->r;
- if(e->win->box == e->box)
- swk_gi_line(r.x, r.y+1, r.w, 0, ColorHI);
- else swk_gi_line(r.x, r.y+1, r.w, 0, ColorFG);
+ swk_gi_line(r.x, r.y+1, r.w, 0, BORDERCOLOR);
                 break;
         default:
                 break;
@@ -532,9 +527,7 @@
         }
         switch(e->type) {
         case EExpose:
- if (e->box->data)
- swk_gi_img(e->box->r, e->box->data);
- else swk_gi_rect(e->box->r, ColorFG);
+ swk_gi_rect(e->box->r, BORDERCOLOR);
                 if(e->win->box == e->box) {
                         Rect r = e->box->r;
                         swk_gi_line(r.x, r.y+1, r.w, 0, ColorHI);
Received on Tue Aug 24 2010 - 19:08:01 CEST

This archive was generated by hypermail 2.2.0 : Tue Aug 24 2010 - 19:12:04 CEST