changeset: 19:80b8cded8a20
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Thu Aug 19 16:17:48 2010 +0100
files: Makefile commitdraw.c draw.h drawtext.c eprintf.c mapdraw.c resizedraw.c setcanvas.c weprintf.c
description:
renamed mapdraw & resizedraw, removed ifndef guard
diff -r 33e96095e893 -r 80b8cded8a20 Makefile
--- a/Makefile Thu Aug 19 16:00:22 2010 +0100
+++ b/Makefile Thu Aug 19 16:17:48 2010 +0100
@@ -3,8 +3,8 @@
include config.mk
-SRC = commitdraw.c drawrect.c drawtext.c drawtextn.c eprintf.c freedraw.c \
- getcolor.c initdraw.c initfont.c setcanvas.c textnw.c textw.c weprintf.c
+SRC = drawrect.c drawtext.c drawtextn.c eprintf.c freedraw.c getcolor.c \
+ initdraw.c initfont.c mapdraw.c resizedraw.c textnw.c textw.c weprintf.c
OBJ = ${SRC:.c=.o}
diff -r 33e96095e893 -r 80b8cded8a20 commitdraw.c
--- a/commitdraw.c Thu Aug 19 16:00:22 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include <X11/Xlib.h>
-#include "draw.h"
-
-void
-commitdraw(DC *dc, Window win, unsigned int w, unsigned int h) {
- XCopyArea(dc->dpy, dc->canvas, win, dc->gc, 0, 0, w, h, 0, 0);
-}
diff -r 33e96095e893 -r 80b8cded8a20 draw.h
--- a/draw.h Thu Aug 19 16:00:22 2010 +0100
+++ b/draw.h Thu Aug 19 16:17:48 2010 +0100
@@ -1,9 +1,4 @@
/* See LICENSE file for copyright and license details. */
-#ifndef DRAW_H
-#define DRAW_H
-
-#include <X11/Xlib.h>
-
#define FG(dc, col) ((col)[(dc)->invert ? ColBG : ColFG])
#define BG(dc, col) ((col)[(dc)->invert ? ColFG : ColBG])
@@ -24,7 +19,6 @@
} font;
} DC; /* draw context */
-void commitdraw(DC *dc, Window win, unsigned int w, unsigned int h);
void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color);
void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]);
@@ -33,11 +27,10 @@
unsigned long getcolor(DC *dc, const char *colstr);
DC *initdraw(void);
void initfont(DC *dc, const char *fontstr);
-void setcanvas(DC *dc, unsigned int w, unsigned int h);
+void mapdraw(DC *dc, Window win, unsigned int w, unsigned int h);
+void resizedraw(DC *dc, unsigned int w, unsigned int h);
int textnw(DC *dc, const char *text, size_t len);
int textw(DC *dc, const char *text);
void weprintf(const char *fmt, ...);
const char *progname;
-
-#endif
diff -r 33e96095e893 -r 80b8cded8a20 drawtext.c
--- a/drawtext.c Thu Aug 19 16:00:22 2010 +0100
+++ b/drawtext.c Thu Aug 19 16:17:48 2010 +0100
@@ -1,5 +1,6 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+#include <X11/Xlib.h>
#include "draw.h"
#define MIN(a, b) ((a) < (b) ? (a) : (b))
diff -r 33e96095e893 -r 80b8cded8a20 eprintf.c
--- a/eprintf.c Thu Aug 19 16:00:22 2010 +0100
+++ b/eprintf.c Thu Aug 19 16:17:48 2010 +0100
@@ -2,6 +2,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <X11/Xlib.h>
#include "draw.h"
void
diff -r 33e96095e893 -r 80b8cded8a20 mapdraw.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mapdraw.c Thu Aug 19 16:17:48 2010 +0100
@@ -0,0 +1,8 @@
+/* See LICENSE file for copyright and license details. */
+#include <X11/Xlib.h>
+#include "draw.h"
+
+void
+mapdraw(DC *dc, Window win, unsigned int w, unsigned int h) {
+ XCopyArea(dc->dpy, dc->canvas, win, dc->gc, 0, 0, w, h, 0, 0);
+}
diff -r 33e96095e893 -r 80b8cded8a20 resizedraw.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/resizedraw.c Thu Aug 19 16:17:48 2010 +0100
@@ -0,0 +1,15 @@
+/* See LICENSE file for copyright and license details. */
+#include <X11/Xlib.h>
+#include "draw.h"
+
+void
+resizedraw(DC *dc, unsigned int w, unsigned int h) {
+ if(dc->canvas)
+ XFreePixmap(dc->dpy, dc->canvas);
+ dc->canvas = XCreatePixmap(dc->dpy, DefaultRootWindow(dc->dpy), w, h,
+ DefaultDepth(dc->dpy, DefaultScreen(dc->dpy)));
+ dc->x = dc->y = 0;
+ dc->w = w;
+ dc->h = h;
+ dc->invert = False;
+}
diff -r 33e96095e893 -r 80b8cded8a20 setcanvas.c
--- a/setcanvas.c Thu Aug 19 16:00:22 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include <X11/Xlib.h>
-#include "draw.h"
-
-void
-setcanvas(DC *dc, unsigned int w, unsigned int h) {
- if(dc->canvas)
- XFreePixmap(dc->dpy, dc->canvas);
- dc->canvas = XCreatePixmap(dc->dpy, DefaultRootWindow(dc->dpy), w, h,
- DefaultDepth(dc->dpy, DefaultScreen(dc->dpy)));
- dc->x = dc->y = 0;
- dc->w = w;
- dc->h = h;
- dc->invert = False;
-}
diff -r 33e96095e893 -r 80b8cded8a20 weprintf.c
--- a/weprintf.c Thu Aug 19 16:00:22 2010 +0100
+++ b/weprintf.c Thu Aug 19 16:17:48 2010 +0100
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <stdarg.h>
#include <stdio.h>
+#include <X11/Xlib.h>
#include "draw.h"
void
Received on Thu Aug 19 2010 - 17:17:52 CEST
This archive was generated by hypermail 2.2.0 : Thu Aug 19 2010 - 17:24:04 CEST