win->parent = win_find(dpy, trans, 0);
XSelectInput(dpy, xid, PropertyChangeMask);
-
- wm_insert(win);
}
- printf("win_new: %p = %p, %d (%d,%d %dx%d) - %s\n",
- win, dpy, (int)xid,
+ printf("win_new: win=%p x11=(%p,%d) state=%x pos=(%d,%d %dx%d) type=%s\n",
+ win, dpy, (int)xid, win->state,
win->x, win->y, win->w, win->h,
- win->type == TYPE_NORMAL ? "normal" :
- win->type == TYPE_DIALOG ? "dialog" :
- win->type == TYPE_TOOLBAR ? "normal" : "unknown");
+ win->type == TYPE_NORMAL ? "normal" :
+ win->type == TYPE_DIALOG ? "dialog" :
+ win->type == TYPE_TOOLBAR ? "toolbar" : "unknown");
+
+ if (root)
+ wm_insert(win);
return win;
}
return 0;
XSendEvent(win->sys->dpy, win->sys->xid, False, NoEventMask, &(XEvent){
- .type = ClientMessage,
+ .xclient.type = ClientMessage,
.xclient.window = win->sys->xid,
.xclient.message_type = atoms[WM_PROTO],
.xclient.format = 32,
if (type == KeyPress) {
while (XCheckTypedEvent(dpy, KeyPress, xe));
KeySym sym = XLookupKeysym(&xe->xkey, 0);
- printf("got xe %c %hhx\n", xk2ev(sym), mod2int(mod));
+ //printf("got xe %c %hhx\n", xk2ev(sym), mod2int(mod));
wm_handle_event(win, xk2ev(sym), mod, ptr);
}
else if (type == KeyRelease) {
else if (type == UnmapNotify) {
if ((win = win_find(dpy,xe->xunmap.window,0)) &&
win->state != ST_HIDE) {
+ printf("unmap: %lx\n", xe->xunmap.window);
wm_handle_state(win, win->state, ST_HIDE);
win->state = ST_HIDE;
}
printf("map_req: %lx\n", xe->xmaprequest.window);
win = win_find(dpy,xe->xmaprequest.window,1);
// fixme, for hide -> max, etc
- if (win->state == ST_HIDE)
+ if (win->state == ST_HIDE) {
+ wm_handle_state(win, win->state, ST_SHOW);
win->state = ST_SHOW;
+ }
sys_show(win, win->state);
}
else if (type == ClientMessage) {
state_t next = (cme->data.l[0] == 1 || /* _NET_WM_STATE_ADD */
(cme->data.l[0] == 2 && /* _NET_WM_STATE_TOGGLE */
win->state != ST_FULL)) ? ST_FULL : ST_SHOW;
+ printf("client_msg: fullscreen %x -> %x", win->state, next);
wm_handle_state(win, win->state, next);
sys_show(win, next);
}
}
else if (type == PropertyNotify) {
- printf("prop: %d\n", xe->xproperty.state);
+ printf("prop: %lx - %d\n", xe->xproperty.window, xe->xproperty.state);
}
else {
printf("unknown event: %d\n", type);
void sys_focus(win_t *win)
{
- printf("sys_focus: %p\n", win);
+ //printf("sys_focus: %p\n", win);
/* Set actual focus */
XSetInputFocus(win->sys->dpy, win->sys->xid,
RevertToPointerRoot, CurrentTime);
- win_msg(win, WM_FOCUS);
+ //win_msg(win, WM_FOCUS);
/* Set border on focused window */
static win_t *last = NULL;
}
XSetWindowBorderWidth(win->sys->dpy, win->sys->xid, 0);
XMapWindow(win->sys->dpy, win->sys->xid);
+ XConfigureWindow(win->sys->dpy, win->sys->xid,
+ CWX|CWY|CWWidth|CWHeight, &(XWindowChanges) {
+ .x = win->x,
+ .y = win->y,
+ .width = win->w,
+ .height = win->h,
+ });
XMoveResizeWindow(win->sys->dpy, win->sys->xid,
screen->x - screen->sys->strut.left,
screen->y - screen->sys->strut.top,
XSetErrorHandler(xerror);
XUngrabServer(win->sys->dpy);
}
- XDestroyWindow(win->sys->dpy, win->sys->xid);
break;
}
win->state = state;