Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
Pre-merge mess.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris Maglione committed Jan 18, 2008
1 parent 0d05e4f commit f6c2a49
Show file tree
Hide file tree
Showing 44 changed files with 710 additions and 728 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ deb:
dpkg-buildpackage -rfakeroot

include ${ROOT}/mk/dir.mk
include ${ROOT}/mk/common.mk
INSTDIRS = ${PDIRS}

1 change: 0 additions & 1 deletion cmd/wmii/area.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "fns.h"

Expand Down
21 changes: 9 additions & 12 deletions cmd/wmii/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* See LICENSE file for license details.
*/
#include "dat.h"
#include <stdio.h>
#include <string.h>
#include "fns.h"

Expand Down Expand Up @@ -56,8 +55,8 @@ create_bar(Bar **bp, char *name) {
utflcpy(b->name, name, sizeof(b->name));
b->col = def.normcolor;

for(; *bp; bp = &(*bp)->next)
if(strcmp((*bp)->name, name) >= 0)
for(; *bp; bp = &bp[0]->next)
if(strcmp(bp[0]->name, name) >= 0)
break;
b->next = *bp;
*bp = b;
Expand All @@ -69,7 +68,7 @@ void
destroy_bar(Bar **bp, Bar *b) {
Bar **p;

for(p = bp; *p; p = &(*p)->next)
for(p = bp; *p; p = &p[0]->next)
if(*p == b) break;
*p = b->next;

Expand Down Expand Up @@ -113,12 +112,11 @@ draw_bar(WMScreen *s) {
width += Dx(b->r);
}


if(width > Dx(s->brect)) { /* Not enough room. Shrink bars until they all fit. */
for(nb = 0; nb < nelem(s->bar); nb++)
for(b = s->bar[nb]; b; b=b->next) {
for(pb = &largest; *pb; pb = &(*pb)->smaller)
if(Dx((*pb)->r) < Dx(b->r))
for(pb = &largest; *pb; pb = &pb[0]->smaller)
if(Dx(pb[0]->r) < Dx(b->r))
break;
b->smaller = *pb;
*pb = b;
Expand All @@ -131,13 +129,14 @@ draw_bar(WMScreen *s) {
if(Dx(tb->r) * shrink >= Dx(tb->smaller->r))
break;
}
SET(shrink);
if(tb)
for(b = largest; b != tb->smaller; b = b->smaller)
b->r.max.x *= shrink;
width += tw * shrink;
}

SET(tb);
tb = nil;
for(nb = 0; nb < nelem(s->bar); nb++)
for(b = s->bar[nb]; b; tb=b, b=b->next) {
if(b == s->bar[BarRight])
Expand Down Expand Up @@ -198,8 +197,7 @@ static void
bup_event(Window *w, XButtonPressedEvent *e) {
Bar *b;

USED(w);
USED(e);
USED(w, e);

for(b=screen->bar[BarLeft]; b; b=b->next)
if(ptinrect(Pt(e->x, e->y), b->r)) {
Expand All @@ -215,8 +213,7 @@ bup_event(Window *w, XButtonPressedEvent *e) {

static void
expose_event(Window *w, XExposeEvent *e) {
USED(w);
USED(e);
USED(w, e);
draw_bar(screen);
}

Expand Down
53 changes: 20 additions & 33 deletions cmd/wmii/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "dat.h"
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xatom.h>
#include "fns.h"
Expand Down Expand Up @@ -76,7 +75,7 @@ create_client(XWindow w, XWindowAttributes *wa) {

grab_button(c->framewin->w, AnyButton, AnyModifier);

for(t=&client ;; t=&(*t)->next)
for(t=&client ;; t=&t[0]->next)
if(!*t) {
c->next = *t;
*t = c;
Expand Down Expand Up @@ -125,8 +124,7 @@ manage_client(Client *c) {

static int /* Temporary Xlib error handler */
ignoreerrors(Display *d, XErrorEvent *e) {
USED(d);
USED(e);
USED(d, e);
return 0;
}

Expand All @@ -142,7 +140,7 @@ destroy_client(Client *c) {

unmapwin(c->framewin);

for(tc=&client; *tc; tc=&(*tc)->next)
for(tc=&client; *tc; tc=&tc[0]->next)
if(*tc == c) {
*tc = c->next;
break;
Expand Down Expand Up @@ -330,32 +328,27 @@ focus_client(Client *c) {

Dprint("focus_client(%p[%C]) => %s\n", c, c, clientname(c));

if (screen->focus == c)
return;

if(c == nil || !c->noinput) {
if((c == nil || !c->noinput) && screen->focus != c) {
Dprint("\t%s => %s\n", clientname(screen->focus), clientname(c));

if(c)
setfocus(&c->w, RevertToPointerRoot);
setfocus(&c->w, RevertToParent);
else
setfocus(screen->barwin, RevertToPointerRoot);
setfocus(screen->barwin, RevertToParent);

write_event("ClientFocus %C\n", c);

XSync(display, False);
flushevents(FocusChangeMask, True);
} else if(c && c->noinput) {
setfocus(nil, RevertToPointerRoot);
}
}

void
resize_client(Client *c, Rectangle *r) {
resize_client(Client *c, Rectangle r) {
Frame *f;

f = c->sel;
resize_frame(f, *r);
resize_frame(f, r);

if(f->area->view != screen->sel) {
unmap_client(c, IconicState);
Expand Down Expand Up @@ -455,24 +448,15 @@ fullscreen(Client *c, int fullscreen) {

if((f = c->sel)) {
if(fullscreen) {
/* we lose information here if the client was just moved to
* the floating area, but it's worth it */
c->revert = f->area;

if(f->area->floating)
f->revert = f->r;
else {
f->r = f->revert;
send_to_area(f->view->area, f);
}
focus_client(c);
}else {
}else
resize_frame(f, f->revert);
if (c->revert) {
send_to_area(c->revert, f);
c->revert = nil;
}
}
if(f->view == screen->sel)
focus_view(screen, f->view);
}
Expand Down Expand Up @@ -589,7 +573,7 @@ updatemwm(Client *c) {

if(c->sel) {
r = client2frame(c->sel, r);
resize_client(c, &r);
resize_client(c, r);
draw_frame(c->sel);
}
}
Expand Down Expand Up @@ -672,7 +656,7 @@ configreq_event(Window *w, XConfigureRequestEvent *e) {
fullscreen(c, True);

if(c->sel->area->floating)
resize_client(c, &r);
resize_client(c, r);
else {
c->sel->revert = r;
configure_client(c);
Expand All @@ -681,8 +665,7 @@ configreq_event(Window *w, XConfigureRequestEvent *e) {

static void
destroy_event(Window *w, XDestroyWindowEvent *e) {
USED(w);
USED(e);
USED(w, e);

Dprint("client.c:destroy_event(%W)\n", w);
destroy_client(w->aux);
Expand Down Expand Up @@ -823,7 +806,7 @@ update_client_views(Client *c, char **tags) {
SET(cmp);
while(*fp) {
if(*tags) {
cmp = strcmp((*fp)->view->name, *tags);
cmp = strcmp(fp[0]->view->name, *tags);
if(cmp >= 0)
break;
}
Expand All @@ -844,7 +827,7 @@ update_client_views(Client *c, char **tags) {
f->cnext = *fp;
*fp = f;
}
if(*fp) fp=&(*fp)->cnext;
if(fp[0]) fp=&fp[0]->cnext;
tags++;
}
}
Expand All @@ -857,8 +840,12 @@ bsstrcmp(const void *a, const void *b) {
}

static int
strpcmp(const void *a, const void *b) {
return strcmp(*(char **)a, *(char **)b);
strpcmp(const void *ap, const void *bp) {
char **a, **b;

a = (char**)ap; /* gcc wants this case. *sigh* */
b = (char**)bp;
return strcmp(*a, *b);
}

static char *badtags[] = {
Expand Down
31 changes: 15 additions & 16 deletions cmd/wmii/column.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "dat.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include "fns.h"
Expand Down Expand Up @@ -359,14 +358,14 @@ arrange_column(Area *a, Bool dirty) {
resize:
if(a->view == screen->sel) {
restack_view(a->view);
resize_client(a->sel->client, &a->sel->r);
resize_client(a->sel->client, a->sel->r);

for(f=a->frame; f; f=f->anext)
if(!f->collapsed && f != a->sel)
resize_client(f->client, &f->r);
resize_client(f->client, f->r);
for(f=a->frame; f; f=f->anext)
if(f->collapsed && f != a->sel)
resize_client(f->client, &f->r);
resize_client(f->client, f->r);
}
}

Expand Down Expand Up @@ -425,44 +424,44 @@ resize_colframe(Frame *f, Rectangle *r) {
Area *a, *al, *ar;
View *v;
uint minw;
int dx, dw;
int dx, dw, maxx;

a = f->area;
v = a->view;
maxx = r->max.x;

minw = Dx(screen->r) / NCOL;

if(a->prev && !a->prev->floating)
al = a->prev;
else
al = nil;
al = a->prev;
ar = a->next;

if(al)
r->min.x = max(r->min.x, al->r.min.x + minw);
else
r->min.x = max(r->min.x, 0);

if(ar)
r->max.x = min(r->max.x, ar->r.max.x - minw);
if(ar) {
if(maxx >= ar->r.max.x - minw)
maxx = ar->r.max.x - minw;
}
else
r->max.x = min(r->max.x, screen->r.max.x);
if(maxx > screen->r.max.x)
maxx = screen->r.max.x;

dx = a->r.min.x - r->min.x;
dw = r->max.x - a->r.max.x;
dw = maxx - a->r.max.x;
if(al) {
al->r.max.x -= dx;
arrange_column(al, False);
}
if(ar) {
ar->r.min.x += dw;
ar->r.max.x -= dw;
arrange_column(ar, False);
}

resize_colframeh(f, r);

a->r.min.x = r->min.x;
a->r.max.x = r->max.x;
a->r.max.x = maxx;
arrange_view(a->view);

focus_view(screen, v);
Expand Down
Loading

0 comments on commit f6c2a49

Please sign in to comment.