X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=547e7b291a884fd6e247110b982d2628ff387874;hb=cff561c10b29b2c3e5eab100c5f35446b69c25fa;hp=fe52b18cb8b4af1b2b4a1821b5dd829a1395caa1;hpb=7552391bb7b55cab35fe57f1ddd9f6c0338495a7;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index fe52b18..547e7b2 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -628,8 +628,23 @@ void spawn_select(struct swm_region *, union arg *, char *, int *); unsigned char *get_win_name(xcb_window_t); xcb_atom_t get_atom_from_string(const char *); void map_window_raised(xcb_window_t); +void do_sync(void); void +do_sync(void) +{ + xcb_get_input_focus_cookie_t c; + xcb_get_input_focus_reply_t *r; + + /* mimic XSync() */ + c = xcb_get_input_focus(conn); + xcb_flush(conn); + r = xcb_get_input_focus_reply(conn, c, NULL); + if (r) + free(r); +} + +void map_window_raised(xcb_window_t win) { uint32_t val = XCB_STACK_MODE_ABOVE; @@ -4386,14 +4401,14 @@ resize(struct ws_win *win, union arg *args) /* not free, don't sync more than 120 times / second */ if ((ev.xmotion.time - time) > (1000 / 120) ) { time = ev.xmotion.time; - XSync(display, False); + do_sync(); update_window(win); } break; } } while (ev.type != ButtonRelease); if (time) { - XSync(display, False); + do_sync(); update_window(win); } store_float_geom(win,r); @@ -4512,14 +4527,14 @@ move(struct ws_win *win, union arg *args) /* not free, don't sync more than 120 times / second */ if ((ev.xmotion.time - time) > (1000 / 120) ) { time = ev.xmotion.time; - XSync(display, False); + do_sync(); update_window(win); } break; } } while (ev.type != ButtonRelease); if (time) { - XSync(display, False); + do_sync(); update_window(win); } store_float_geom(win, r); @@ -7186,12 +7201,12 @@ active_wm(void) /* this causes an error if some other window manager is running */ XSelectInput(display, DefaultRootWindow(display), SubstructureRedirectMask); - XSync(display, False); + do_sync(); if (other_wm) return (1); XSetErrorHandler(xerror); - XSync(display, False); + do_sync(); return (0); }