swk

static widget kit
git clone git://git.suckless.org/swk
Log | Files | Refs | README | LICENSE

commit 52d8d3065033ce837d7d346dd6236d6ffe7fec56
parent b1a9a45d9ed7db4cbaaff617b7dfd18eb20371cd
Author: pancake <pancake@nopcode.org>
Date:   Fri, 11 Jun 2010 11:06:45 +0200

update TODO file
fix initial break in tlock.c test program
fix segfault and invalid w->col value
Diffstat:
TODO | 34++++++++++++++++++++++------------
swk.c | 3++-
t/tlock.c | 3++-
3 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/TODO b/TODO @@ -1,30 +1,40 @@ TODO ==== + * support multiline text widget + * support for user-defined input handler + (when input widget is activated, run xterm -e vim str > text) * add support for negative colpos (align to right) - * allow to set absolute font size - * buttons must be 3 line height * receive fine-grained x,y in Point? for sketch or imaging stuff is important * support for clipboard (implemented in gi_ backend) * simple way to define callback for buttons instead of reimplementing widget (?) * full text editing widget (multiline, cursor support, text format, ...) - * scroll on focus (if focused widget is not in screen, just scroll there..) + - this must be done with an external input handler (use vim, dmenu, .. ) * mouse bindings in config.h (which mouse bindings we need? wheel to scroll?) - * allow widgets to force its own size (height, width) + - add horitzonal scroll wheel support * add support to resize images (scaling) * only focus buttons and entries (input widgets) - * add function to click button 1, 2, 3, ... // clicking from code.. + - will make the design inconsistent and the code more complex * allow to load images from memory instead of files - * default image path (?) + * define default image path in config.h + +Transitions +=========== * transitions (to change from one window to another) + - this can be done in a simple loop() calling swk_update and using colpos + +Events +====== + * We need a way to enqueue events + * add function to click button 1, 2, 3, ... // clicking from code.. -absolute/relative -================= +Think about a decent absolute/relative +====================================== * column split position (w->colpos) - * scrolling box - * font size + * scrolling box (..) + * font size (font_inc, font_dec, font_set) -USABILITY GUIDELINE -=================== +Design rules +============ * useful * usable * transparent diff --git a/swk.c b/swk.c @@ -53,6 +53,7 @@ swk_update() { for(w->r.w=col; ; b = w->boxes[1]) { swk_fit(w); roy = oy = 0; + if (b) for(;b->cb; b++) { w->_e.box = b; if(IS_SCROLLBOX(b)) @@ -248,7 +249,7 @@ swk_handle_event(SwkEvent *e) { swk_update(); break; case EMotion: - w->col = (e->data.motion.x > w->colpos)?1:0; + w->col = w->boxes[1]?((e->data.motion.x > w->colpos)?1:0):0; for(b=e->win->boxes[w->col]; b->cb; b++) { if(SWK_HIT(b->r, e->data.motion)) { e->win->box = e->box = b; diff --git a/t/tlock.c b/t/tlock.c @@ -36,7 +36,7 @@ static void mylocklabel(SwkEvent *e) { if(e->type == EExpose) { int pos = e->box->r.y; if(pos<3 || pos>e->win->r.h) { - printf("swkexit\n"); + printf("swkexit coz pos = %d\n", pos); swk_exit(); } } @@ -47,6 +47,7 @@ static SwkBox contents[] = { { .cb=swk_label, .text=timestring }, { .cb=swk_separator }, SWK_BOX_NEWLINE(-1), + SWK_BOX_NEWLINE(4), // Trick to avoid unexpected swkexit { .cb=mylocklabel, .text=" slide out to unlock", }, { .cb=NULL } };