several fixes

This commit is contained in:
Anselm R. Garbe 2006-04-26 18:46:54 +02:00
parent 7863f248d1
commit 076f943a6e
3 changed files with 20 additions and 32 deletions

View File

@ -232,10 +232,12 @@ void
draw_client(Client *c)
{
BlitzDraw d = { 0 };
Frame *f;
if(!c->frame.size)
return; /* might not have been attached atm */
f = c->frame.data[c->sel];
d.drawable = c->framewin;
d.font = blitzfont;
d.gc = c->gc;
@ -247,7 +249,7 @@ draw_client(Client *c)
/* draw border */
if(def.border) {
d.rect = c->frame.data[c->sel]->rect;
d.rect = f->rect;
d.rect.x = d.rect.y = 0;
d.notch = &c->rect;
blitz_drawlabel(dpy, &d);
@ -259,14 +261,12 @@ draw_client(Client *c)
d.notch = nil;
/* max mode bar */
if(c->frame.data[c->sel]->area->mode == Colmax) {
if(f->area->mode == Colmax) {
unsigned long tmp = d.color.fg;
char buf[256];
d.color.fg = d.color.bg;
d.color.bg = tmp;
snprintf(buf, sizeof(buf), "%d/%d",
idx_of_frame(c->frame.data[c->sel]) + 1,
c->frame.data[c->sel]->area->frame.size);
snprintf(buf, sizeof(buf), "%d/%d", idx_of_frame(f) + 1, f->area->frame.size);
d.align = CENTER;
d.rect.width = d.rect.height + blitz_textwidth(dpy, &blitzfont, buf);
d.data = buf;
@ -286,7 +286,7 @@ draw_client(Client *c)
/* title bar */
d.align = WEST;
d.rect.width = c->frame.data[c->sel]->rect.width - d.rect.x;
d.rect.width = f->rect.width - d.rect.x;
d.data = c->name;
blitz_drawlabel(dpy, &d);
blitz_drawborder(dpy, &d);

View File

@ -209,9 +209,9 @@ do_mouse_move(Client *c)
int snaph = (rect.height * def.snap) / 1000;
unsigned int num;
unsigned int dmask;
XRectangle *rects = rects_of_view(c->frame.data[c->sel]->area->view,
idx_of_area(c->frame.data[c->sel]->area) == 0, &num);
XRectangle frect = c->frame.data[c->sel]->rect;
Frame *f = c->frame.data[c->sel];
XRectangle *rects = rects_of_view(f->area->view, idx_of_area(f->area) == 0, &num);
XRectangle frect = f->rect;
XPoint pt;
XQueryPointer(dpy, c->framewin, &dummy, &dummy, &i, &i, &wex, &wey, &dmask);
@ -235,7 +235,7 @@ do_mouse_move(Client *c)
case ButtonRelease:
if(!first) {
draw_pseudo_border(&frect);
if(idx_of_area(c->frame.data[c->sel]->area))
if(idx_of_area(f->area))
resize_column(c, &frect, &pt);
else
resize_client(c, &frect, False);
@ -451,9 +451,9 @@ do_mouse_resize(Client *c, BlitzAlign align)
int snaph = (rect.height * def.snap) / 1000;
unsigned int dmask;
unsigned int num;
XRectangle *rects = rects_of_view(c->frame.data[c->sel]->area->view,
idx_of_area(c->frame.data[c->sel]->area) == 0, &num);
XRectangle frect = c->frame.data[c->sel]->rect;
Frame *f = c->frame.data[c->sel];
XRectangle *rects = rects_of_view(f->area->view, idx_of_area(f->area) == 0, &num);
XRectangle frect = f->rect;
XRectangle origin = frect;
XQueryPointer(dpy, c->framewin, &dummy, &dummy, &i, &i, &ox, &oy, &dmask);
@ -477,7 +477,7 @@ do_mouse_resize(Client *c, BlitzAlign align)
draw_pseudo_border(&frect);
pt.x = px;
pt.y = py;
if(idx_of_area(c->frame.data[c->sel]->area))
if(idx_of_area(f->area))
resize_column(c, &frect, &pt);
else
resize_client(c, &frect, False);

View File

@ -40,7 +40,6 @@ create_view(char *name)
void
destroy_view(View *v)
{
fprintf(stderr, "destroy_view: %s\n", v->name);
while(v->area.size)
destroy_area(v->area.data[0]);
@ -66,16 +65,12 @@ update_frame_selectors(View *v)
{
unsigned int i, j;
fprintf(stderr, "%s\n", "---------------- update_frame_selectors ----------------");
/* select correct frames of clients */
for(i = 0; i < client.size; i++) {
Client *c = client.data[i];
for(j = 0; j < c->frame.size; j++)
if(c->frame.data[j]->area->view == v) {
Frame *f = c->frame.data[j];
c->sel = j;
fprintf(stderr, "%d is frame for view '%s' with %d %d %d %d\n",
j, v->name, f->rect.x, f->rect.y, f->rect.width, f->rect.height);
break;
}
}
@ -92,17 +87,12 @@ focus_view(View *v)
update_frame_selectors(v);
fprintf(stderr, "%s\n", "--------------- focus_view -------------------");
/* gives all(!) clients proper geometry (for use of different tags) */
if((c = sel_client_of_view(v)))
focus_client(c, True);
for(i = 0; i < client.size; i++)
if(client.data[i]->frame.size) {
Frame *f = client.data[i]->frame.data[client.data[i]->sel];
fprintf(stderr, "focus_view '%s': frame '%s (%s) %d/#%d' %d %d %d %d\n",
f->area->view->name, f->client->name, f->client->tags,
f->client->sel, f->client->frame.size,
f->rect.x, f->rect.y, f->rect.width, f->rect.height);
if(f->area->view == v) {
XMoveWindow(dpy, client.data[i]->framewin, f->rect.x, f->rect.y);
if(client.data[i]->frame.size > 1)
@ -229,9 +219,6 @@ attach_to_view(View *v, Client *c)
c->revert = nil;
if(is_of_view(v, c))
return;
if(c->trans || c->floating
|| (c->rect.width == rect.width && c->rect.height == rect.height))
a = v->area.data[0];
@ -382,12 +369,11 @@ update_views()
for(i = 0; i < client.size; i++)
update_client_views(client.data[i]);
/* *-tag size isse occures in the next loop */
for(i = 0; i < client.size; i++) {
Client *c = client.data[i];
for(j = 0; j < view.size; j++) {
if(strchr(c->tags, '*'))
attach_to_view(view.data[j], c);
else if(is_view_of(c, view.data[j])) {
if(is_view_of(c, view.data[j]) || strchr(c->tags, '*')) {
if(!is_of_view(view.data[j], c))
attach_to_view(view.data[j], c);
}
@ -401,13 +387,15 @@ update_views()
for(i = 0; i < view.size; i++) {
Bool only_wildcards = True;
for(j = 0; j < client.size; j++) {
Client *c = client.data[i];
if(is_view_of(client.data[j], view.data[i]))
only_wildcards = False;
if(!strchr(c->tags, '*'))
only_wildcards = False;
}
if(only_wildcards && view.size > 1) {
for(j = 0; j < client.size; j++) {
if(is_of_view(view.data[i], client.data[j]))
detach_from_view(view.data[i], client.data[j]);
detach_from_view(view.data[i], client.data[j]);
}
}
}