mirror of
https://github.com/0intro/wmii
synced 2024-12-26 05:16:59 +03:00
made effort in debugging most frking bugs
This commit is contained in:
parent
af906b93ec
commit
443ed8370e
@ -13,24 +13,29 @@ static void handle_after_write_area(IXPServer *s, File *file);
|
||||
|
||||
Area *alloc_area(Page *p, char *layout)
|
||||
{
|
||||
char buf[MAX_BUF];
|
||||
char buf[MAX_BUF], *name;
|
||||
Area *a = (Area *) cext_emallocz(sizeof(Area));
|
||||
|
||||
a->page = p;
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s", p->file[P_PREFIX]->name, layout);
|
||||
if (strncmp(layout, "float", 6))
|
||||
name = "managed";
|
||||
else
|
||||
name = "float";
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s", p->file[P_PREFIX]->name, name);
|
||||
a->file[A_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/frame", p->file[P_PREFIX]->name, layout);
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/frame", p->file[P_PREFIX]->name, name);
|
||||
a->file[A_FRAME_PREFIX] = ixp_create(ixps, buf);
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/frame/sel", p->file[P_PREFIX]->name, layout);
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/frame/sel", p->file[P_PREFIX]->name, name);
|
||||
a->file[A_SEL_FRAME] = ixp_create(ixps, buf);
|
||||
a->file[A_SEL_FRAME]->bind = 1;
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/ctl", p->file[P_PREFIX]->name, layout);
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/ctl", p->file[P_PREFIX]->name, name);
|
||||
a->file[A_CTL] = ixp_create(ixps, buf);
|
||||
a->file[A_CTL]->after_write = handle_after_write_area;
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/name", p->file[P_PREFIX]->name, layout);
|
||||
snprintf(buf, MAX_BUF, "/%s/layout/%s/name", p->file[P_PREFIX]->name, name);
|
||||
a->file[A_LAYOUT] = wmii_create_ixpfile(ixps, buf, layout);
|
||||
a->file[A_LAYOUT]->after_write = handle_after_write_area;
|
||||
a->layout = match_layout(layout);
|
||||
fprintf(stderr, "matched '%s' layout\n", a->layout->name);
|
||||
a->layout->init(a, nil);
|
||||
p->file[P_SEL_AREA]->content = a->file[A_PREFIX]->content;
|
||||
return a;
|
||||
|
@ -292,8 +292,11 @@ void attach_client(Client * c)
|
||||
{
|
||||
Area *a = 0;
|
||||
Page *p = pages;
|
||||
|
||||
fprintf(stderr, "%s", "before alloc_page\n");
|
||||
if (!p)
|
||||
p = alloc_page();
|
||||
fprintf(stderr, "%s", "after alloc_page\n");
|
||||
/* transient stuff */
|
||||
a = p->sel;
|
||||
if (c && c->trans) {
|
||||
@ -301,6 +304,7 @@ void attach_client(Client * c)
|
||||
if (t && t->frame)
|
||||
a = p->floating;
|
||||
}
|
||||
fprintf(stderr, "%s", "before layout->attach\n");
|
||||
a->layout->attach(a, c);
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ void init_event_hander()
|
||||
void check_event(Connection * c)
|
||||
{
|
||||
XEvent ev;
|
||||
fprintf(stderr, "%s", "check event\n");
|
||||
while (XPending(dpy)) { /* main evet loop */
|
||||
XNextEvent(dpy, &ev);
|
||||
if (handler[ev.type])
|
||||
@ -63,7 +64,7 @@ static void handle_buttonpress(XEvent * e)
|
||||
Client *c;
|
||||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
Frame *f = win_to_frame(ev->window);
|
||||
/*fprintf(stderr, "%s\n", "handle_buttonpress");*/
|
||||
fprintf(stderr, "%s\n", "handle_buttonpress");
|
||||
|
||||
if (f) {
|
||||
handle_frame_buttonpress(ev, f);
|
||||
@ -106,12 +107,12 @@ static void handle_configurerequest(XEvent * e)
|
||||
Frame *f = 0;
|
||||
|
||||
|
||||
/*fprintf(stderr, "%s\n", "handle_configurerequest");*/
|
||||
fprintf(stderr, "%s\n", "handle_configurerequest");
|
||||
c = win_to_client(ev->window);
|
||||
ev->value_mask &= ~CWSibling;
|
||||
|
||||
if (c) {
|
||||
/* fprintf(stderr, "%s", "configure request client\n"); */
|
||||
fprintf(stderr, "%s", "configure request client\n");
|
||||
f = c->frame;
|
||||
|
||||
if (f) {
|
||||
@ -179,7 +180,7 @@ static void handle_destroynotify(XEvent * e)
|
||||
{
|
||||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||
Client *c = win_to_client(ev->window);
|
||||
/*fprintf(stderr, "%s\n", "handle_destroynotify");*/
|
||||
fprintf(stderr, "%s\n", "handle_destroynotify");
|
||||
if (c) {
|
||||
c->destroyed = True;
|
||||
detach_client(c, False);
|
||||
@ -189,7 +190,7 @@ static void handle_destroynotify(XEvent * e)
|
||||
static void handle_expose(XEvent * e)
|
||||
{
|
||||
static Frame *f;
|
||||
/*fprintf(stderr, "%s\n", "handle_expose");*/
|
||||
fprintf(stderr, "%s\n", "handle_expose");
|
||||
if (e->xexpose.count == 0) {
|
||||
f = win_to_frame(e->xbutton.window);
|
||||
if (f)
|
||||
@ -203,7 +204,7 @@ static void handle_maprequest(XEvent * e)
|
||||
static XWindowAttributes wa;
|
||||
static Client *c;
|
||||
|
||||
/*fprintf(stderr, "%s\n", "handle_maprequest");*/
|
||||
fprintf(stderr, "%s\n", "handle_maprequest");
|
||||
if (!XGetWindowAttributes(dpy, ev->window, &wa))
|
||||
return;
|
||||
if (wa.override_redirect) {
|
||||
@ -225,7 +226,7 @@ static void handle_motionnotify(XEvent * e)
|
||||
{
|
||||
Frame *f = win_to_frame(e->xmotion.window);
|
||||
Cursor cursor;
|
||||
/*fprintf(stderr, "%s\n", "handle_motionnotify");*/
|
||||
fprintf(stderr, "%s\n", "handle_motionnotify");
|
||||
if (f) {
|
||||
cursor = cursor_for_motion(f, e->xmotion.x, e->xmotion.y);
|
||||
if (cursor != f->cursor) {
|
||||
@ -251,7 +252,7 @@ static void handle_unmapnotify(XEvent * e)
|
||||
{
|
||||
XUnmapEvent *ev = &e->xunmap;
|
||||
Client *c;
|
||||
/*fprintf(stderr, "%s\n", "handle_unmapnotify");*/
|
||||
fprintf(stderr, "%s\n", "handle_unmapnotify");
|
||||
handle_ignore_enternotify_crap(e);
|
||||
if ((c = win_to_client(ev->window))) {
|
||||
if (!c->ignore_unmap)
|
||||
@ -269,7 +270,7 @@ static void handle_enternotify(XEvent * e)
|
||||
if ((ev->mode != NotifyNormal) || (ev->detail == NotifyInferior) || (ev->serial == ignore_enternotify_crap))
|
||||
return;
|
||||
|
||||
/*fprintf(stderr, "%s\n", "handle_enternotify");*/
|
||||
fprintf(stderr, "%s\n", "handle_enternotify");
|
||||
c = win_to_client(ev->window);
|
||||
if (c && c->frame) {
|
||||
focus_area(c->frame->area);
|
||||
@ -279,7 +280,7 @@ static void handle_enternotify(XEvent * e)
|
||||
|
||||
static void handle_ignore_enternotify_crap(XEvent *e)
|
||||
{
|
||||
/*fprintf(stderr, "%s\n", "handle_ignore_enternotify_crap");*/
|
||||
fprintf(stderr, "%s\n", "handle_ignore_enternotify_crap");
|
||||
ignore_enternotify_crap = e->xany.serial;
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ void handle_frame_buttonpress(XButtonEvent *e, Frame *f)
|
||||
void attach_client_to_frame(Frame *f, Client *client)
|
||||
{
|
||||
Client *c;
|
||||
wmii_move_ixpfile(c->file[C_PREFIX], f->file[F_CLIENT_PREFIX]);
|
||||
wmii_move_ixpfile(client->file[C_PREFIX], f->file[F_CLIENT_PREFIX]);
|
||||
f->file[F_SEL_CLIENT]->content = client->file[C_PREFIX]->content;
|
||||
for (c = f->clients; c && c->next; c = c->next);
|
||||
if (!c) {
|
||||
@ -294,6 +294,7 @@ void attach_client_to_frame(Frame *f, Client *client)
|
||||
client->next = nil;
|
||||
c->next = client;
|
||||
}
|
||||
f->nclients++;
|
||||
f->sel = client;
|
||||
client->frame = f;
|
||||
resize_frame(f, &f->rect, 0);
|
||||
@ -328,6 +329,7 @@ void detach_client_from_frame(Client *c, Bool unmap)
|
||||
c->next->prev = c->prev;
|
||||
}
|
||||
|
||||
f->nclients--;
|
||||
if (!f->sel)
|
||||
f->sel = f->clients;
|
||||
|
||||
|
@ -313,10 +313,11 @@ static void match_frame_horiz(Column *col, XRectangle *r)
|
||||
|
||||
static void drop_resize(Frame *f, XRectangle *new)
|
||||
{
|
||||
Column *west = 0, *east = 0, *col = f->aux;
|
||||
Cell *north = 0, *south = 0;
|
||||
Column *west = nil, *east = nil, *col = nil;
|
||||
Cell *north = nil, *south = nil;
|
||||
Cell *cell = f->aux;
|
||||
|
||||
col = cell->col;
|
||||
west = col->prev;
|
||||
east = col->next;
|
||||
north = cell->prev;
|
||||
@ -473,8 +474,8 @@ static void swap_frame(void *obj, char *arg)
|
||||
{
|
||||
Area *a = obj;
|
||||
Acme *acme = a->aux;
|
||||
Column *west = 0, *east = 0, *col = acme->sel;
|
||||
Cell *north = 0, *south = 0, *cell = col->sel;
|
||||
Column *west = nil, *east = nil, *col = acme->sel;
|
||||
Cell *north = nil, *south = nil, *cell = col->sel;
|
||||
Frame *f;
|
||||
XRectangle r;
|
||||
|
||||
|
@ -39,6 +39,7 @@ Page *alloc_page()
|
||||
new->file[P_CTL]->after_write = handle_after_write_page;
|
||||
new->floating = alloc_area(new, "float");
|
||||
new->sel = new->managed = alloc_area(new, def[WM_LAYOUT]->content);
|
||||
fprintf(stderr, "%s", "after allocating areas\n");
|
||||
for (p = pages; p && p->next; p = p->next);
|
||||
if (!p)
|
||||
pages = new;
|
||||
@ -47,9 +48,10 @@ Page *alloc_page()
|
||||
p->next = new;
|
||||
}
|
||||
selpage = new;
|
||||
def[WM_SEL_PAGE]->content = p->file[P_PREFIX]->content;
|
||||
fprintf(stderr, "%s", "after attaching page\n");
|
||||
def[WM_SEL_PAGE]->content = new->file[P_PREFIX]->content;
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
return p;
|
||||
return new;
|
||||
}
|
||||
|
||||
void destroy_page(Page *p)
|
||||
|
@ -469,8 +469,11 @@ void scan_wins()
|
||||
if (wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
|
||||
continue;
|
||||
if (wa.map_state == IsViewable) {
|
||||
fprintf(stderr, "%s", "before alloc_client\n");
|
||||
c = alloc_client(wins[i]);
|
||||
fprintf(stderr, "%s", "before init_client\n");
|
||||
init_client(c, &wa);
|
||||
fprintf(stderr, "%s", "before attach_client\n");
|
||||
attach_client(c);
|
||||
c->ignore_unmap++; /* was viewable already */
|
||||
}
|
||||
@ -798,9 +801,13 @@ int main(int argc, char *argv[])
|
||||
init_default();
|
||||
font = blitz_getfont(dpy, def[WM_FONT]->content);
|
||||
wmii_init_lock_modifiers(dpy, &valid_mask, &num_lock_mask);
|
||||
fprintf(stderr, "%s", "default stuff\n");
|
||||
init_screen();
|
||||
fprintf(stderr, "%s", "screen stuff\n");
|
||||
init_layouts();
|
||||
fprintf(stderr, "%s", "layout stuff\n");
|
||||
scan_wins();
|
||||
fprintf(stderr, "%s", "scan wins\n");
|
||||
|
||||
/* main event loop */
|
||||
run_server_with_fd_support(ixps, ConnectionNumber(dpy), check_event, 0);
|
||||
|
@ -138,8 +138,8 @@ static void bind(void *obj, char *arg)
|
||||
new->mount = ixp_create(ixps, new->prefix);
|
||||
new->mount->content = new->mount; /* shall be a directory */
|
||||
|
||||
if (bindings)
|
||||
bindings = b;
|
||||
if (!bindings)
|
||||
bindings = new;
|
||||
else {
|
||||
for (b = bindings; b && b->next; b = b->next);
|
||||
b->next = new;
|
||||
|
@ -120,7 +120,7 @@ wmiir write /wm/event/pageupdate \
|
||||
'wmiir write /bar/'^$plab^'/data `{wmiir read /wm/sel/name} &&' ^ \
|
||||
'wmiir write /bar/'^$llab^'/data `{wmiir read /wm/sel/layout/sel/name}'
|
||||
|
||||
for(layout in `{wmiir read /wm/sel/layout/ | grep '^[0-9]'})
|
||||
for(layout in /wm/sel/layout/float /wm/sel/layout/managed)
|
||||
framesconf /wm/sel/layout/$layout/frame refresh
|
||||
frameconf /wm/default norefresh
|
||||
|
||||
@ -138,7 +138,7 @@ kbind normal $MODKEY-t 'extern xterm ''+sb'' -bg ''#000000'' -fg ''#ffffff'' -cr
|
||||
kbind normal $MODKEY-d 'wmiir write /wm/ctl detach'
|
||||
kbind normal $MODKEY-a 'wmiir write /wm/ctl attach'
|
||||
kbind normal $MODKEY-S-a 'wmiir write /wm/ctl detached_clients'
|
||||
kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layout/1/name column'
|
||||
kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layout/manage/name column'
|
||||
kbind normal $MODKEY-n 'wmiir write /wm/sel/layout/sel/ctl new'
|
||||
kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layout/sel/name float'
|
||||
kbind normal $MODKEY-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap west'''
|
||||
|
Loading…
Reference in New Issue
Block a user