X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=ef20ce07bc6d93cd1a89fd811f1c45e8897b7e2f;hb=a261181f039ffb676413787097afee615f371099;hp=6f83f62a1983529edd3d20ad69912d55b4926ffa;hpb=7b36e544be9ab6bf15f55c438f56e19c264eb2e5;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 6f83f62..ef20ce0 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -637,6 +637,7 @@ map_window_raised(xcb_window_t win) XCB_CONFIG_WINDOW_STACK_MODE, &val); xcb_map_window(conn, win); + xcb_flush(conn); } xcb_atom_t @@ -1122,9 +1123,10 @@ xrandr_geteventname(XEvent *e) void dumpwins(struct swm_region *r, union arg *args) { - struct ws_win *win; - uint16_t state; - XWindowAttributes wa; + struct ws_win *win; + uint16_t state; + xcb_get_window_attributes_cookie_t c; + xcb_get_window_attributes_reply_t *r; if (r->ws == NULL) { warnx("dumpwins: invalid workspace"); @@ -1132,26 +1134,33 @@ dumpwins(struct swm_region *r, union arg *args) } warnx("=== managed window list ws %02d ===", r->ws->idx); - TAILQ_FOREACH(win, &r->ws->winlist, entry) { state = getstate(win->id); - if (!XGetWindowAttributes(display, win->id, &wa)) - warnx("window: 0x%lx, failed XGetWindowAttributes", + c = xcb_get_window_attributes(conn, win->id); + r = xcb_get_window_attributes_reply(conn, c, NULL); + if (r) { + warnx("window: 0x%x, map_state: %d, state: %u, " + "transient: 0x%x", win->id, wa.map_state, + state, win->transient); + free(r); + } else + warnx("window: 0x%x, failed xcb_get_window_attributes", win->id); - warnx("window: 0x%lx, map_state: %d, state: %u, " - "transient: 0x%lx", win->id, wa.map_state, state, - win->transient); } warnx("===== unmanaged window list ====="); TAILQ_FOREACH(win, &r->ws->unmanagedlist, entry) { state = getstate(win->id); - if (!XGetWindowAttributes(display, win->id, &wa)) + c = xcb_get_window_attributes(conn, win->id); + r xcb_get_window_attributes_reply(conn, c, NULL); + if (r) { + warnx("window: 0x%lx, map_state: %d, state: %u, " + "transient: 0x%lx", win->id, wa.map_state, + state, win->transient); + free(r); + } else warnx("window: 0x%lx, failed XGetWindowAttributes", win->id); - warnx("window: 0x%lx, map_state: %d, state: %u, " - "transient: 0x%lx", win->id, wa.map_state, state, - win->transient); } warnx("================================="); @@ -7552,7 +7561,6 @@ main(int argc, char *argv[]) int xfd, i, num_screens; fd_set rd; struct sigaction sact; - xcb_generic_event_t *evt; start_argv = argv; warnx("Welcome to spectrwm V%s Build: %s", SPECTRWM_VERSION, buildstr); @@ -7674,7 +7682,7 @@ noconfig: xfd = xcb_get_file_descriptor(conn); while (running) { - while ((evt = xcb_poll_for_event(conn)) == 0) { + while (XPending(display)) { XNextEvent(display, &e); if (running == 0) goto done;