Permalink
Browse files

Best just read the diff.

  • Loading branch information...
1 parent 95b2b20 commit 1b8c7019e0bca127692bb2dd944b1d22435d6b35 Kris Maglione committed Aug 25, 2008
Showing with 307 additions and 651 deletions.
  1. +3 −0 TODO
  2. +1 −0 cmd/wmii.sh.sh
  3. +1 −1 cmd/wmii/Makefile
  4. +8 −2 cmd/wmii/area.c
  5. +2 −5 cmd/wmii/client.c
  6. +6 −2 cmd/wmii/column.c
  7. +3 −1 cmd/wmii/event.c
  8. +32 −10 cmd/wmii/ewmh.c
  9. +25 −1 cmd/wmii/float.c
  10. +1 −0 cmd/wmii/fns.h
  11. +31 −35 cmd/wmii/frame.c
  12. +117 −521 cmd/wmii/fs.c
  13. +1 −1 cmd/wmii/key.c
  14. +1 −1 cmd/wmii/main.c
  15. +60 −61 cmd/wmii/message.c
  16. +6 −2 cmd/wmii/view.c
  17. +1 −0 cmd/wmii9menu.c
  18. +1 −1 cmd/wmiir.c
  19. +1 −1 config.mk
  20. +0 −2 libwmii_hack/hack.c
  21. +1 −1 mk/hdr.mk
  22. +1 −1 rc/rc.wmii.rc
  23. +0 −1 rc/wmiirc.sh
  24. +1 −0 util/compile
  25. +2 −1 util/genconfig
  26. +1 −0 util/link
View
3 TODO
@@ -5,6 +5,9 @@ BUGS
4.0
* Opaque managed moves. I know I've argued against it, but it may be doable.
+* Clicking layout boxes should do useful things.
+* Collapse/uncollapse frames with the keyboard.
+* Open modes (to replace colmodes).
* Resizable managed area. Maybe. Struts seem to do everything this might.
* New dmenu, with real cursor; snarfable.
View
@@ -73,6 +73,7 @@ Event Key
!
eval "cat <<!
$(sed "$_sed" | sed '/^[ ]/s/\([$`]\)/\\\1/g')
+!
"
}
View
@@ -10,7 +10,7 @@ HFILES= dat.h fns.h
LIB = ${LIBIXP}
LDFLAGS += -lm ${LIBX11} -lXext -lXrandr ${LIBICONV} -lregexp9 -lbio -lfmt -lutf
CFLAGS += ${INCX11} ${INCICONV} -DVERSION=\"${VERSION}\" \
- -DIXP_NEEDAPI=86
+ -DIXP_NEEDAPI=97
OBJ = area \
bar \
client \
View
@@ -89,7 +89,10 @@ area_create(View *v, Area *pos, uint w) {
a = emallocz(sizeof *a);
a->view = v;
a->id = id++;
- a->mode = def.colmode;
+ if(v->area)
+ a->mode = def.colmode;
+ else
+ a->mode = Coldefault;
a->frame = nil;
a->sel = nil;
@@ -245,8 +248,11 @@ area_focus(Area *a) {
if(!a->floating)
v->selcol = area_idx(a);
- if((old_a) && (a->floating != old_a->floating))
+ if((old_a) && (a->floating != old_a->floating)) {
v->revert = old_a;
+ if(v->area->max)
+ view_update(v);
+ }
if(v != screen->sel)
return;
View
@@ -469,18 +469,15 @@ focus(Client *c, bool user) {
void
client_focus(Client *c) {
/* Round trip. */
- static long id;
- long _id;
if(c && c->group)
c->group->client = c;
sync();
flushevents(FocusChangeMask, true);
- _id = id++ % 99;
- Dprint(DFocus, "client_focus([%C]%s) %ld\n", c, clientname(c), _id);
- Dprint(DFocus, "\t%02d [%C]%s\n\t=> [%C]%s\n", _id,
+ Dprint(DFocus, "client_focus([%C]%s)\n", c, clientname(c));
+ Dprint(DFocus, "\t[%C]%s\n\t=> [%C]%s\n",
screen->focus, clientname(screen->focus),
c, clientname(c));
if(screen->focus != c) {
View
@@ -129,7 +129,7 @@ stack_info(Frame *f, Frame **firstp, int *dyp, int *nframep) {
nframe = 0;
dy = 0;
- first = nil;
+ first = f;
for(ft=f; ft && ft->collapsed; ft=ft->anext)
;
if(ft && ft != f) {
@@ -513,7 +513,9 @@ column_scale(Area *a) {
f->colr.max.x = a->r.max.x;
if(!f->collapsed)
f->colr.max.y += ((float)f->dy / dy) * surplus;
- assert(f->collapsed ? Dy(f->r) >= 0 : dy > 0);
+ if(btassert("6 full", !(f->collapsed ? Dy(f->r) >= 0 : dy > 0)))
+ warning("Something's fucked: %s:%d:%s()",
+ __FILE__, __LINE__, __func__);
frame_resize(f, f->colr);
}
@@ -527,6 +529,8 @@ column_arrange(Area *a, bool dirty) {
Frame *f;
View *v;
+ if(a->floating)
+ float_arrange(a);
if(a->floating || !a->frame)
return;
View
@@ -274,7 +274,7 @@ keypress(XKeyEvent *ev) {
xtime = ev->time;
ev->state &= valid_mask;
if(ev->window == scr.root.w)
- kpress(scr.root.w, ev->state, (KeyCode) ev->keycode);
+ kpress(scr.root.w, ev->state, (KeyCode)ev->keycode);
}
static void
@@ -325,6 +325,7 @@ static void
mapnotify(XMapEvent *ev) {
Window *w;
+ ignoreenter = ev->serial;
if((w = findwin(ev->window)))
handle(w, map, ev);
}
@@ -333,6 +334,7 @@ static void
unmapnotify(XUnmapEvent *ev) {
Window *w;
+ ignoreenter = ev->serial;
if((w = findwin(ev->window)) && (ev->event == w->parent->w)) {
w->mapped = false;
if(ev->send_event || w->unmapped-- == 0)
View
@@ -7,6 +7,9 @@
Window *ewmhwin;
+static void ewmh_getwinstate(Client*);
+static void ewmh_setstate(Client*, Atom, int);
+
#define Net(x) ("_NET_" x)
#define Action(x) ("_NET_WM_ACTION_" x)
#define State(x) ("_NET_WM_STATE_" x)
@@ -117,6 +120,7 @@ ewmh_initclient(Client *c) {
changeprop_long(&c->w, Net("WM_ALLOWED_ACTIONS"), "ATOM",
allowed, nelem(allowed));
ewmh_getwintype(c);
+ ewmh_getwinstate(c);
ewmh_getstrut(c);
ewmh_updateclientlist();
}
@@ -237,6 +241,18 @@ ewmh_getwintype(Client *c) {
}
}
+static void
+ewmh_getwinstate(Client *c) {
+ ulong *vals;
+ long n;
+
+ n = getprop_ulong(&c->w, Net("WM_STATE"), "ATOM",
+ 0L, &vals, 16);
+ while(--n >= 0)
+ ewmh_setstate(c, vals[n], On);
+ free(vals);
+}
+
long
ewmh_protocols(Window *w) {
static Prop props[] = {
@@ -297,6 +313,20 @@ ewmh_getstrut(Client *c) {
view_update(screen->sel);
}
+static void
+ewmh_setstate(Client *c, Atom state, int action) {
+
+ Dprint(DEwmh, "\tSTATE = %A\n", state);
+ if(state == 0)
+ return;
+
+ if(state == STATE("FULLSCREEN"))
+ fullscreen(c, action);
+ else
+ if(state == STATE("DEMANDS_ATTENTION"))
+ client_seturgent(c, action, UrgClient);
+}
+
int
ewmh_clientmessage(XClientMessageEvent *e) {
Client *c;
@@ -328,16 +358,8 @@ ewmh_clientmessage(XClientMessageEvent *e) {
return -1;
}
Dprint(DEwmh, "\tAction: %s\n", TOGGLE(action));
- for(i = 1; i <= 2; i++) {
- if(l[i] == 0)
- break;
- Dprint(DEwmh, "\tl[%d] = %A\n", i, l[i]);
- if(l[i] == STATE("FULLSCREEN"))
- fullscreen(c, action);
- else
- if(l[i] == STATE("DEMANDS_ATTENTION"))
- client_seturgent(c, action, UrgClient);
- }
+ ewmh_setstate(c, l[1], action);
+ ewmh_setstate(c, l[2], action);
return 1;
}else
if(msg == NET("ACTIVE_WINDOW")) {
View
@@ -59,6 +59,30 @@ float_resizeframe(Frame *f, Rectangle r) {
frame_resize(f, r);
}
+void
+float_arrange(Area *a) {
+ Frame *f;
+
+ assert(a->floating);
+
+ switch(a->mode) {
+ case Coldefault:
+ for(f=a->frame; f; f=f->anext)
+ f->collapsed = false;
+ break;
+ case Colstack:
+ for(f=a->frame; f; f=f->anext)
+ f->collapsed = (f != a->sel);
+ break;
+ default:
+ die("not reached");
+ break;
+ }
+ for(f=a->frame; f; f=f->anext)
+ f->r = f->floatr;
+ view_update(a->view);
+}
+
static void
rect_push(Vector_rect *vec, Rectangle r) {
Rectangle *rp;
@@ -163,6 +187,6 @@ float_placeframe(Frame *f) {
}
}
- f->r = rectsetorigin(f->r, p);
+ f->floatr = rectsetorigin(f->r, p);
}
View
@@ -120,6 +120,7 @@ void ewmh_updateview(void);
void ewmh_updateviews(void);
/* float.c */
+void float_arrange(Area*);
void float_attach(Area*, Frame*);
void float_detach(Frame*);
void float_resizeframe(Frame*, Rectangle);
View
@@ -215,6 +215,7 @@ enter_event(Window *w, XCrossingEvent *e) {
f->client, f->client->name, ignoreenter == e->serial ? " (ignored)" : "");
if(e->detail != NotifyInferior)
if(e->serial != ignoreenter && (f->area->floating || !f->collapsed))
+ if(!(c->w.ewmh.type & TypeSplash))
focus(f->client, false);
}
mouse_checkresize(f, Pt(e->x, e->y), false);
@@ -296,26 +297,30 @@ frame_gethints(Frame *f) {
return h;
}
+#define ADJ(PE, ME) \
+ if(c->fullscreen) \
+ return r; \
+ \
+ if(!floating) { \
+ r.min.x PE 1; \
+ r.min.y PE labelh(def.font); \
+ r.max.x ME 1; \
+ r.max.y ME 1; \
+ }else { \
+ if(!c->borderless) { \
+ r.min.x PE def.border; \
+ r.max.x ME def.border; \
+ r.max.y ME def.border; \
+ } \
+ if(!c->titleless) \
+ r.min.y PE labelh(def.font); \
+ } \
+
Rectangle
frame_rect2client(Client *c, Rectangle r, bool floating) {
- if(c->fullscreen)
- return r;
+ ADJ(+=, -=)
- if(!floating) {
- r.min.x += 1;
- r.min.y += labelh(def.font);
- r.max.x -= 1;
- r.max.y -= 1;
- }else {
- if(!c->borderless) {
- r.min.x += def.border;
- r.max.x -= def.border;
- r.max.y -= def.border;
- }
- if(!c->titleless)
- r.min.y += labelh(def.font);
- }
r.max.x = max(r.max.x, r.min.x+1);
r.max.y = max(r.max.y, r.min.y+1);
return r;
@@ -324,26 +329,13 @@ frame_rect2client(Client *c, Rectangle r, bool floating) {
Rectangle
frame_client2rect(Client *c, Rectangle r, bool floating) {
- if(c->fullscreen)
- return r;
+ ADJ(-=, +=)
- if(!floating) {
- r.min.x -= 1;
- r.min.y -= labelh(def.font);
- r.max.x += 1;
- r.max.y += 1;
- }else {
- if(!c->borderless) {
- r.min.x -= def.border;
- r.max.x += def.border;
- r.max.y += def.border;
- }
- if(!c->titleless)
- r.min.y -= labelh(def.font);
- }
return r;
}
+#undef ADJ
+
void
frame_resize(Frame *f, Rectangle r) {
Client *c;
@@ -364,8 +356,10 @@ frame_resize(Frame *f, Rectangle r) {
return;
}
+ /*
if(f->area->floating)
f->collapsed = false;
+ */
fr = frame_hints(f, r, get_sticky(f->r, r));
if(f->area->floating && !c->strut)
@@ -398,7 +392,7 @@ frame_resize(Frame *f, Rectangle r) {
}
f->crect = rectsubpt(cr, f->r.min);
- if(f->area->floating)
+ if(f->area->floating && !f->collapsed)
f->floatr = f->r;
}
@@ -458,7 +452,7 @@ frame_draw(Frame *f) {
f->titlebar = insetrect(r, 3);
f->titlebar.max.y += 3;
- /* Odd focus. Ulselected, with keyboard focus. */
+ /* Odd focus. Unselected, with keyboard focus. */
/* Draw a border just inside the titlebar. */
if(c != selclient() && c == screen->focus) {
border(img, insetrect(r, 1), 1, def.normcolor.bg);
@@ -481,7 +475,7 @@ frame_draw(Frame *f) {
border(img, insetrect(r, -1), 1, def.normcolor.bg);
/* Draw a border on borderless+titleless selected apps. */
- if(c->borderless && c->titleless && c == selclient())
+ if(f->area->floating && c->borderless && c->titleless && c == selclient())
setborder(c->framewin, def.border, def.focuscolor.border);
else
setborder(c->framewin, 0, 0);
@@ -626,6 +620,8 @@ frame_focus(Frame *f) {
return;
move_focus(old_f, f);
+ if(a->floating)
+ float_arrange(a);
client_focus(f->client);
/*
Oops, something went wrong.

0 comments on commit 1b8c701

Please sign in to comment.