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
# LDFLAGS += -lsocket
SRC = area.c bar.c client.c column.c event.c frame.c fs.c key.c mouse.c \
rule.c view.c wm.c
SRC = area.c bar.c client.c column.c event.c frame.c fs.c geom.c \
key.c mouse.c rule.c view.c wm.c
OBJ = ${SRC:.c=.o}
all: wmiiwm

View File

@ -330,10 +330,10 @@ frame_of_point(XPoint *pt)
if(!v)
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);
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);
return f;
}
@ -348,7 +348,7 @@ drop_move(Frame *f, XRectangle *new, XPoint *pt)
if(!pt)
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);
if(tgt) {
if(pt->x < 16) {

View File

@ -72,7 +72,7 @@ handle_buttonrelease(XEvent *e)
static char buf[32];
if(ev->window == barwin) {
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",
b->name, ev->button);
write_event(buf);
@ -101,7 +101,7 @@ handle_buttonpress(XEvent *e)
do_mouse_resize(c, CENTER);
break;
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:
break;
}

View File

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

View File

@ -4,14 +4,11 @@
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cext.h>
#include "blitz.h"
#include "wm.h"
BlitzAlign
blitz_quadofcoord(XRectangle *rect, int x, int y)
quadofcoord(XRectangle *rect, int x, int y)
{
BlitzAlign ret = 0;
x -= rect->x;
@ -29,15 +26,16 @@ blitz_quadofcoord(XRectangle *rect, int x, int y)
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)
&& (y >= r->y) && (y <= r->y + r->height);
}
/* Syntax: <x> <y> <width> <height> */
int blitz_strtorect(XRectangle *r, const char *val)
int
strtorect(XRectangle *r, const char *val)
{
XRectangle new;
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 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 */
void handle_key(Window w, unsigned long mod, KeyCode keycode);
void update_keys();

View File

@ -6,7 +6,7 @@ include ../config.mk
CFLAGS += -I../libixp -I../libcext
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}
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_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 */
typedef struct {