moved liblitz/geometry.c to cmd/wm/geom.c

This commit is contained in:
Anselm R. Garbe 2006-06-12 13:20:30 +02:00
parent 5fd06b376c
commit 57b7bf74d4
8 changed files with 20 additions and 22 deletions

View File

@ -9,8 +9,8 @@ LDFLAGS += -L../../liblitz -llitz -L../../libixp -lixp -L../../libcext -lcext -
# Solaris # Solaris
# LDFLAGS += -lsocket # LDFLAGS += -lsocket
SRC = area.c bar.c client.c column.c event.c frame.c fs.c key.c mouse.c \ SRC = area.c bar.c client.c column.c event.c frame.c fs.c geom.c \
rule.c view.c wm.c key.c mouse.c rule.c view.c wm.c
OBJ = ${SRC:.c=.o} OBJ = ${SRC:.c=.o}
all: wmiiwm all: wmiiwm

View File

@ -330,10 +330,10 @@ frame_of_point(XPoint *pt)
if(!v) if(!v)
return nil; return nil;
for(a=v->area->next; a && !blitz_ispointinrect(pt->x, pt->y, &a->rect); for(a=v->area->next; a && !ispointinrect(pt->x, pt->y, &a->rect);
a=a->next); a=a->next);
if(a) if(a)
for(f=a->frame; f && !blitz_ispointinrect(pt->x, pt->y, &f->rect); for(f=a->frame; f && !ispointinrect(pt->x, pt->y, &f->rect);
f=f->anext); f=f->anext);
return f; return f;
} }
@ -348,7 +348,7 @@ drop_move(Frame *f, XRectangle *new, XPoint *pt)
if(!pt) if(!pt)
return; return;
for(tgt=v->area->next; tgt && !blitz_ispointinrect(pt->x, pt->y, &tgt->rect); for(tgt=v->area->next; tgt && !ispointinrect(pt->x, pt->y, &tgt->rect);
tgt=tgt->next); tgt=tgt->next);
if(tgt) { if(tgt) {
if(pt->x < 16) { if(pt->x < 16) {

View File

@ -72,7 +72,7 @@ handle_buttonrelease(XEvent *e)
static char buf[32]; static char buf[32];
if(ev->window == barwin) { if(ev->window == barwin) {
for(b=bar; b; b=b->next) for(b=bar; b; b=b->next)
if(blitz_ispointinrect(ev->x, ev->y, &b->rect)) { if(ispointinrect(ev->x, ev->y, &b->rect)) {
snprintf(buf, sizeof(buf), "BarClick %s %d\n", snprintf(buf, sizeof(buf), "BarClick %s %d\n",
b->name, ev->button); b->name, ev->button);
write_event(buf); write_event(buf);
@ -101,7 +101,7 @@ handle_buttonpress(XEvent *e)
do_mouse_resize(c, CENTER); do_mouse_resize(c, CENTER);
break; break;
case Button3: case Button3:
do_mouse_resize(c, blitz_quadofcoord(&c->rect, ev->x, ev->y)); do_mouse_resize(c, quadofcoord(&c->rect, ev->x, ev->y));
default: default:
break; break;
} }

View File

@ -1437,7 +1437,7 @@ xwrite(IXPConn *c, Fcall *fcall)
XRectangle new; XRectangle new;
f = FRAME(i3); f = FRAME(i3);
new = f->rect; new = f->rect;
blitz_strtorect(&new, buf); strtorect(&new, buf);
if(new.width == 0) if(new.width == 0)
new.width = rect.width; new.width = rect.width;
if(new.height == 0) if(new.height == 0)

View File

@ -4,14 +4,11 @@
*/ */
#include <math.h> #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cext.h>
#include "blitz.h" #include "wm.h"
BlitzAlign BlitzAlign
blitz_quadofcoord(XRectangle *rect, int x, int y) quadofcoord(XRectangle *rect, int x, int y)
{ {
BlitzAlign ret = 0; BlitzAlign ret = 0;
x -= rect->x; x -= rect->x;
@ -29,15 +26,16 @@ blitz_quadofcoord(XRectangle *rect, int x, int y)
return ret; return ret;
} }
Bool blitz_ispointinrect(int x, int y, XRectangle * r) Bool
ispointinrect(int x, int y, XRectangle * r)
{ {
return (x >= r->x) && (x <= r->x + r->width) return (x >= r->x) && (x <= r->x + r->width)
&& (y >= r->y) && (y <= r->y + r->height); && (y >= r->y) && (y <= r->y + r->height);
} }
/* Syntax: <x> <y> <width> <height> */ /* Syntax: <x> <y> <width> <height> */
int blitz_strtorect(XRectangle *r, const char *val) int
strtorect(XRectangle *r, const char *val)
{ {
XRectangle new; XRectangle new;
if (!val) if (!val)

View File

@ -322,6 +322,11 @@ unsigned long long pack_qpath(unsigned char type, unsigned short i1,
void write_event(char *event); void write_event(char *event);
void new_ixp_conn(IXPConn *c); void new_ixp_conn(IXPConn *c);
/* geom.c */
BlitzAlign quadofcoord(XRectangle *rect, int x, int y);
Bool ispointinrect(int x, int y, XRectangle * r);
int strtorect(XRectangle *r, const char *val);
/* key.c */ /* key.c */
void handle_key(Window w, unsigned long mod, KeyCode keycode); void handle_key(Window w, unsigned long mod, KeyCode keycode);
void update_keys(); void update_keys();

View File

@ -6,7 +6,7 @@ include ../config.mk
CFLAGS += -I../libixp -I../libcext CFLAGS += -I../libixp -I../libcext
LDFLAGS += -L../libixp -lixp -L../libcext -lcext LDFLAGS += -L../libixp -lixp -L../libcext -lcext
SRC = blitz.c color.c font.c draw.c geometry.c window.c SRC = blitz.c color.c font.c draw.c window.c
OBJ = ${SRC:.c=.o} OBJ = ${SRC:.c=.o}
all: liblitz.a all: liblitz.a

View File

@ -59,11 +59,6 @@ int blitz_loadcolor(Display *dpy, BlitzColor *c, int mon, char *colstr);
void blitz_drawlabel(Display *dpy, BlitzDraw *d); void blitz_drawlabel(Display *dpy, BlitzDraw *d);
void blitz_drawborder(Display *dpy, BlitzDraw *d); void blitz_drawborder(Display *dpy, BlitzDraw *d);
/* geometry.c */
int blitz_strtorect(XRectangle *r, const char *val);
BlitzAlign blitz_quadofcoord(XRectangle *rect, int x, int y);
Bool blitz_ispointinrect(int x, int y, XRectangle *r);
/* new stuff */ /* new stuff */
typedef struct { typedef struct {