[hackers] [swk] cleanup warnings || pancake

From: <hg_AT_suckless.org>
Date: Tue, 31 Aug 2010 22:29:40 +0000 (UTC)

changeset: 73:4b079764ae28
tag: tip
user: pancake <pancake_AT_nopcode.org>
date: Wed Sep 01 00:26:27 2010 +0200
files: TODO gi_x11.c image.c swk.c swk.h
description:
cleanup warnings
do not update in motion

diff -r ecce56149925 -r 4b079764ae28 TODO
--- a/TODO Wed Sep 01 00:11:22 2010 +0200
+++ b/TODO Wed Sep 01 00:26:27 2010 +0200
@@ -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 -r ecce56149925 -r 4b079764ae28 gi_x11.c
--- a/gi_x11.c Wed Sep 01 00:11:22 2010 +0200
+++ b/gi_x11.c Wed Sep 01 00:26:27 2010 +0200
@@ -287,7 +287,7 @@
         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 -r ecce56149925 -r 4b079764ae28 image.c
--- a/image.c Wed Sep 01 00:11:22 2010 +0200
+++ b/image.c Wed Sep 01 00:26:27 2010 +0200
@@ -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 -r ecce56149925 -r 4b079764ae28 swk.c
--- a/swk.c Wed Sep 01 00:11:22 2010 +0200
+++ b/swk.c Wed Sep 01 00:26:27 2010 +0200
@@ -271,7 +271,7 @@
                         if(SWK_HIT(b->r, e->data.motion)) {
                                 e->win->box = e->box = b;
                                 b->cb(e);
- swk_update();
+// swk_update();
                                 break;
                         }
                 }
diff -r ecce56149925 -r 4b079764ae28 swk.h
--- a/swk.h Wed Sep 01 00:11:22 2010 +0200
+++ b/swk.h Wed Sep 01 00:26:27 2010 +0200
@@ -79,7 +79,7 @@
 };
 
 typedef struct {
- char* name;
+ char name[32];
         int ref;
         void *data;
         int bpp;
@@ -178,4 +178,4 @@
 /* text.c widgets */
 void swk_text(SwkEvent *e);
 SwkImage *img_open(const char *str);
-void img_close(SwkImage *img);
+void img_free(SwkImage *img);
Received on Wed Sep 01 2010 - 00:29:40 CEST

This archive was generated by hypermail 2.2.0 : Wed Sep 01 2010 - 00:36:04 CEST