swk

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

commit f5a78d186f813021cbe6acc116a41be5f7d6b983
parent fe2a90b53fd9ecc20a7747a38f6b04489017227c
Author: pancake <pancake@nopcode.org>
Date:   Wed,  1 Sep 2010 00:26:27 +0200

cleanup warnings
do not update in motion
Diffstat:
TODO | 2++
gi_x11.c | 2+-
image.c | 7++++---
swk.c | 2+-
swk.h | 4++--
5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/TODO b/TODO @@ -1,5 +1,7 @@ TODO ==== + * change cursor + * change window title in runtime? * how to schedule a function to be executed in N ns? * Add thresold to detect click and pan * implement a top bar to mark selected column diff --git a/gi_x11.c b/gi_x11.c @@ -287,7 +287,7 @@ swk_gi_img_new(int w, int h, int color) { img->h = h*fs; img->bpp = 24; img->priv = NULL; - img->name = NULL; + *img->name = 0; img->data = malloc(img->w*img->h*4); memset(img->data, colors[color]&0xff, img->w*img->h*4); img->pub = XCreateImage(dc->dpy, DefaultVisual(dc->dpy, 0), 24, ZPixmap, diff --git a/image.c b/image.c @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include "swk.h" +#include <stdlib.h> +#include <string.h> #include <Imlib2.h> #define MAXIMGS 32 @@ -7,10 +9,9 @@ SwkImage * img_open(const char *str) { - int x,y; - SwkImage *img = malloc(sizeof(SwkImage)); + SwkImage *img = (SwkImage*)malloc(sizeof(SwkImage)); if(str) { - img->name = strdup (str); + strncpy(img->name, str, sizeof(img->name)-1); img->priv = imlib_load_image (str); imlib_context_set_image ((Imlib_Image*)img->priv); img->w = imlib_image_get_width(); diff --git a/swk.c b/swk.c @@ -271,7 +271,7 @@ swk_handle_event(SwkEvent *e) { if(SWK_HIT(b->r, e->data.motion)) { e->win->box = e->box = b; b->cb(e); - swk_update(); +// swk_update(); break; } } diff --git a/swk.h b/swk.h @@ -79,7 +79,7 @@ struct SwkWindow { }; typedef struct { - char* name; + char name[32]; int ref; void *data; int bpp; @@ -178,4 +178,4 @@ void text_sel_mode(Text *t, int enable); /* text.c widgets */ void swk_text(SwkEvent *e); SwkImage *img_open(const char *str); -void img_close(SwkImage *img); +void img_free(SwkImage *img);