[hackers] [libdraw] removed cursor, added line || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Fri, 30 Jul 2010 09:26:28 +0000 (UTC)

changeset: 5:1eb993cafe2a
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Fri Jul 30 10:25:41 2010 +0100
files: Makefile draw.h drawcursor.c drawline.c drawtextn.c
description:
removed cursor, added line

diff -r c10b3ecd18e9 -r 1eb993cafe2a Makefile
--- a/Makefile Tue Jul 27 13:40:31 2010 +0100
+++ b/Makefile Fri Jul 30 10:25:41 2010 +0100
@@ -3,9 +3,8 @@
 
 include config.mk
 
-SRC = cleanupdraw.c commitdraw.c drawbox.c drawcursor.c drawsquare.c \
- drawtext.c drawtextn.c eprint.c getcolor.c initfont.c setupdraw.c \
- textnw.c textw.c
+SRC = cleanupdraw.c commitdraw.c drawbox.c drawline.c drawsquare.c drawtext.c \
+ drawtextn.c eprint.c getcolor.c initfont.c setupdraw.c textnw.c textw.c
 OBJ = ${SRC:.c=.o}
 
 all: options libdraw.a
diff -r c10b3ecd18e9 -r 1eb993cafe2a draw.h
--- a/draw.h Tue Jul 27 13:40:31 2010 +0100
+++ b/draw.h Fri Jul 30 10:25:41 2010 +0100
@@ -30,7 +30,8 @@
 void cleanupdraw(DC *dc);
 void commitdraw(DC *dc, Window w);
 void drawbox(DC *dc, unsigned long col[ColLast]);
-void drawcursor(DC *dc, const char *text, size_t pos, unsigned long col[ColLast]);
+void drawline(DC *dc, int x, int y, unsigned int w, unsigned int h,
+ unsigned long col[ColLast]);
 void drawsquare(DC *dc, Bool filled, unsigned long col[ColLast]);
 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]);
diff -r c10b3ecd18e9 -r 1eb993cafe2a drawcursor.c
--- a/drawcursor.c Tue Jul 27 13:40:31 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#include <X11/Xlib.h>
-#include <draw.h>
-
-void
-drawcursor(DC *dc, const char *text, size_t pos, unsigned long col[ColLast]) {
- XRectangle r = { dc->x, dc->y + 2, 1, dc->font.height - 2 };
-
- r.x += textnw(dc, text, pos) + dc->font.height / 2;
- XSetForeground(dc->dpy, dc->gc, FG(dc, col));
- XFillRectangles(dc->dpy, dc->drawable, dc->gc, &r, 1);
-}
diff -r c10b3ecd18e9 -r 1eb993cafe2a drawline.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/drawline.c Fri Jul 30 10:25:41 2010 +0100
@@ -0,0 +1,11 @@
+#include <X11/Xlib.h>
+#include <draw.h>
+
+void
+drawline(DC *dc, int x, int y, unsigned int w, unsigned int h,
+ unsigned long col[ColLast]) {
+ XRectangle r = { dc->x + x, dc->y + y, w, h };
+
+ XSetForeground(dc->dpy, dc->gc, FG(dc, col));
+ XFillRectangles(dc->dpy, dc->drawable, dc->gc, &r, 1);
+}
diff -r c10b3ecd18e9 -r 1eb993cafe2a drawtextn.c
--- a/drawtextn.c Tue Jul 27 13:40:31 2010 +0100
+++ b/drawtextn.c Fri Jul 30 10:25:41 2010 +0100
@@ -12,8 +12,8 @@
         size_t mn;
 
         h = dc->font.height;
- y = dc->y + ((h+2) / 2) - (h / 2) + dc->font.ascent;
- x = dc->x + (h / 2);
+ y = dc->y + ((h+2)/2) - h/2 + dc->font.ascent;
+ x = dc->x + h/2;
         /* shorten text if necessary */
         for(mn = MIN(n, sizeof buf); mn && textnw(dc, text, mn) > dc->w - h; mn--);
         if(!mn)
Received on Fri Jul 30 2010 - 11:26:28 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 30 2010 - 11:36:04 CEST