printf("configure_req: %d - %x, (0x%lx) %dx%d @ %d,%d\n",
type, (int)cre->window, cre->value_mask,
cre->height, cre->width, cre->x, cre->y);
- XConfigureWindow(dpy, cre->window, cre->value_mask, &(XWindowChanges){
- .x = cre->x,
- .y = cre->y,
- .width = cre->width,
- .height = cre->height,
- });
-
- /* This seems necessary for, but causes flicker
- * there could be a better way to do this */
- if ((win = win_find(dpy,xe->xmaprequest.window,0)))
- sys_move(win, win->x, win->y, win->w, win->h);
+ if ((win = win_find(dpy,xe->xmaprequest.window,1))) {
+ XSendEvent(dpy, cre->window, False, StructureNotifyMask, &(XEvent){
+ .xconfigure.type = ConfigureNotify,
+ .xconfigure.display = win->sys->dpy,
+ .xconfigure.event = win->sys->xid,
+ .xconfigure.window = win->sys->xid,
+ .xconfigure.x = win->x,
+ .xconfigure.y = win->y,
+ .xconfigure.width = win->w,
+ .xconfigure.height = win->h,
+ });
+ XSync(win->sys->dpy, False);
+ }
}
else if (type == MapRequest) {
printf("map_req: %d\n", type);
else
wm_update();
}
- XMapWindow(dpy,xe->xmaprequest.window);
+ XMapWindow(dpy, xe->xmaprequest.window);
}
else {
printf("unknown event: %d\n", type);
*******************************/
void wm_update(void)
{
+ /* Updates window sizes */
+ for (list_t *ldpy = wm_tag->dpys; ldpy; ldpy = ldpy->next)
+ wm_update_cols(ldpy->data);
+ tag_foreach_flt(wm_tag, ldpy, lflt, win) {
+ flt_t *flt = lflt->data;
+ sys_move(win, flt->x, flt->y, flt->w, flt->h);
+ sys_raise(flt->win);
+ }
+
/* Show/hide tags */
tag_foreach_col(wm_tag, dpy, col, row, win)
sys_show(win, ROW(row)->state);
sys_show(win, ST_HIDE);
}
- /* Refresh the display */
- for (list_t *ldpy = wm_tag->dpys; ldpy; ldpy = ldpy->next)
- wm_update_cols(ldpy->data);
- tag_foreach_flt(wm_tag, ldpy, lflt, win) {
- flt_t *flt = lflt->data;
- sys_move(win, flt->x, flt->y, flt->w, flt->h);
- sys_raise(flt->win);
- }
+ /* Set focused window */
if (wm_focus)
set_focus(wm_focus);
}