fix grow to edge stuff. also fix key-resizing terminals.

This commit is contained in:
Dana Jansens 2007-07-11 23:47:41 +00:00
parent 256c82a9f1
commit 6f79080a4b
2 changed files with 22 additions and 20 deletions

View file

@ -3957,7 +3957,7 @@ void client_find_edge_directional(ObClient *self, ObDirection dir,
case OB_DIRECTION_WEST: case OB_DIRECTION_WEST:
if (my_head <= head + 1) if (my_head <= head + 1)
skip_head = TRUE; skip_head = TRUE;
if (my_head + my_size - 1 <= tail + 1) if (my_head + my_size - 1 <= tail)
skip_tail = TRUE; skip_tail = TRUE;
if (head < *dest) if (head < *dest)
skip_head = TRUE; skip_head = TRUE;
@ -3968,7 +3968,7 @@ void client_find_edge_directional(ObClient *self, ObDirection dir,
case OB_DIRECTION_EAST: case OB_DIRECTION_EAST:
if (my_head >= head - 1) if (my_head >= head - 1)
skip_head = TRUE; skip_head = TRUE;
if (my_head - my_size + 1 >= tail - 1) if (my_head - my_size + 1 >= tail)
skip_tail = TRUE; skip_tail = TRUE;
if (head > *dest) if (head > *dest)
skip_head = TRUE; skip_head = TRUE;
@ -4065,36 +4065,36 @@ void client_find_resize_directional(ObClient *self, ObDirection side,
gboolean grow, gboolean grow,
gint *x, gint *y, gint *w, gint *h) gint *x, gint *y, gint *w, gint *h)
{ {
gint head, size; gint head;
gint e, e_start, e_size, delta; gint e, e_start, e_size, delta;
gboolean near; gboolean near;
ObDirection dir; ObDirection dir;
switch (side) { switch (side) {
case OB_DIRECTION_EAST: case OB_DIRECTION_EAST:
head = RECT_RIGHT(self->frame->area) + (self->size_inc.width - 1); head = RECT_RIGHT(self->frame->area) +
size = self->frame->area.width; (self->size_inc.width - 1) * (grow ? 1 : -1);
e_start = RECT_TOP(self->frame->area); e_start = RECT_TOP(self->frame->area);
e_size = self->frame->area.height; e_size = self->frame->area.height;
dir = grow ? OB_DIRECTION_EAST : OB_DIRECTION_WEST; dir = grow ? OB_DIRECTION_EAST : OB_DIRECTION_WEST;
break; break;
case OB_DIRECTION_WEST: case OB_DIRECTION_WEST:
head = RECT_LEFT(self->frame->area) - (self->size_inc.width - 1); head = RECT_LEFT(self->frame->area) -
size = self->frame->area.width; (self->size_inc.width - 1) * (grow ? 1 : -1);
e_start = RECT_TOP(self->frame->area); e_start = RECT_TOP(self->frame->area);
e_size = self->frame->area.height; e_size = self->frame->area.height;
dir = grow ? OB_DIRECTION_WEST : OB_DIRECTION_EAST; dir = grow ? OB_DIRECTION_WEST : OB_DIRECTION_EAST;
break; break;
case OB_DIRECTION_NORTH: case OB_DIRECTION_NORTH:
head = RECT_TOP(self->frame->area) - (self->size_inc.height - 1); head = RECT_TOP(self->frame->area) -
size = self->frame->area.height; (self->size_inc.height - 1) * (grow ? 1 : -1);
e_start = RECT_LEFT(self->frame->area); e_start = RECT_LEFT(self->frame->area);
e_size = self->frame->area.width; e_size = self->frame->area.width;
dir = grow ? OB_DIRECTION_NORTH : OB_DIRECTION_SOUTH; dir = grow ? OB_DIRECTION_NORTH : OB_DIRECTION_SOUTH;
break; break;
case OB_DIRECTION_SOUTH: case OB_DIRECTION_SOUTH:
head = RECT_BOTTOM(self->frame->area) + (self->size_inc.height - 1); head = RECT_BOTTOM(self->frame->area) +
size = self->frame->area.height; (self->size_inc.height - 1) * (grow ? 1 : -1);
e_start = RECT_LEFT(self->frame->area); e_start = RECT_LEFT(self->frame->area);
e_size = self->frame->area.width; e_size = self->frame->area.width;
dir = grow ? OB_DIRECTION_SOUTH : OB_DIRECTION_NORTH; dir = grow ? OB_DIRECTION_SOUTH : OB_DIRECTION_NORTH;
@ -4103,32 +4103,34 @@ void client_find_resize_directional(ObClient *self, ObDirection side,
g_assert_not_reached(); g_assert_not_reached();
} }
client_find_edge_directional(self, dir, head, size, ob_debug("head %d dir %d\n", head, dir);
client_find_edge_directional(self, dir, head, 1,
e_start, e_size, &e, &near); e_start, e_size, &e, &near);
ob_debug("edge %d\n", e);
*x = self->frame->area.x; *x = self->frame->area.x;
*y = self->frame->area.y; *y = self->frame->area.y;
*w = self->frame->area.width; *w = self->frame->area.width;
*h = self->frame->area.height; *h = self->frame->area.height;
switch (side) { switch (side) {
case OB_DIRECTION_EAST: case OB_DIRECTION_EAST:
if (near) --e; if (grow == near) --e;
delta = e - RECT_RIGHT(self->frame->area); delta = e - RECT_RIGHT(self->frame->area);
*w += delta; *w += delta;
break; break;
case OB_DIRECTION_WEST: case OB_DIRECTION_WEST:
if (near) ++e; if (grow == near) ++e;
delta = RECT_LEFT(self->frame->area) - e; delta = RECT_LEFT(self->frame->area) - e;
*x -= delta; *x -= delta;
*w += delta; *w += delta;
break; break;
case OB_DIRECTION_NORTH: case OB_DIRECTION_NORTH:
if (near) ++e; if (grow == near) ++e;
delta = RECT_TOP(self->frame->area) - e; delta = RECT_TOP(self->frame->area) - e;
*y -= delta; *y -= delta;
*h += delta; *h += delta;
break; break;
case OB_DIRECTION_SOUTH: case OB_DIRECTION_SOUTH:
if (near) --e; if (grow == near) --e;
delta = e - RECT_BOTTOM(self->frame->area); delta = e - RECT_BOTTOM(self->frame->area);
*h += delta; *h += delta;
break; break;

View file

@ -167,14 +167,14 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr)
moveresize_client = c; moveresize_client = c;
start_cx = c->area.x; start_cx = c->area.x;
start_cy = c->area.y; start_cy = c->area.y;
start_cw = c->area.width;
start_ch = c->area.height;
/* these adjustments for the size_inc make resizing a terminal more /* these adjustments for the size_inc make resizing a terminal more
friendly. you essentially start the resize in the middle of the friendly. you essentially start the resize in the middle of the
increment instead of at 0, so you have to move half an increment increment instead of at 0, so you have to move half an increment
either way instead of a full increment one and 1 px the other. */ either way instead of a full increment one and 1 px the other. */
start_cw = c->area.width + c->size_inc.width / 2; start_x = x - c->size_inc.width / 2;
start_ch = c->area.height + c->size_inc.height / 2; start_y = y - c->size_inc.height / 2;
start_x = x;
start_y = y;
corner = cnr; corner = cnr;
button = b; button = b;
key_resize_edge = -1; key_resize_edge = -1;