2006-04-12 12:44:07 +04:00
|
|
|
/*
|
|
|
|
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
|
|
* See LICENSE file for license details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "wm.h"
|
|
|
|
|
|
|
|
char *
|
|
|
|
str_of_column_mode(int mode)
|
|
|
|
{
|
|
|
|
switch(mode) {
|
|
|
|
case Coldefault: return "default"; break;
|
|
|
|
case Colstack: return "stack"; break;
|
|
|
|
case Colmax: return "max"; break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
column_mode_of_str(char *arg)
|
|
|
|
{
|
|
|
|
if(!strncmp("default", arg, 8))
|
|
|
|
return Coldefault;
|
|
|
|
if(!strncmp("stack", arg, 6))
|
|
|
|
return Colstack;
|
|
|
|
if(!strncmp("max", arg, 4))
|
|
|
|
return Colmax;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
relax_column(Area *a)
|
|
|
|
{
|
2006-06-08 12:54:19 +04:00
|
|
|
unsigned int frame_size, yoff, h;
|
|
|
|
Frame *f;
|
2006-04-26 15:36:54 +04:00
|
|
|
int hdiff;
|
2006-04-12 12:44:07 +04:00
|
|
|
Bool fallthrough = False;
|
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
if(!a->frame)
|
2006-04-12 12:44:07 +04:00
|
|
|
return;
|
|
|
|
|
2006-06-30 06:28:38 +04:00
|
|
|
frame_size = 0;
|
|
|
|
for(f=a->frame; f; f=f->anext)
|
|
|
|
frame_size++;
|
2006-06-08 12:54:19 +04:00
|
|
|
|
2006-04-12 12:44:07 +04:00
|
|
|
switch(a->mode) {
|
|
|
|
case Coldefault:
|
2006-06-08 12:54:19 +04:00
|
|
|
h = a->rect.height / frame_size;
|
2006-07-11 10:42:15 +04:00
|
|
|
if(h < 2 * blitz_labelh(&def.font))
|
2006-04-12 12:44:07 +04:00
|
|
|
fallthrough = True;
|
|
|
|
break;
|
|
|
|
case Colstack:
|
2006-07-11 10:42:15 +04:00
|
|
|
h = a->rect.height - (frame_size - 1) * blitz_labelh(&def.font);
|
|
|
|
if(h < 3 * blitz_labelh(&def.font))
|
2006-04-12 12:44:07 +04:00
|
|
|
fallthrough = True;
|
|
|
|
default:
|
2006-04-26 17:19:56 +04:00
|
|
|
yoff = a->rect.y;
|
2006-04-12 12:44:07 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(fallthrough) {
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-12 12:44:07 +04:00
|
|
|
f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2;
|
|
|
|
f->rect.y = a->rect.y + (a->rect.height - f->rect.height) / 2;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* some relaxing from potential increment gaps */
|
|
|
|
h = 0;
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-12 12:44:07 +04:00
|
|
|
if(a->mode == Colmax) {
|
|
|
|
if(h < f->rect.height)
|
|
|
|
h = f->rect.height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
h += f->rect.height;
|
|
|
|
}
|
|
|
|
|
2006-04-26 15:36:54 +04:00
|
|
|
hdiff = a->rect.height - h;
|
2006-04-26 17:19:56 +04:00
|
|
|
if((a->mode == Coldefault) && (hdiff > 0)) {
|
2006-04-26 15:36:54 +04:00
|
|
|
int hx;
|
|
|
|
for(hx = 1; hx < hdiff; hx++)
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f && (hx < hdiff); f=f->anext) {
|
2006-04-26 15:36:54 +04:00
|
|
|
unsigned int tmp = f->rect.height;
|
|
|
|
f->rect.height += hx;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-26 15:36:54 +04:00
|
|
|
hdiff -= (f->rect.height - tmp);
|
|
|
|
}
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
|
2006-04-26 17:19:56 +04:00
|
|
|
if(hdiff < 0)
|
|
|
|
hdiff = 0;
|
2006-06-08 12:54:19 +04:00
|
|
|
hdiff /= frame_size;
|
2006-04-12 12:44:07 +04:00
|
|
|
yoff = a->rect.y + hdiff / 2;
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-12 12:44:07 +04:00
|
|
|
f->rect.y = yoff;
|
2006-06-27 01:59:32 +04:00
|
|
|
if(a->mode != Colmax || f == a->sel) {
|
|
|
|
f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2;
|
2006-04-12 12:44:07 +04:00
|
|
|
yoff = f->rect.y + f->rect.height + hdiff;
|
2006-06-27 01:59:32 +04:00
|
|
|
}
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-04-24 18:03:37 +04:00
|
|
|
scale_column(Area *a, float h)
|
2006-04-12 12:44:07 +04:00
|
|
|
{
|
2006-06-08 12:54:19 +04:00
|
|
|
unsigned int yoff, frame_size = 0;
|
|
|
|
Frame *f;
|
2006-07-11 10:42:15 +04:00
|
|
|
unsigned int min_height = 2 * blitz_labelh(&def.font);
|
2006-04-24 18:03:37 +04:00
|
|
|
float scale, dy = 0;
|
2006-05-04 01:11:14 +04:00
|
|
|
int hdiff;
|
2006-04-24 18:03:37 +04:00
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
if(!a->frame)
|
2006-04-24 18:03:37 +04:00
|
|
|
return;
|
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext, frame_size++)
|
|
|
|
dy += f->rect.height;
|
|
|
|
|
2006-04-24 18:03:37 +04:00
|
|
|
scale = h / dy;
|
2006-05-04 00:25:33 +04:00
|
|
|
yoff = 0;
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-24 18:03:37 +04:00
|
|
|
f->rect.height *= scale;
|
2006-06-08 12:54:19 +04:00
|
|
|
if(!f->anext)
|
2006-05-04 01:26:21 +04:00
|
|
|
f->rect.height = h - yoff;
|
|
|
|
yoff += f->rect.height;
|
2006-04-24 18:03:37 +04:00
|
|
|
}
|
2006-05-04 01:11:14 +04:00
|
|
|
|
|
|
|
/* min_height can only be respected when there is enough space; the caller should guarantee this */
|
2006-06-08 12:54:19 +04:00
|
|
|
if(frame_size * min_height > h)
|
2006-05-04 01:11:14 +04:00
|
|
|
return;
|
2006-05-04 01:26:21 +04:00
|
|
|
yoff = 0;
|
2006-07-14 01:58:26 +04:00
|
|
|
for(f=a->frame, frame_size--; f; f=f->anext, frame_size--) {
|
2006-05-04 01:11:14 +04:00
|
|
|
if(f->rect.height < min_height)
|
|
|
|
f->rect.height = min_height;
|
2006-06-08 12:54:19 +04:00
|
|
|
else if((hdiff = yoff + f->rect.height - h + frame_size * min_height) > 0)
|
2006-05-04 01:11:14 +04:00
|
|
|
f->rect.height -= hdiff;
|
2006-06-08 12:54:19 +04:00
|
|
|
if(!f->anext)
|
2006-05-04 01:11:14 +04:00
|
|
|
f->rect.height = h - yoff;
|
|
|
|
yoff += f->rect.height;
|
|
|
|
}
|
2006-04-24 18:03:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
arrange_column(Area *a, Bool dirty)
|
|
|
|
{
|
2006-06-08 12:54:19 +04:00
|
|
|
Frame *f;
|
2006-06-30 06:58:06 +04:00
|
|
|
unsigned int num_frames = 0, yoff = a->rect.y, h;
|
2006-07-11 10:42:15 +04:00
|
|
|
unsigned int min_height = 2 * blitz_labelh(&def.font);
|
2006-04-12 12:44:07 +04:00
|
|
|
|
2006-06-30 06:28:38 +04:00
|
|
|
if(a->floating || !a->frame)
|
2006-04-12 12:44:07 +04:00
|
|
|
return;
|
|
|
|
|
2006-06-30 06:28:38 +04:00
|
|
|
for(f=a->frame; f; f=f->anext)
|
|
|
|
num_frames++;
|
2006-06-08 12:54:19 +04:00
|
|
|
|
2006-04-12 12:44:07 +04:00
|
|
|
switch(a->mode) {
|
|
|
|
case Coldefault:
|
2006-06-08 12:54:19 +04:00
|
|
|
h = a->rect.height / num_frames;
|
2006-04-24 18:54:56 +04:00
|
|
|
if(h < min_height)
|
2006-04-12 12:44:07 +04:00
|
|
|
goto Fallthrough;
|
|
|
|
if(dirty) {
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext)
|
|
|
|
f->rect.height = h;
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
2006-04-24 18:03:37 +04:00
|
|
|
scale_column(a, a->rect.height);
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-24 18:54:56 +04:00
|
|
|
f->rect.x = a->rect.x;
|
|
|
|
f->rect.y = yoff;
|
|
|
|
f->rect.width = a->rect.width;
|
|
|
|
yoff += f->rect.height;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-24 18:54:56 +04:00
|
|
|
}
|
2006-04-12 12:44:07 +04:00
|
|
|
break;
|
|
|
|
case Colstack:
|
2006-07-11 10:42:15 +04:00
|
|
|
h = a->rect.height - (num_frames - 1) * blitz_labelh(&def.font);
|
|
|
|
if(h < 3 * blitz_labelh(&def.font))
|
2006-04-12 12:44:07 +04:00
|
|
|
goto Fallthrough;
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-12 12:44:07 +04:00
|
|
|
f->rect = a->rect;
|
|
|
|
f->rect.y = yoff;
|
2006-06-08 12:54:19 +04:00
|
|
|
if(f == a->sel)
|
2006-04-12 12:44:07 +04:00
|
|
|
f->rect.height = h;
|
|
|
|
else
|
2006-07-11 10:42:15 +04:00
|
|
|
f->rect.height = blitz_labelh(&def.font);
|
2006-04-12 12:44:07 +04:00
|
|
|
yoff += f->rect.height;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
Fallthrough:
|
|
|
|
case Colmax:
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-12 12:44:07 +04:00
|
|
|
f->rect = a->rect;
|
2006-06-30 04:02:52 +04:00
|
|
|
if(f != a->sel) f->rect.x = screen->rect.width * 2;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
relax_column(a);
|
2006-05-03 14:51:24 +04:00
|
|
|
flush_masked_events(EnterWindowMask);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
match_horiz(Area *a, XRectangle *r)
|
|
|
|
{
|
2006-06-08 12:54:19 +04:00
|
|
|
Frame *f;
|
2006-04-12 12:44:07 +04:00
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
for(f=a->frame; f; f=f->anext) {
|
2006-04-12 12:44:07 +04:00
|
|
|
f->rect.x = r->x;
|
|
|
|
f->rect.width = r->width;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
drop_resize(Frame *f, XRectangle *new)
|
|
|
|
{
|
|
|
|
Area *west = nil, *east = nil, *a = f->area;
|
|
|
|
View *v = a->view;
|
|
|
|
Frame *north = nil, *south = nil;
|
2006-07-11 10:42:15 +04:00
|
|
|
unsigned int min_height = 2 * blitz_labelh(&def.font);
|
2006-07-14 01:58:26 +04:00
|
|
|
unsigned int min_width = screen->rect.width/NCOL;
|
2006-04-12 12:44:07 +04:00
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
for(west=v->area->next; west && west->next != a; west=west->next);
|
2006-04-12 12:44:07 +04:00
|
|
|
/* first managed area is indexed 1, thus (i > 1) ? ... */
|
2006-06-10 03:57:00 +04:00
|
|
|
east = a->next;
|
2006-04-12 12:44:07 +04:00
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
for(north=a->frame; north && north->anext != f; north=north->anext);
|
2006-06-10 03:57:00 +04:00
|
|
|
south = f->anext;
|
2006-04-12 12:44:07 +04:00
|
|
|
|
|
|
|
/* validate (and trim if necessary) horizontal resize */
|
2006-07-14 01:58:26 +04:00
|
|
|
if(new->width < min_width) {
|
2006-04-12 12:44:07 +04:00
|
|
|
if(new->x + new->width == f->rect.x + f->rect.width)
|
2006-07-14 01:58:26 +04:00
|
|
|
new->x = a->rect.x + a->rect.width - min_width;
|
|
|
|
new->width = min_width;
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
if(west && (new->x != f->rect.x)) {
|
2006-07-14 01:58:26 +04:00
|
|
|
if(new->x < 0 || new->x < (west->rect.x + min_width)) {
|
|
|
|
new->width -= (west->rect.x + min_width) - new->x;
|
|
|
|
new->x = west->rect.x + min_width;
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
new->width += new->x - a->rect.x;
|
|
|
|
new->x = a->rect.x;
|
|
|
|
}
|
|
|
|
if(east && (new->x + new->width != f->rect.x + f->rect.width)) {
|
2006-07-14 01:58:26 +04:00
|
|
|
if((new->x + new->width) > (east->rect.x + east->rect.width - min_width))
|
|
|
|
new->width = (east->rect.x + east->rect.width - min_width) - new->x;
|
2006-04-12 12:44:07 +04:00
|
|
|
} else
|
|
|
|
new->width = (a->rect.x + a->rect.width) - new->x;
|
2006-07-14 01:58:26 +04:00
|
|
|
if(new->width < min_width)
|
2006-04-12 12:44:07 +04:00
|
|
|
goto AfterHorizontal;
|
|
|
|
|
|
|
|
/* horizontal resize */
|
|
|
|
if(west && (new->x != a->rect.x)) {
|
|
|
|
west->rect.width = new->x - west->rect.x;
|
|
|
|
a->rect.width += a->rect.x - new->x;
|
|
|
|
a->rect.x = new->x;
|
|
|
|
match_horiz(a, &a->rect);
|
|
|
|
match_horiz(west, &west->rect);
|
|
|
|
relax_column(west);
|
|
|
|
}
|
|
|
|
if(east && (new->x + new->width != a->rect.x + a->rect.width)) {
|
|
|
|
east->rect.width -= new->x + new->width - east->rect.x;
|
|
|
|
east->rect.x = new->x + new->width;
|
|
|
|
a->rect.width = (new->x + new->width) - a->rect.x;
|
|
|
|
match_horiz(a, &a->rect);
|
|
|
|
match_horiz(east, &east->rect);
|
|
|
|
relax_column(east);
|
|
|
|
}
|
|
|
|
AfterHorizontal:
|
|
|
|
|
|
|
|
/* skip vertical resize unless the column is in equal mode */
|
|
|
|
if(a->mode != Coldefault)
|
|
|
|
goto AfterVertical;
|
|
|
|
|
|
|
|
/* validate (and trim if necessary) vertical resize */
|
|
|
|
if(new->height < min_height) {
|
|
|
|
if(f->rect.height < min_height
|
|
|
|
&& (new->y == f->rect.y || new->y + new->height == f->rect.y + f->rect.height))
|
|
|
|
goto AfterVertical;
|
|
|
|
if(new->y + new->height == f->rect.y + f->rect.height)
|
|
|
|
new->y = f->rect.y + f->rect.height - min_height;
|
|
|
|
new->height = min_height;
|
|
|
|
}
|
|
|
|
if(north && (new->y != f->rect.y))
|
|
|
|
if(new->y < 0 || new->y < (north->rect.y + min_height)) {
|
|
|
|
new->height -= (north->rect.y + min_height) - new->y;
|
|
|
|
new->y = north->rect.y + min_height;
|
|
|
|
}
|
|
|
|
if(south && (new->y + new->height != f->rect.y + f->rect.height)) {
|
|
|
|
if((new->y + new->height) > (south->rect.y + south->rect.height - min_height))
|
|
|
|
new->height = (south->rect.y + south->rect.height - min_height) - new->y;
|
|
|
|
}
|
|
|
|
if(new->height < min_height)
|
|
|
|
goto AfterVertical;
|
|
|
|
|
|
|
|
/* vertical resize */
|
|
|
|
if(north && (new->y != f->rect.y)) {
|
|
|
|
north->rect.height = new->y - north->rect.y;
|
|
|
|
f->rect.height += f->rect.y - new->y;
|
|
|
|
f->rect.y = new->y;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(north->client, &north->rect, True);
|
|
|
|
//resize_client(f->client, &f->rect, True);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
if(south && (new->y + new->height != f->rect.y + f->rect.height)) {
|
|
|
|
south->rect.height -= new->y + new->height - south->rect.y;
|
|
|
|
south->rect.y = new->y + new->height;
|
|
|
|
f->rect.y = new->y;
|
|
|
|
f->rect.height = new->height;
|
2006-06-30 10:02:44 +04:00
|
|
|
//resize_client(f->client, &f->rect, False);
|
|
|
|
//resize_client(south->client, &south->rect, True);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
AfterVertical:
|
|
|
|
|
|
|
|
relax_column(a);
|
2006-06-30 04:02:52 +04:00
|
|
|
focus_view(screen, v);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
|
2006-05-08 22:06:36 +04:00
|
|
|
static Frame *
|
|
|
|
frame_of_point(XPoint *pt)
|
|
|
|
{
|
2006-06-08 12:54:19 +04:00
|
|
|
Area *a;
|
2006-06-30 04:02:52 +04:00
|
|
|
View *v = screen->sel;
|
|
|
|
Frame *f = nil;
|
2006-05-08 22:06:36 +04:00
|
|
|
|
|
|
|
if(!v)
|
|
|
|
return nil;
|
|
|
|
|
2006-09-28 15:02:06 +04:00
|
|
|
for(a=v->area->next; a && !blitz_ispointinrect(pt->x, pt->y, &a->rect);
|
2006-06-08 12:54:19 +04:00
|
|
|
a=a->next);
|
|
|
|
if(a)
|
2006-09-28 15:02:06 +04:00
|
|
|
for(f=a->frame; f && !blitz_ispointinrect(pt->x, pt->y, &f->rect);
|
2006-06-08 12:54:19 +04:00
|
|
|
f=f->anext);
|
2006-05-08 22:06:36 +04:00
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
2006-04-12 12:44:07 +04:00
|
|
|
static void
|
2006-05-08 01:58:06 +04:00
|
|
|
drop_move(Frame *f, XRectangle *new, XPoint *pt)
|
2006-04-12 12:44:07 +04:00
|
|
|
{
|
2006-06-30 04:02:52 +04:00
|
|
|
Area *tgt, *src;
|
2006-06-30 16:18:26 +04:00
|
|
|
Frame *ft;
|
2006-06-30 04:02:52 +04:00
|
|
|
View *v;
|
|
|
|
|
|
|
|
tgt = nil;
|
|
|
|
src = f->area;
|
|
|
|
v = src->view;
|
2006-04-12 12:44:07 +04:00
|
|
|
|
2006-05-10 02:16:43 +04:00
|
|
|
if(!pt)
|
2006-04-21 03:18:13 +04:00
|
|
|
return;
|
|
|
|
|
2006-09-28 15:02:06 +04:00
|
|
|
for(tgt=v->area->next; tgt && !blitz_ispointinrect(pt->x, pt->y, &tgt->rect);
|
2006-06-08 12:54:19 +04:00
|
|
|
tgt=tgt->next);
|
|
|
|
if(tgt) {
|
2006-06-10 00:06:34 +04:00
|
|
|
if(pt->x < 16) {
|
2006-06-08 12:54:19 +04:00
|
|
|
if((src->frame && src->frame->anext) || (src != v->area->next)) {
|
|
|
|
tgt = new_column(v, v->area->next, 0);
|
2006-06-25 17:16:03 +04:00
|
|
|
send_to_area(tgt, src, f);
|
2006-05-10 02:07:50 +04:00
|
|
|
}
|
2006-05-09 02:16:12 +04:00
|
|
|
}
|
2006-06-30 04:02:52 +04:00
|
|
|
else if(pt->x >= screen->rect.width - 16) {
|
2006-06-08 12:54:19 +04:00
|
|
|
if((src->frame && src->frame->anext) || src->next) {
|
|
|
|
for(tgt=src; tgt->next; tgt=tgt->next);
|
|
|
|
tgt = new_column(v, tgt, 0);
|
2006-06-25 17:16:03 +04:00
|
|
|
send_to_area(tgt, src, f);
|
2006-05-10 02:07:50 +04:00
|
|
|
}
|
2006-05-09 02:16:12 +04:00
|
|
|
}
|
2006-06-08 12:54:19 +04:00
|
|
|
else if(src != tgt) {
|
2006-05-09 02:16:12 +04:00
|
|
|
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);
|
2006-06-25 17:16:03 +04:00
|
|
|
send_to_area(tgt, src, f);
|
2006-05-09 02:16:12 +04:00
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
f = c->sel;
|
|
|
|
remove_frame(f);
|
2006-05-09 02:16:12 +04:00
|
|
|
|
|
|
|
if(before)
|
2006-06-30 16:18:26 +04:00
|
|
|
insert_frame(ft, f, True);
|
2006-05-09 02:16:12 +04:00
|
|
|
else
|
2006-06-08 12:54:19 +04:00
|
|
|
insert_frame(ft, f, False);
|
2006-05-09 02:16:12 +04:00
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
tgt->sel = f;
|
2006-05-09 02:16:12 +04:00
|
|
|
arrange_column(tgt, False);
|
2006-04-20 23:47:50 +04:00
|
|
|
}
|
2006-06-08 12:54:19 +04:00
|
|
|
else { /* !tgt */
|
2006-05-08 22:06:36 +04:00
|
|
|
if(!(ft = frame_of_point(pt)) || (f == ft))
|
|
|
|
return;
|
2006-06-08 12:54:19 +04:00
|
|
|
remove_frame(f);
|
2006-05-08 22:06:36 +04:00
|
|
|
|
|
|
|
if(pt->y < (ft->rect.y + ft->rect.height / 2))
|
2006-06-30 16:18:26 +04:00
|
|
|
insert_frame(ft, f, True);
|
2006-05-08 22:06:36 +04:00
|
|
|
else
|
2006-06-08 12:54:19 +04:00
|
|
|
insert_frame(ft, f, False);
|
2006-05-08 22:06:36 +04:00
|
|
|
|
2006-06-08 12:54:19 +04:00
|
|
|
tgt->sel = f;
|
2006-05-08 22:06:36 +04:00
|
|
|
arrange_column(tgt, False);
|
2006-04-12 12:44:07 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
resize_column(Client *c, XRectangle *r, XPoint *pt)
|
|
|
|
{
|
2006-06-08 12:54:19 +04:00
|
|
|
Frame *f = c->sel;
|
2006-04-12 12:44:07 +04:00
|
|
|
if((f->rect.width == r->width) && (f->rect.height == r->height))
|
2006-05-08 01:58:06 +04:00
|
|
|
drop_move(f, r, pt);
|
2006-04-12 12:44:07 +04:00
|
|
|
else
|
|
|
|
drop_resize(f, r);
|
|
|
|
}
|
2006-04-19 18:53:40 +04:00
|
|
|
|
|
|
|
Area *
|
2006-06-08 12:54:19 +04:00
|
|
|
new_column(View *v, Area *pos, unsigned int w) {
|
|
|
|
Area *a = create_area(v, pos, w);
|
|
|
|
if(!a)
|
2006-04-19 18:53:40 +04:00
|
|
|
return nil;
|
2006-04-24 19:19:50 +04:00
|
|
|
arrange_view(v);
|
2006-04-19 18:53:40 +04:00
|
|
|
return a;
|
|
|
|
}
|