changeset: 1738:f99260f0230c
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Feb 05 01:07:04 2007 -0500
files: mouse.c
description:
Fix a bug in mouse.c from prev commit, and one from an earlier one.
changeset: 1737:058365defb3c
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Feb 05 01:00:42 2007 -0500
files: client.c column.c mouse.c wmii.h
description:
Got rid of some of said cruft.
diff -r 7e4e30a1d4c8 -r f99260f0230c client.c
--- a/client.c Mon Feb 05 00:41:13 2007 -0500
+++ b/client.c Mon Feb 05 01:07:04 2007 -0500
@@ -543,7 +543,7 @@ move_client(Client *c, char *arg) {
new.x += x;
new.y += y;
if(!f->area->floating)
- resize_column(f->client, &new, nil);
+ resize_column(f->client, &new);
else
resize_client(f->client, &new, False);
}
@@ -559,7 +559,7 @@ size_client(Client *c, char *arg) {
new.width += w;
new.height += h;
if(!f->area->floating)
- resize_column(f->client, &new, nil);
+ resize_column(f->client, &new);
else
resize_client(f->client, &new, False);
}
diff -r 7e4e30a1d4c8 -r f99260f0230c column.c
--- a/column.c Mon Feb 05 00:41:13 2007 -0500
+++ b/column.c Mon Feb 05 01:07:04 2007 -0500
@@ -4,20 +4,6 @@
#include "wmii.h"
#include <stdlib.h>
#include <string.h>
-
-static int
-max(int a, int b) {
- if(a > b)
- return a;
- return b;
-}
-
-static int
-min(int a, int b) {
- if(a < b)
- return a;
- return b;
-}
char *
str_of_column_mode(int mode) {
@@ -311,168 +297,9 @@ AfterVertical:
focus_view(screen, v);
}
-#if 0
-/* I think this will go later */
-static Frame *
-frame_of_point(XPoint *pt) {
- Area *a;
- View *v = screen->sel;
- Frame *f = nil;
-
- if(!v)
- return nil;
- for(a=v->area->next; a && !ispointinrect(pt->x, pt->y, &a->rect);
- a=a->next);
- if(a)
- for(f=a->frame; f && !ispointinrect(pt->x, pt->y, &f->rect);
- f=f->anext);
- return f;
-}
-#endif
-
-static void
-drop_move(Frame *f, XRectangle *nrect) {
- XRectangle *arect, *frect;
- Frame *ft, *f_high;
- Area *a, *a_high;
- View *v;
- int high, over, before;
-
- v = f->view;
- high = 0;
- a_high = nil;
-
- for(a = v->area->next; a; a = a->next) {
- arect = &a->rect;
- over = min(arect->x + arect->width, nrect->x + nrect->width) -
- max(arect->x, nrect->x);
- if(over > high) {
- high = over;
- a_high = a;
- }
- }
-
- over = (nrect->x + nrect->width) - screen->rect.width;
- if(over > high) {
- for(a_high = f->area; a_high->next; a_high = a_high->next);
- a_high = new_column(v, a_high, 0);
- send_to_area(a_high, f->area, f);
- arrange_column(a_high, False);
- return;
- }else if(-(nrect->x) > high) {
- a_high = new_column(v, v->area, 0);
- send_to_area(a_high, f->area, f);
- arrange_column(a_high, False);
- return;
- }
-
- if(f->area != a_high)
- send_to_area(a_high, f->area, f);
-
- high = 0;
- for(ft = f->area->frame; ft; ft = ft->anext) {
- frect = &ft->rect;
- over = min(frect->y + frect->height, nrect->y + nrect->height) -
- max(frect->y, nrect->y);
- if(over > high) {
- high = over;
- f_high = ft;
- }
- }
-
-
- over = (nrect->y + nrect->height) - (screen->rect.height - screen->brect.height);
- if(over > high) {
- remove_frame(f);
- for(ft = f->area->frame; ft->anext; ft = ft->anext);
- insert_frame(ft, f, False);
- focus(f->client, False);
- return;
- }else if(-(nrect->y) > high) {
- remove_frame(f);
- insert_frame(f->area->frame, f, True);
- focus(f->client, False);
- return;
- }
-
- if(f_high != f) {
- remove_frame(f);
- frect = &f_high->rect;
- before = (frect->y - nrect->y) >
- ((nrect->y + nrect->height) - (frect->y + frect->height)) ?
- True : False;
- insert_frame(f_high, f, before);
- focus(f->client, False);
- }
-}
-
-#if 0
-/* I'm keeping this around for the moment. Rather than digging through hg later */
-static void
-drop_move_old(Frame *f, XRectangle *new, XPoint *pt) {
- Area *tgt, *src;
- Frame *ft;
- View *v;
-
- tgt = nil;
- src = f->area;
- v = src->view;
- if(!pt)
- return;
- for(tgt=v->area->next; tgt && !ispointinrect(pt->x, pt->y, &tgt->rect);
- tgt=tgt->next);
- if(tgt) {
- if(pt->x < 16) {
- if((src->frame && src->frame->anext) || (src != v->area->next)) {
- tgt = new_column(v, v->area->next, 0);
- send_to_area(tgt, src, f);
- }
- }
- else if(pt->x >= screen->rect.width - 16) {
- if((src->frame && src->frame->anext) || src->next) {
- for(tgt=src; tgt->next; tgt=tgt->next);
- tgt = new_column(v, tgt, 0);
- send_to_area(tgt, src, f);
- }
- }
- else if(src != tgt) {
- Client *c = f->client;
- Bool before;
- if(!(ft = frame_of_point(pt)) || (f == ft))
- return;
- before = pt->y < (ft->rect.y + ft->rect.height / 2);
- send_to_area(tgt, src, f);
- f = c->sel;
- remove_frame(f);
- if(before)
- insert_frame(ft, f, True);
- else
- insert_frame(ft, f, False);
- tgt->sel = f;
- arrange_column(tgt, False);
- }
- else { /* !tgt */
- if(!(ft = frame_of_point(pt)) || (f == ft))
- return;
- remove_frame(f);
- if(pt->y < (ft->rect.y + ft->rect.height / 2))
- insert_frame(ft, f, True);
- else
- insert_frame(ft, f, False);
- tgt->sel = f;
- arrange_column(tgt, False);
- }
- }
-}
-#endif
-
void
-resize_column(Client *c, XRectangle *r, XPoint *pt) {
- Frame *f = c->sel;
- if((f->rect.width == r->width) && (f->rect.height == r->height))
- drop_move(f, r);
- else
- drop_resize(f, r);
+resize_column(Client *c, XRectangle *r) {
+ drop_resize(c->sel, r);
}
Area *
diff -r 7e4e30a1d4c8 -r f99260f0230c mouse.c
--- a/mouse.c Mon Feb 05 00:41:13 2007 -0500
+++ b/mouse.c Mon Feb 05 01:07:04 2007 -0500
@@ -309,27 +309,29 @@ void
void
do_mouse_resize(Client *c, BlitzAlign align) {
BlitzAlign grav;
+ Window dummy;
Cursor cur;
- int dx, dy, pt_x, pt_y, hr_x, hr_y, i;
+ XEvent ev;
+ XRectangle *rects, ofrect, frect, origin;
+ int snap, dx, dy, pt_x, pt_y, hr_x, hr_y, i;
+ unsigned int num, di;
+ Bool floating;
float rx, ry;
- Window dummy;
- XEvent ev;
- unsigned int num = 0, di;
- Frame *f = c->sel;
- Bool floating = f->area->floating;
- int snap = floating ? screen->rect.height / 66 : 0;
- XRectangle *rects = floating ? rects_of_view(f->area->view, &num) : nil;
- XRectangle frect = f->rect, ofrect;
- XRectangle origin = frect;
- XPoint pt;
-
- if(align == CENTER && !floating)
+ Frame *f;
+
+ f = c->sel;
+ floating = f->area->floating;
+ origin = frect = f->rect;
+ rects = floating ? rects_of_view(f->area->view, &num) : nil;
+ snap = floating ? screen->rect.height / 66 : 0;
+ cur = cursor[CurResize];
+
+ if(!floating && (align == CENTER))
return do_managed_move(c);
XQueryPointer(blz.dpy, c->framewin, &dummy, &dummy, &i, &i, &pt_x, &pt_y, &di);
rx = (float)pt_x / frect.width;
ry = (float)pt_y / frect.height;
- cur = cursor[CurResize];
if (align != CENTER) {
pt_x = dx = frect.width / 2;
@@ -347,7 +349,7 @@ do_mouse_resize(Client *c, BlitzAlign al
cur = cursor[CurInvisible];
}
- XQueryPointer(blz.dpy, c->framewin, &dummy, &dummy, &i, &i, &pt_x, &pt_y, &di);
+ XQueryPointer(blz.dpy, blz.root, &dummy, &dummy, &i, &i, &pt_x, &pt_y, &di);
XSync(blz.dpy, False);
if(XGrabPointer(blz.dpy, c->framewin, False, MouseMask, GrabModeAsync, GrabModeAsync,
@@ -362,10 +364,8 @@ do_mouse_resize(Client *c, BlitzAlign al
case ButtonRelease:
draw_xor_border(&frect);
- pt.x = pt_x;
- pt.y = pt_y;
if(!floating)
- resize_column(c, &frect, (align == CENTER) ? &pt : nil);
+ resize_column(c, &frect);
else
resize_client(c, &frect, False);
@@ -398,19 +398,18 @@ do_mouse_resize(Client *c, BlitzAlign al
dx -= pt_x;
dy -= pt_y;
}
-
pt_x += dx;
pt_y += dy;
rect_morph_xy(&origin, dx, dy, &align);
- if(align != CENTER)
- check_frame_constraints(&origin);
+ if(align != CENTER) check_frame_constraints(&origin);
frect = origin;
if(floating)
grav = snap_rect(rects, num, &frect, &align, snap);
else
grav = align ^ CENTER;
+
match_sizehints(c, &frect, floating, grav);
draw_xor_border(&ofrect);
diff -r 7e4e30a1d4c8 -r f99260f0230c wmii.h
--- a/wmii.h Mon Feb 05 00:41:13 2007 -0500
+++ b/wmii.h Mon Feb 05 01:07:04 2007 -0500
@@ -289,7 +289,7 @@ extern void apply_tags(Client *c, const
/* column.c */
extern void arrange_column(Area *a, Bool dirty);
extern void scale_column(Area *a, float h);
-extern void resize_column(Client *c, XRectangle *r, XPoint *pt);
+extern void resize_column(Client *c, XRectangle *r);
extern int column_mode_of_str(char *arg);
extern char *str_of_column_mode(int mode);
extern Area *new_column(View *v, Area *pos, unsigned int w);
Received on Mon Feb 05 2007 - 07:10:04 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:53 UTC