mirror of https://github.com/0intro/wmii
some drop_move related changes, still not finished with issues
This commit is contained in:
parent
e02d9ae205
commit
64a8931b13
|
@ -54,3 +54,8 @@ ad new column mode:
|
|||
> clients are visible.
|
||||
--Doug Bell
|
||||
|
||||
|
||||
13:12 < Neptun> when present (like -T "Enter view name") it would create a
|
||||
label with that text on the left part of the menu. what do you think?
|
||||
|
||||
- /def/ncol defines num of columns which should be created by default if possible.
|
||||
|
|
112
cmd/wm/column.c
112
cmd/wm/column.c
|
@ -326,50 +326,15 @@ AfterVertical:
|
|||
relax_column(a);
|
||||
}
|
||||
|
||||
static void
|
||||
drop_move(Frame *f, XRectangle *new, XPoint *pt)
|
||||
static Frame *
|
||||
frame_of_point(XPoint *pt)
|
||||
{
|
||||
Area *tgt = nil, *src = f->area;
|
||||
View *v = src->view;
|
||||
unsigned int i;
|
||||
|
||||
if(!pt)
|
||||
return;
|
||||
|
||||
for(i = 1; (i < v->area.size) &&
|
||||
!blitz_ispointinrect(pt->x, pt->y, &v->area.data[i]->rect); i++);
|
||||
if((tgt = ((i < v->area.size) ? v->area.data[i] : nil))) {
|
||||
if(src->frame.size > 1 || src != tgt) {
|
||||
int x = new->x + (new->width / 2);
|
||||
if(x < 0)
|
||||
tgt = new_left_column(v);
|
||||
else if(x > rect.width)
|
||||
tgt = new_right_column(v);
|
||||
}
|
||||
if(tgt != src)
|
||||
send_to_area(tgt, src, f->client);
|
||||
else {
|
||||
for(i = 0; (i < src->frame.size) &&
|
||||
!blitz_ispointinrect(pt->x, pt->y, &src->frame.data[i]->rect); i++);
|
||||
if((i < src->frame.size) && (f != src->frame.data[i])) {
|
||||
unsigned int j = idx_of_frame(f);
|
||||
Frame *tmp = src->frame.data[j];
|
||||
src->frame.data[j] = src->frame.data[i];
|
||||
src->frame.data[i] = tmp;
|
||||
arrange_column(src, False);
|
||||
focus_client(f->client, True);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drop_swap(Client *c, XPoint *pt)
|
||||
{
|
||||
|
||||
unsigned int i, j;
|
||||
Frame *f1 = c->frame.data[c->sel], *f2 = nil;
|
||||
View *v = view.data[sel];
|
||||
Frame *f = nil;
|
||||
View *v = view.size ? view.data[sel] : nil;
|
||||
|
||||
if(!v)
|
||||
return nil;
|
||||
|
||||
for(i = 1; (i < v->area.size) &&
|
||||
!blitz_ispointinrect(pt->x, pt->y, &v->area.data[i]->rect); i++);
|
||||
|
@ -378,8 +343,69 @@ drop_swap(Client *c, XPoint *pt)
|
|||
for(j = 0; j < a->frame.size &&
|
||||
!blitz_ispointinrect(pt->x, pt->y, &a->frame.data[j]->rect); j++);
|
||||
if(j < a->frame.size)
|
||||
f2 = a->frame.data[j];
|
||||
f = a->frame.data[j];
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
static void
|
||||
drop_move(Frame *f, XRectangle *new, XPoint *pt)
|
||||
{
|
||||
Area *tgt = nil, *src = f->area;
|
||||
View *v = src->view;
|
||||
unsigned int i;
|
||||
int fidx;
|
||||
Frame *ft;
|
||||
|
||||
if(!pt)
|
||||
return;
|
||||
|
||||
for(i = 1; (i < v->area.size) &&
|
||||
!blitz_ispointinrect(pt->x, pt->y, &v->area.data[i]->rect); i++);
|
||||
if((tgt = ((i < v->area.size) ? v->area.data[i] : nil))) {
|
||||
if(src != tgt) {
|
||||
int x = new->x + (new->width / 2);
|
||||
Bool new;
|
||||
if(x < 0) {
|
||||
tgt = new_left_column(v);
|
||||
new = True;
|
||||
}
|
||||
else if(x > rect.width) {
|
||||
tgt = new_right_column(v);
|
||||
new = True;
|
||||
}
|
||||
if(new)
|
||||
send_to_area(tgt, src, f->client);
|
||||
else {
|
||||
if(!(ft = frame_of_point(pt)) || (f == ft))
|
||||
return;
|
||||
send_to_area(tgt, src, f->client);
|
||||
goto InsertAtPointer;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!(ft = frame_of_point(pt)) || (f == ft))
|
||||
return;
|
||||
InsertAtPointer:
|
||||
cext_vdetach(vector_of_frames(&tgt->frame), f);
|
||||
fidx = idx_of_frame(ft);
|
||||
|
||||
if(pt->y < (ft->rect.y + ft->rect.height / 2))
|
||||
insert_before_idx(&tgt->frame, f, fidx);
|
||||
else
|
||||
insert_after_idx(&tgt->frame, f, fidx);
|
||||
|
||||
tgt->sel = idx_of_frame(f);
|
||||
arrange_column(tgt, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drop_swap(Client *c, XPoint *pt)
|
||||
{
|
||||
|
||||
Frame *f1 = c->frame.data[c->sel], *f2 = frame_of_point(pt);
|
||||
|
||||
if(!f2 || f1 == f2 || !idx_of_area(f1->area))
|
||||
return;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "wm.h"
|
||||
|
||||
static Vector *
|
||||
Vector *
|
||||
vector_of_frames(FrameVector *fv)
|
||||
{
|
||||
return (Vector *) fv;
|
||||
|
@ -78,3 +78,37 @@ frame_of_win(Window w)
|
|||
return client.data[i];
|
||||
return nil;
|
||||
}
|
||||
|
||||
static void
|
||||
xinsert(FrameVector *fv, Frame *f, unsigned int idx, Bool before)
|
||||
{
|
||||
FrameVector tmp = {0};
|
||||
unsigned int i;
|
||||
|
||||
for(i = 0; i < fv->size; i++) {
|
||||
if(before && (i == idx))
|
||||
cext_vattach(vector_of_frames(&tmp), f);
|
||||
cext_vattach(vector_of_frames(&tmp), fv->data[i]);
|
||||
if(!before && (i == idx))
|
||||
cext_vattach(vector_of_frames(&tmp), f);
|
||||
}
|
||||
|
||||
while(fv->size)
|
||||
cext_vdetach(vector_of_frames(fv), fv->data[0]);
|
||||
for(i = 0; i < tmp.size; i++)
|
||||
cext_vattach(vector_of_frames(fv), tmp.data[i]);
|
||||
while(tmp.size)
|
||||
cext_vdetach(vector_of_frames(&tmp), tmp.data[0]);
|
||||
}
|
||||
|
||||
void
|
||||
insert_before_idx(FrameVector *fv, Frame *f, unsigned int idx)
|
||||
{
|
||||
xinsert(fv, f, idx, True);
|
||||
}
|
||||
|
||||
void
|
||||
insert_after_idx(FrameVector *fv, Frame *f, unsigned int idx)
|
||||
{
|
||||
xinsert(fv, f, idx, False);
|
||||
}
|
||||
|
|
|
@ -251,11 +251,14 @@ void check_x_event(IXPConn *c);
|
|||
unsigned int flush_masked_events(long even_mask);
|
||||
|
||||
/* frame.c */
|
||||
Vector *vector_of_frames(FrameVector *fv);
|
||||
Frame *create_frame(Area *a, Client *c);
|
||||
void destroy_frame(Frame *f);
|
||||
int idx_of_frame_id(Area *a, unsigned short id);
|
||||
int idx_of_frame(Frame *f);
|
||||
Client *frame_of_win(Window w);
|
||||
void insert_before_idx(FrameVector *fv, Frame *f, unsigned int idx);
|
||||
void insert_after_idx(FrameVector *fv, Frame *f, unsigned int idx);
|
||||
|
||||
/* fs.c */
|
||||
unsigned long long pack_qpath(unsigned char type, unsigned short i1,
|
||||
|
|
Loading…
Reference in New Issue