mirror of
https://github.com/0intro/wmii
synced 2024-11-28 16:43:08 +03:00
Some grabbox fixes, and, it seems, several changes I forgot to commit.
This commit is contained in:
parent
fda2ca35cc
commit
b645346147
6
TODO
6
TODO
@ -6,9 +6,7 @@
|
||||
4.0
|
||||
* Get rid of colmodes
|
||||
* (Multi line) Tag bars
|
||||
* Replace bar with master tag bar
|
||||
* New event system
|
||||
* Resizable managed area
|
||||
* Sticky clients
|
||||
* Regex-based tag strings
|
||||
* New dmenu(with real cursor and using Bio)
|
||||
* Depend on plan9-corelibs
|
||||
* Use libbio, libfmt, libregex9
|
||||
|
@ -296,7 +296,7 @@ place_frame(Frame *f) {
|
||||
|
||||
if(c->trans)
|
||||
return;
|
||||
if(c->fullscreen || c->w.hints->position)
|
||||
if(c->fullscreen || c->w.hints->position || starting)
|
||||
return;
|
||||
if(!field) {
|
||||
mx = Dx(screen->r) / dx;
|
||||
|
@ -104,14 +104,14 @@ manage_client(Client *c) {
|
||||
r = c->w.r;
|
||||
p.x = def.border;
|
||||
p.y = labelh(def.font);
|
||||
reparent_client(c, c->framewin, ZP);
|
||||
reparentwindow(&c->w, c->framewin, p);
|
||||
|
||||
if(!strlen(c->tags))
|
||||
apply_rules(c);
|
||||
else
|
||||
apply_tags(c, c->tags);
|
||||
|
||||
if(c->w.hints->position) {
|
||||
if(c->w.hints->position || starting) {
|
||||
r = gravclient(c, r);
|
||||
if(c->sel->area->floating)
|
||||
resize_client(c, &r);
|
||||
@ -138,7 +138,7 @@ destroy_client(Client *c) {
|
||||
Rectangle r;
|
||||
char *dummy;
|
||||
Client **tc;
|
||||
XEvent ev;
|
||||
Bool hide;
|
||||
|
||||
Debug fprintf(stderr, "client.c:destroy_client(%p) %s\n", c, c->name);
|
||||
|
||||
@ -148,37 +148,39 @@ destroy_client(Client *c) {
|
||||
break;
|
||||
}
|
||||
|
||||
r = c->w.r;
|
||||
if(c->sel) {
|
||||
r = gravclient(c, ZR);
|
||||
r = frame2client(c->sel, r);
|
||||
}
|
||||
|
||||
hide = False;
|
||||
if(!c->sel || c->sel->view != screen->sel)
|
||||
hide = True;
|
||||
|
||||
XGrabServer(display);
|
||||
|
||||
/* In case the client is already unmapped */
|
||||
handler = XSetErrorHandler(ignoreerrors);
|
||||
|
||||
if(c->sel) {
|
||||
r = gravclient(c, ZR);
|
||||
r = frame2client(nil, r);
|
||||
}
|
||||
|
||||
dummy = nil;
|
||||
update_client_views(c, &dummy);
|
||||
|
||||
unmap_client(c, WithdrawnState);
|
||||
reparent_client(c, &scr.root, r.min);
|
||||
|
||||
write_event("DestroyClient 0x%x\n", (uint)c->w.w);
|
||||
|
||||
destroywindow(c->framewin);
|
||||
unmap_client(c, IconicState);
|
||||
sethandler(&c->w, nil);
|
||||
|
||||
if(hide)
|
||||
reparentwindow(&c->w, &scr.root, screen->r.max);
|
||||
else
|
||||
reparentwindow(&c->w, &scr.root, r.min);
|
||||
destroywindow(c->framewin);
|
||||
|
||||
XSync(display, False);
|
||||
XSetErrorHandler(handler);
|
||||
|
||||
XUngrabServer(display);
|
||||
|
||||
write_event("DestroyClient 0x%x\n", clientwin(c));
|
||||
|
||||
flushevents(EnterWindowMask, False);
|
||||
|
||||
while(XCheckMaskEvent(display, StructureNotifyMask, &ev))
|
||||
if(ev.type != UnmapNotify || ev.xunmap.window != c->w.w)
|
||||
dispatch_event(&ev);
|
||||
|
||||
free(c);
|
||||
}
|
||||
|
||||
@ -325,15 +327,16 @@ focus_client(Client *c) {
|
||||
|
||||
if(screen->focus != c) {
|
||||
Debug fprintf(stderr, "\t%s => %s\n", clientname(screen->focus), clientname(c));
|
||||
|
||||
if(c)
|
||||
setfocus(&c->w, RevertToParent);
|
||||
else
|
||||
setfocus(screen->barwin, RevertToParent);
|
||||
XSync(display, False);
|
||||
}
|
||||
|
||||
XSync(display, False);
|
||||
flushevents(FocusChangeMask, True);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
resize_client(Client *c, Rectangle *r) {
|
||||
@ -368,11 +371,6 @@ resize_client(Client *c, Rectangle *r) {
|
||||
flushevents(FocusChangeMask|ExposureMask, True);
|
||||
}
|
||||
|
||||
void
|
||||
reparent_client(Client *c, Window *w, Point pt) {
|
||||
reparentwindow(&c->w, w, pt);
|
||||
}
|
||||
|
||||
void
|
||||
set_cursor(Client *c, Cursor cur) {
|
||||
WinAttr wa;
|
||||
@ -500,6 +498,8 @@ update_client_name(Client *c) {
|
||||
free(str);
|
||||
|
||||
update_class(c);
|
||||
if(c->sel)
|
||||
draw_frame(c->sel);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -546,13 +546,15 @@ prop_client(Client *c, Atom a) {
|
||||
char **class;
|
||||
int n;
|
||||
|
||||
if(a == xatom("WM_PROTOCOLS"))
|
||||
if(a == xatom("WM_PROTOCOLS")) {
|
||||
c->proto = winprotocols(&c->w);
|
||||
else if(a == xatom("_NET_WM_NAME"))
|
||||
}
|
||||
else if(a == xatom("_NET_WM_NAME")) {
|
||||
goto wmname;
|
||||
else if(a == xatom("_MOTIF_WM_HINTS"))
|
||||
}
|
||||
else if(a == xatom("_MOTIF_WM_HINTS")) {
|
||||
updatemwm(c);
|
||||
else switch (a) {
|
||||
}else switch (a) {
|
||||
case XA_WM_TRANSIENT_FOR:
|
||||
XGetTransientForHint(display, c->w.w, &c->trans);
|
||||
break;
|
||||
@ -579,8 +581,6 @@ prop_client(Client *c, Atom a) {
|
||||
case XA_WM_NAME:
|
||||
wmname:
|
||||
update_client_name(c);
|
||||
if(c->frame)
|
||||
draw_frame(c->sel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -611,7 +611,8 @@ configreq_event(Window *w, XConfigureRequestEvent *e) {
|
||||
r = rectaddpt(r, p);
|
||||
r = gravclient(c, r);
|
||||
|
||||
if((Dx(r) == Dx(screen->r)) && (Dy(r) == Dy(screen->r))) {
|
||||
if((Dx(r) == Dx(screen->r))
|
||||
&& (Dy(r) == Dy(screen->r))) {
|
||||
c->fullscreen = True;
|
||||
if(f) {
|
||||
if(!f->area->floating)
|
||||
@ -666,8 +667,6 @@ focusin_event(Window *w, XFocusChangeEvent *e) {
|
||||
if(c != old) {
|
||||
if(c->sel)
|
||||
draw_frame(c->sel);
|
||||
if(old && old->sel)
|
||||
draw_frame(old->sel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -676,17 +675,14 @@ focusout_event(Window *w, XFocusChangeEvent *e) {
|
||||
Client *c;
|
||||
|
||||
c = w->aux;
|
||||
|
||||
if((e->mode == NotifyWhileGrabbed) && (screen->hasgrab != &c_root)) {
|
||||
if((screen->focus) && (screen->hasgrab != screen->focus))
|
||||
screen->hasgrab = screen->focus;
|
||||
if(screen->hasgrab == c)
|
||||
return;
|
||||
}else if(e->mode != NotifyGrab) {
|
||||
if(screen->focus == c) {
|
||||
}else if(screen->focus == c) {
|
||||
print_focus(&c_magic, "<magic>");
|
||||
screen->focus = &c_magic;
|
||||
}
|
||||
if(c->sel)
|
||||
draw_frame(c->sel);
|
||||
}
|
||||
|
@ -204,13 +204,6 @@ scale_column(Area *a) {
|
||||
if(!a->frame)
|
||||
return;
|
||||
|
||||
/* This works by comparing heights based on a surplus of their
|
||||
* minimum size. We start by subtracting the minimum size, then
|
||||
* scale the surplus, and add back the minimum size later. This
|
||||
* is based on the size of the client, rather than the frame, so
|
||||
* increment gaps can be equalized later */
|
||||
/* Frames that can't be accomodated are pushed to the floating layer */
|
||||
|
||||
minh = labelh(def.font);
|
||||
colh = labelh(def.font);
|
||||
uncolh = minh + colh +1;
|
||||
@ -253,11 +246,6 @@ scale_column(Area *a) {
|
||||
f = *fp;
|
||||
if(f == a->sel)
|
||||
i++, j++;
|
||||
if(!f->collapsed) {
|
||||
if(j < 0 && (f != a->sel))
|
||||
f->collapsed = True;
|
||||
j--;
|
||||
}
|
||||
if(f->collapsed) {
|
||||
if(i < 0 && (f != a->sel)) {
|
||||
f->collapsed = False;
|
||||
@ -265,6 +253,10 @@ scale_column(Area *a) {
|
||||
continue;
|
||||
}
|
||||
i--;
|
||||
}else {
|
||||
if(j < 0 && (f != a->sel))
|
||||
f->collapsed = True;
|
||||
j--;
|
||||
}
|
||||
/* Doesn't change if we 'continue' */
|
||||
fp=&f->anext;
|
||||
@ -281,8 +273,8 @@ scale_column(Area *a) {
|
||||
}else {
|
||||
f->r.max.y = uncolh;
|
||||
dy += Dy(f->crect);
|
||||
surplus += Dy(f->r);
|
||||
}
|
||||
surplus += Dy(f->r);
|
||||
}
|
||||
for(f = a->frame; f; f = f->anext)
|
||||
f->ratio = (float)Dy(f->crect)/dy;
|
||||
@ -293,11 +285,9 @@ scale_column(Area *a) {
|
||||
j = surplus;
|
||||
dy = 0;
|
||||
for(f=a->frame; f; f=f->anext) {
|
||||
if(!f->collapsed) {
|
||||
if(!f->collapsed)
|
||||
f->r.max.y += f->ratio * surplus;
|
||||
resize_frame(f, f->r);
|
||||
f->r.max.y = Dy(f->crect) + labelh(def.font) + 1;
|
||||
}
|
||||
dy += Dy(f->r);
|
||||
}
|
||||
surplus = Dy(a->r) - dy;
|
||||
@ -336,11 +326,9 @@ arrange_column(Area *a, Bool dirty) {
|
||||
|
||||
switch(a->mode) {
|
||||
case Coldefault:
|
||||
for(f=a->frame; f; f=f->anext) {
|
||||
f->collapsed = False;
|
||||
if(dirty)
|
||||
for(f=a->frame; f; f=f->anext)
|
||||
f->r = Rect(0, 0, 100, 100);
|
||||
}
|
||||
break;
|
||||
case Colstack:
|
||||
for(f=a->frame; f; f=f->anext)
|
||||
|
@ -15,6 +15,8 @@ dispatch_event(XEvent *e) {
|
||||
handler[e->type](e);
|
||||
}
|
||||
|
||||
#define handle(w, fn, ev) ((w)->handler->fn ? (w)->handler->fn((w), ev) : (void)0)
|
||||
|
||||
uint
|
||||
flushevents(long event_mask, Bool dispatch) {
|
||||
XEvent ev;
|
||||
@ -35,8 +37,7 @@ buttonrelease(XEvent *e) {
|
||||
|
||||
ev = &e->xbutton;
|
||||
if((w = findwin(ev->window)))
|
||||
if(w->handler->bup)
|
||||
w->handler->bup(w, ev);
|
||||
handle(w, bup, ev);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -45,10 +46,8 @@ buttonpress(XEvent *e) {
|
||||
Window *w;
|
||||
|
||||
ev = &e->xbutton;
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->bdown)
|
||||
w->handler->bdown(w, ev);
|
||||
}
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, bdown, ev);
|
||||
else
|
||||
XAllowEvents(display, ReplayPointer, ev->time);
|
||||
}
|
||||
@ -60,10 +59,9 @@ configurerequest(XEvent *e) {
|
||||
Window *w;
|
||||
|
||||
ev = &e->xconfigurerequest;
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->configreq)
|
||||
w->handler->configreq(w, ev);
|
||||
}else{
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, configreq, ev);
|
||||
else{
|
||||
wc.x = ev->x;
|
||||
wc.y = ev->y;
|
||||
wc.width = ev->width;
|
||||
@ -71,7 +69,6 @@ configurerequest(XEvent *e) {
|
||||
wc.border_width = ev->border_width;
|
||||
wc.sibling = ev->above;
|
||||
wc.stack_mode = ev->detail;
|
||||
//ev->value_mask &= ~(CWStackMode|CWSibling);
|
||||
XConfigureWindow(display, ev->window, ev->value_mask, &wc);
|
||||
}
|
||||
}
|
||||
@ -83,10 +80,9 @@ destroynotify(XEvent *e) {
|
||||
Client *c;
|
||||
|
||||
ev = &e->xdestroywindow;
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->destroy)
|
||||
w->handler->destroy(w, ev);
|
||||
}else {
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, destroy, ev);
|
||||
else {
|
||||
Debug fprintf(stderr, "DestroyWindow(%x) (no handler)\n", (uint)ev->window);
|
||||
if((c = win2client(ev->window)))
|
||||
fprintf(stderr, "Badness: Unhandled DestroyNotify: "
|
||||
@ -103,10 +99,8 @@ enternotify(XEvent *e) {
|
||||
if(ev->mode != NotifyNormal)
|
||||
return;
|
||||
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->enter)
|
||||
w->handler->enter(w, ev);
|
||||
}
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, enter, ev);
|
||||
else if(ev->window == scr.root.w) {
|
||||
sel_screen = True;
|
||||
draw_frames();
|
||||
@ -164,21 +158,15 @@ focusin(XEvent *e) {
|
||||
print_focus(nil, "<nil>");
|
||||
screen->focus = nil;
|
||||
}
|
||||
else if((w = findwin(ev->window))) {
|
||||
if(w->handler->focusin)
|
||||
w->handler->focusin(w, ev);
|
||||
}
|
||||
else if((w = findwin(ev->window)))
|
||||
handle(w, focusin, ev);
|
||||
else if(ev->mode == NotifyGrab) {
|
||||
if(ev->window == scr.root.w)
|
||||
if(XCheckMaskEvent(display, KeyPressMask, &me)) {
|
||||
/* wmii has grabbed focus */
|
||||
c = screen->focus;
|
||||
screen->hasgrab = &c_root;
|
||||
screen->focus = &c_magic;
|
||||
if(c)
|
||||
draw_frame(c->sel);
|
||||
flushevents(FocusChangeMask, True);
|
||||
dispatch_event(&me);
|
||||
return;
|
||||
}
|
||||
/* Some unmanaged window has grabbed focus */
|
||||
if((c = screen->focus)) {
|
||||
@ -197,15 +185,16 @@ focusout(XEvent *e) {
|
||||
|
||||
ev = &e->xfocus;
|
||||
if(!((ev->detail == NotifyNonlinear)
|
||||
||(ev->detail == NotifyNonlinearVirtual)))
|
||||
||(ev->detail == NotifyNonlinearVirtual)
|
||||
||(ev->detail == NotifyVirtual)
|
||||
||(ev->detail == NotifyInferior)
|
||||
||(ev->detail == NotifyAncestor)))
|
||||
return;
|
||||
if(ev->mode == NotifyUngrab)
|
||||
screen->hasgrab = nil;
|
||||
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->focusout)
|
||||
w->handler->focusout(w, ev);
|
||||
}
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, focusout, ev);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -215,10 +204,8 @@ expose(XEvent *e) {
|
||||
|
||||
ev = &e->xexpose;
|
||||
if(ev->count == 0) {
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->expose)
|
||||
w->handler->expose(w, ev);
|
||||
}
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, expose, ev);
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,10 +258,8 @@ motionnotify(XEvent *e) {
|
||||
Window *w;
|
||||
|
||||
ev = &e->xmotion;
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->motion)
|
||||
w->handler->motion(w, ev);
|
||||
}
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, motion, ev);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -283,10 +268,8 @@ propertynotify(XEvent *e) {
|
||||
Window *w;
|
||||
|
||||
ev = &e->xproperty;
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->property)
|
||||
w->handler->property(w, ev);
|
||||
}
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, property, ev);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -295,10 +278,8 @@ mapnotify(XEvent *e) {
|
||||
Window *w;
|
||||
|
||||
ev = &e->xmap;
|
||||
if((w = findwin(ev->window))) {
|
||||
if(w->handler->map)
|
||||
w->handler->map(w, ev);
|
||||
}
|
||||
if((w = findwin(ev->window)))
|
||||
handle(w, map, ev);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -309,8 +290,7 @@ unmapnotify(XEvent *e) {
|
||||
ev = &e->xunmap;
|
||||
if((w = findwin(ev->window)) && (ev->event == w->parent->w)) {
|
||||
if(ev->send_event || w->unmapped-- == 0)
|
||||
if(w->handler->unmap)
|
||||
w->handler->unmap(w, ev);
|
||||
handle(w, unmap, ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ bdown_event(Window *w, XButtonEvent *e) {
|
||||
XAllowEvents(display, ReplayPointer, e->time);
|
||||
break;
|
||||
}
|
||||
XAllowEvents(display, AsyncPointer, e->time);
|
||||
XUngrabPointer(display, e->time);
|
||||
}else{
|
||||
if(e->button == Button1) {
|
||||
if(frame_to_top(f))
|
||||
@ -267,6 +267,13 @@ resize_frame(Frame *f, Rectangle r) {
|
||||
f->crect = frame2client(f, f->crect);
|
||||
f->crect = rectsubpt(f->crect, f->crect.min);
|
||||
|
||||
if(!f->area->floating && f->area->mode == Coldefault) {
|
||||
if(Dy(f->r) < 2 * labelh(def.font))
|
||||
f->collapsed = True;
|
||||
else
|
||||
f->collapsed = False;
|
||||
}
|
||||
|
||||
if(Dx(f->crect) < labelh(def.font)) {
|
||||
f->r.max.x = f->r.min.x + frame_delta_h();
|
||||
f->collapsed = True;
|
||||
@ -313,34 +320,29 @@ set_frame_cursor(Frame *f, Point pt) {
|
||||
|
||||
void
|
||||
swap_frames(Frame *fa, Frame *fb) {
|
||||
Rectangle trect;
|
||||
Area *a;
|
||||
Frame *an, *ap, *bn, *bp;
|
||||
Frame **fp;
|
||||
Client *c;
|
||||
|
||||
if(fa == fb) return;
|
||||
|
||||
an = fa->anext;
|
||||
ap = fa->aprev;
|
||||
bn = fb->anext;
|
||||
bp = fb->aprev;
|
||||
for(fp = &fa->client->frame; *fp; fp = &(*fp)->cnext)
|
||||
if(*fp == fa) break;
|
||||
*fp = (*fp)->cnext;
|
||||
|
||||
fb->anext = an;
|
||||
fb->aprev = ap;
|
||||
fa->anext = bn;
|
||||
fa->aprev = bp;
|
||||
for(fp = &fb->client->frame; *fp; fp = &(*fp)->cnext)
|
||||
if(*fp == fb) break;
|
||||
*fp = (*fp)->cnext;
|
||||
|
||||
if(fb->area->sel == fb)
|
||||
fb->area->sel = fa;
|
||||
if(fa->area->sel == fa)
|
||||
fa->area->sel = fb;
|
||||
c = fa->client;
|
||||
fa->client = fb->client;
|
||||
fb->client = c;
|
||||
|
||||
a = fb->area;
|
||||
fb->area = fa->area;
|
||||
fa->area = a;
|
||||
fb->cnext = c->frame;
|
||||
c->frame = fb;
|
||||
|
||||
trect = fa->r;
|
||||
fa->r = fb->r;
|
||||
fb->r = trect;
|
||||
c = fa->client;
|
||||
fa->cnext = c->frame;
|
||||
c->frame = fa;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -219,19 +219,8 @@ init_screen(WMScreen *screen) {
|
||||
|
||||
static void
|
||||
cleanup() {
|
||||
Point p;
|
||||
Client *c;
|
||||
|
||||
for(c=client; c; c=c->next) {
|
||||
p = ZP;
|
||||
if(c->sel)
|
||||
p = c->sel->r.min;
|
||||
reparent_client(c, &scr.root, p);
|
||||
if(c->sel && c->sel->view != screen->sel)
|
||||
unmap_client(c, IconicState);
|
||||
}
|
||||
XSync(display, False);
|
||||
XCloseDisplay(display);
|
||||
while(client)
|
||||
destroy_client(client);
|
||||
ixp_server_close(&srv);
|
||||
close(sleeperfd);
|
||||
}
|
||||
@ -250,7 +239,7 @@ struct {
|
||||
|
||||
/*
|
||||
* There's no way to check accesses to destroyed windows, thus
|
||||
* those cases are ignored (especially on UnmapNotify's).
|
||||
* those cases are ignored (especially on UnmapNotifys).
|
||||
* Other types of errors call Xlib's default error handler, which
|
||||
* calls exit().
|
||||
*/
|
||||
@ -269,6 +258,8 @@ errorhandler(Display *dpy, XErrorEvent *error) {
|
||||
|
||||
fprintf(stderr, "%s: fatal error: Xrequest code=%d, Xerror code=%d\n",
|
||||
argv0, error->request_code, error->error_code);
|
||||
|
||||
/* Try to cleanup, but only try once, in case we're called again */
|
||||
if(!dead++)
|
||||
cleanup();
|
||||
return xlib_errorhandler(display, error); /* calls exit() */
|
||||
@ -377,12 +368,17 @@ spawn_command(const char *cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
check_9pcon(IxpConn *c) {
|
||||
serve_9pcon(c);
|
||||
check_x_event(nil);
|
||||
}
|
||||
|
||||
static void
|
||||
closedisplay(IxpConn *c) {
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
char *wmiirc, *str;
|
||||
@ -447,7 +443,7 @@ main(int argc, char *argv[]) {
|
||||
init_lock_keys();
|
||||
|
||||
ixp_listen(&srv, sock, &p9srv, check_9pcon, nil);
|
||||
ixp_listen(&srv, ConnectionNumber(display), nil, check_x_event, nil);
|
||||
ixp_listen(&srv, ConnectionNumber(display), nil, check_x_event, closedisplay);
|
||||
|
||||
def.font = loadfont(FONT);
|
||||
def.border = 1;
|
||||
@ -508,7 +504,6 @@ main(int argc, char *argv[]) {
|
||||
|
||||
if(exitsignal)
|
||||
raise(exitsignal);
|
||||
fprintf(stderr, "execstr: %s\n", execstr);
|
||||
if(execstr)
|
||||
execl("/bin/sh", "sh", "-c", execstr, nil);
|
||||
if(errstr)
|
||||
|
@ -107,6 +107,7 @@ hashrm(Map *map, char *str) {
|
||||
MapEnt **e, *te;
|
||||
void *ret;
|
||||
|
||||
ret = nil;
|
||||
e = hashgetp(map, str, 0);
|
||||
if(*e) {
|
||||
te = *e;
|
||||
|
@ -9,10 +9,11 @@
|
||||
#include "dat.h"
|
||||
#include "fns.h"
|
||||
|
||||
static char Ebadcmd[] = "bad command",
|
||||
static char
|
||||
Ebadcmd[] = "bad command",
|
||||
Ebadvalue[] = "bad value";
|
||||
|
||||
/* Edit s/"([^"]+)"/L\1/g Edit |tr 'a-z' 'A-Z' */
|
||||
/* Edit |sort Edit s/"([^"]+)"/L\1/g Edit |tr 'a-z' 'A-Z' */
|
||||
enum {
|
||||
LNOTURGENT,
|
||||
LURGENT,
|
||||
@ -388,7 +389,7 @@ send_frame(Frame *f, int sym, Bool swap) {
|
||||
insert_frame(fp, f);
|
||||
}
|
||||
|
||||
arrange_column(a, False);
|
||||
arrange_view(f->view);
|
||||
|
||||
flushevents(EnterWindowMask, False);
|
||||
focus_frame(f, True);
|
||||
@ -471,6 +472,7 @@ send_client(View *v, Message *m, Bool swap) {
|
||||
|
||||
flushevents(EnterWindowMask, False);
|
||||
focus_frame(f, True);
|
||||
arrange_view(v);
|
||||
update_views();
|
||||
return nil;
|
||||
}
|
||||
@ -494,6 +496,8 @@ select_frame(Frame *f, int sym) {
|
||||
if(fp == nil)
|
||||
fp = a->frame;
|
||||
break;
|
||||
default:
|
||||
assert(!"can't get here");
|
||||
}
|
||||
|
||||
focus_frame(fp, False);
|
||||
|
@ -30,7 +30,6 @@ struct Framewin {
|
||||
Point pt;
|
||||
int or;
|
||||
int n;
|
||||
int before;
|
||||
};
|
||||
|
||||
static Rectangle
|
||||
@ -63,7 +62,6 @@ frameadjust(Framewin *f, Point pt, int or, int n) {
|
||||
f->or = or;
|
||||
f->n = n;
|
||||
f->pt = pt;
|
||||
reshapewin(f->w, framerect(f));
|
||||
}
|
||||
|
||||
static Framewin*
|
||||
@ -81,6 +79,7 @@ framewin(Frame *f, Point pt, int or, int n) {
|
||||
fw->f = f;
|
||||
fw->gb = f->grabbox;
|
||||
frameadjust(fw, pt, or, n);
|
||||
reshapewin(fw->w, framerect(fw));
|
||||
|
||||
mapwin(fw->w);
|
||||
raisewin(fw->w);
|
||||
@ -136,33 +135,34 @@ vplace(Framewin *fw, Point pt) {
|
||||
int hr;
|
||||
|
||||
v = screen->sel;
|
||||
r = fw->w->r;
|
||||
hr = Dy(r)/2;
|
||||
|
||||
fw->n = pt.y;
|
||||
fw->before = 1;
|
||||
|
||||
for(a = v->area->next; a->next; a = a->next)
|
||||
if(pt.x < a->r.max.x)
|
||||
break;
|
||||
fw->ra = a;
|
||||
|
||||
for(f = a->frame; f->anext; f = f->anext) {
|
||||
if(f == fw->f)
|
||||
fw->before = 0;
|
||||
pt.x = a->r.min.x;
|
||||
frameadjust(fw, pt, OHoriz, Dx(a->r));
|
||||
|
||||
r = fw->w->r;
|
||||
hr = Dy(r)/2;
|
||||
fw->n = pt.y;
|
||||
|
||||
for(f = a->frame; f->anext; f = f->anext)
|
||||
if(pt.y < f->r.max.y)
|
||||
break;
|
||||
}
|
||||
|
||||
if(!f->collapsed) {
|
||||
fw->fp = f;
|
||||
fw->fr = fw->fp->r;
|
||||
|
||||
if(f == fw->f) {
|
||||
fw->fp = f->aprev;
|
||||
fw->fr.max = f->r.max;
|
||||
if(_vsnap(fw, f->r.min.y+hr))
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(_vsnap(fw, f->r.max.y - hr)) {
|
||||
fw->fr.min.y = f->r.max.y - labelh(def.font);
|
||||
goto done;
|
||||
@ -175,26 +175,27 @@ vplace(Framewin *fw, Point pt) {
|
||||
_vsnap(fw, f->r.min.y);
|
||||
else if(_vsnap(fw, f->r.min.y-hr))
|
||||
fw->fp = f->aprev;
|
||||
fw->fr.min.y = fw->n - hr;
|
||||
fw->fr.min.y = pt.y - hr;
|
||||
if(fw->fp && fw->fp->anext == fw->f)
|
||||
fw->fr.max = fw->f->r.max;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(pt.y < f->r.min.y + hr) {
|
||||
fw->n = f->r.min.y;
|
||||
pt.y = f->r.min.y;
|
||||
if(f->aprev && !f->aprev->collapsed)
|
||||
fw->n -= hr;
|
||||
pt.y -= hr;
|
||||
}else {
|
||||
fw->n = f->r.max.y;
|
||||
pt.y = f->r.max.y;
|
||||
if(f->anext == fw->f)
|
||||
fw->n += hr;
|
||||
pt.y += hr;
|
||||
}
|
||||
|
||||
done:
|
||||
pt.x = a->r.min.x;
|
||||
pt.y = fw->n;
|
||||
frameadjust(fw, pt, OHoriz, Dx(a->r));
|
||||
reshapewin(fw->w, framerect(fw));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -222,6 +223,7 @@ hplace(Framewin *fw, Point pt) {
|
||||
|
||||
pt.y = a->r.min.y;
|
||||
frameadjust(fw, pt, OVert, Dy(a->r));
|
||||
reshapewin(fw->w, framerect(fw));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -232,7 +234,7 @@ do_managed_move(Client *c) {
|
||||
Framewin *fw;
|
||||
Window *cwin;
|
||||
Frame *f;
|
||||
Point pt;
|
||||
Point pt, pt2;
|
||||
int y;
|
||||
|
||||
focus(c, False);
|
||||
@ -240,8 +242,9 @@ do_managed_move(Client *c) {
|
||||
|
||||
pt = querypointer(&scr.root);
|
||||
|
||||
pt.x = f->area->r.min.x;
|
||||
fw = framewin(f, pt, OHoriz, Dx(f->area->r));
|
||||
pt2.x = f->area->r.min.x;
|
||||
pt2.y = pt.y;
|
||||
fw = framewin(f, pt2, OHoriz, Dx(f->area->r));
|
||||
|
||||
r = screen->r;
|
||||
r.min.y += fw->gb.min.y + Dy(fw->gb)/2;
|
||||
@ -272,7 +275,7 @@ horiz:
|
||||
case ButtonRelease:
|
||||
switch(ev.xbutton.button) {
|
||||
case 1:
|
||||
if(f->anext && (!f->aprev || (fw->fp != f->aprev && fw->fp != f->aprev->aprev))) {
|
||||
if((f->anext) && (!f->aprev || (fw->fp != f->aprev && fw->fp != f->aprev->aprev))) {
|
||||
f->anext->r.min.y = f->r.min.y;
|
||||
resize_frame(f->anext, f->anext->r);
|
||||
}
|
||||
@ -352,6 +355,11 @@ done:
|
||||
XUngrabPointer(display, CurrentTime);
|
||||
framedestroy(fw);
|
||||
destroywindow(cwin);
|
||||
|
||||
pt = addpt(f->r.min, f->grabbox.min);
|
||||
pt.x += Dx(f->grabbox)/2;
|
||||
pt.y += Dy(f->grabbox)/2;
|
||||
warppointer(pt);
|
||||
}
|
||||
|
||||
static Window *
|
||||
|
@ -171,6 +171,8 @@ void
|
||||
reparentwindow(Window *w, Window *par, Point p) {
|
||||
XReparentWindow(display, w->w, par->w, p.x, p.y);
|
||||
w->parent = par;
|
||||
w->r = rectsubpt(w->r, w->r.min);
|
||||
w->r = rectaddpt(w->r, p);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user