[hackers] [swk] various fixes in animation and layout of test.c || pancake

From: <hg_AT_suckless.org>
Date: Wed, 25 Aug 2010 03:35:06 +0000 (UTC)

changeset: 67:56bb495ab32c
tag: tip
user: pancake <pancake_AT_nopcode.org>
date: Wed Aug 25 05:30:41 2010 +0200
files: gi_x11.c swk.c t/test.c
description:
various fixes in animation and layout of test.c

diff -r a59af1f44831 -r 56bb495ab32c gi_x11.c
--- a/gi_x11.c Wed Aug 25 05:00:20 2010 +0200
+++ b/gi_x11.c Wed Aug 25 05:30:41 2010 +0200
@@ -128,23 +128,22 @@
                 if(!mousemoved) {
                         ret->type = EClick;
                         switch(event.xbutton.state) {
- case 4096:
+ case 4096: // 0x1000
                                 ret->data.click.button = 4;
                                 break;
- case 2048:
+ case 2048: // 0x800
                                 ret->data.click.button = 5;
                                 break;
- case 1024:
+ case 1024: // 0x400
                                 ret->data.click.button = 2;
                                 break;
- case 512:
+ case 512: // 0x200
                                 ret->data.click.button = 3;
                                 break;
- case 256:
+ case 256: // 0x100
                                 ret->data.click.button = 1;
                                 break;
                         }
-printf ("STATE=%d\n", event.xbutton.state);
                         ret->data.click.point.x = event.xbutton.x / fs;
                         ret->data.click.point.y = event.xbutton.y / fs;
                 }
@@ -294,7 +293,7 @@
 void*
 swk_gi_img_load(const char *str) {
         /* TODO */
- return NULL;
+ return (void*)1;
 }
 
 void
diff -r a59af1f44831 -r 56bb495ab32c swk.c
--- a/swk.c Wed Aug 25 05:00:20 2010 +0200
+++ b/swk.c Wed Aug 25 05:30:41 2010 +0200
@@ -61,14 +61,15 @@
         if(rendering)
                 return;
         // TODO: Handle scrollup by widget focus
- if(w->box->r.y > w->r.h)
- setscrollbox(-2);
+ //if(w->box->r.y > w->r.h)
+ //setscrollbox(-2);
         rendering = 1;
         w->_e.type = EExpose;
         if(swk_gi_update(w)) {
                 int count = 2;
                 int orw = w->r.w;
                 SwkBox *b = w->boxes[0];
+
                 swk_fit(w);
                 swk_gi_clear();
                 //if(!w->colpos) {
@@ -98,7 +99,7 @@
                                         //swk_gi_line(--r.x, roy, 2, 0, ColorHI);
                                         swk_gi_line((b==w->boxes[0])?w->colpos:0, roy, w->r.w, 0, ColorHI);
                                 } else b->cb(&w->_e);
- oy = b->r.y;
+ oy = b->r.h;
                         }
                         if(!w->boxes[1] || !--count)
                                 break;
diff -r a59af1f44831 -r 56bb495ab32c t/test.c
--- a/t/test.c Wed Aug 25 05:00:20 2010 +0200
+++ b/t/test.c Wed Aug 25 05:30:41 2010 +0200
@@ -83,11 +83,15 @@
                 swk_update(w);
                 usleep(10000);
         }
- w->col=(w->colpos>0)?1:0;
+ w->colpos=s>0?w->r.w:0;
+ w->col=(s>0)?0:1;
+ w->box=w->boxes[s>0?1:0];
 }
 static void mybutton_about_ok(SwkEvent *e) {
         if(e->type == EClick) {
- e->win->boxes[e->win->col] = helloworld;
+ animate(e->win, -1);
+ e->win->boxes[0] = helloworld;
+ animate(e->win, 1);
                 swk_update(e->win);
         }
         swk_button(e);
@@ -96,7 +100,7 @@
 static void mybutton_about(SwkEvent *e) {
         if(e->type == EClick) {
                 animate(e->win, -1);
- e->win->boxes[e->win->col] = about;
+ e->win->boxes[0] = about;
                 swk_update(e->win);
         }
         swk_button(e);
@@ -112,7 +116,7 @@
 
 static void mybutton_close(SwkEvent *e) {
         if(e->type == EClick) {
- e->win->boxes[e->win->col] = helloworld;
+ e->win->boxes[0] = helloworld;
                 swk_update(e->win);
         }
         swk_button(e);
@@ -124,7 +128,7 @@
         SWK_BOX_NEWLINE(1),
         { .cb=mybutton_close, .text="Close" },
         { .cb=swk_separator },
- SWK_BOX_NEWLINE(1),
+ SWK_BOX_NEWLINE(2),
         { .cb=swk_label, .text=" /etc" },
         SWK_BOX_NEWLINE(1),
         { .cb=swk_button, .text="/bin" },
@@ -136,7 +140,7 @@
 
 static void mybutton_numscroll(SwkEvent *e) {
         if(e->type == EClick) {
- e->win->boxes[e->win->col] = scrollwin;
+ e->win->boxes[0] = scrollwin;
                 swk_update(e->win);
         }
         swk_button(e);
@@ -208,6 +212,10 @@
         };
         if(!swk_use(&w))
                 return 1;
+swk_scroll_down();
+swk_scroll_down();
+swk_scroll_down();
+swk_scroll_down();
         swk_loop();
         return 0;
 }
Received on Wed Aug 25 2010 - 05:35:06 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 25 2010 - 05:36:04 CEST