Skip to content

Commit

Permalink
Flush pending requests synchronously
Browse files Browse the repository at this point in the history
xcb_flush() forces flushing requests and then returns, while
xcb_aux_sync() waits for the server before returning, meaning the calls
will be done synchronously.
  • Loading branch information
z3bra committed Jan 25, 2017
1 parent 49d23ae commit dd268ec
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 13 deletions.
7 changes: 4 additions & 3 deletions chwb.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
Expand Down Expand Up @@ -44,7 +45,7 @@ set_border(int width, int color, xcb_window_t win)
mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_BORDER_WIDTH ;
xcb_configure_window(conn, win, mask, values);

xcb_flush(conn);
xcb_aux_sync(conn);

free(geom);
}
Expand All @@ -54,7 +55,7 @@ set_border(int width, int color, xcb_window_t win)
mask = XCB_CW_BORDER_PIXEL;
xcb_change_window_attributes(conn, win, mask, values);

xcb_flush(conn);
xcb_aux_sync(conn);
}
}

Expand Down Expand Up @@ -87,7 +88,7 @@ main(int argc, char **argv)
while (*argv)
set_border(width, color, strtoul(*argv++, NULL, 16));

xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);

Expand Down
3 changes: 2 additions & 1 deletion chwso.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
Expand Down Expand Up @@ -58,7 +59,7 @@ main(int argc, char **argv)
} ARGEND

stack(win, values);
xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);

Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ CC = cc
LD = $(CC)

CFLAGS = -std=c99 -pedantic -Wall -Os
LDFLAGS = -lxcb
LDFLAGS = -lxcb -lxcb-util

3 changes: 2 additions & 1 deletion ignw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdlib.h>
#include <err.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "arg.h"
#include "util.h"
Expand Down Expand Up @@ -46,7 +47,7 @@ main(int argc, char **argv)
while (*argv)
set_override(strtoul(*argv++, NULL, 16), setflag);

xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);

Expand Down
3 changes: 2 additions & 1 deletion killw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdlib.h>
#include <err.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "arg.h"
#include "util.h"
Expand Down Expand Up @@ -46,7 +47,7 @@ main(int argc, char **argv)
}
}

xcb_flush(conn);
xcb_aux_sync(conn);
kill_xcb(&conn);

return 0;
Expand Down
1 change: 1 addition & 0 deletions lsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdlib.h>
#include <err.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "arg.h"
#include "util.h"
Expand Down
3 changes: 2 additions & 1 deletion mapw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdlib.h>
#include <err.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "arg.h"
#include "util.h"
Expand Down Expand Up @@ -62,7 +63,7 @@ main(int argc, char **argv)
break;
}
}
xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);

Expand Down
1 change: 1 addition & 0 deletions pfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "util.h"

Expand Down
1 change: 1 addition & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "util.h"

Expand Down
1 change: 1 addition & 0 deletions wattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string.h>
#include <err.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "util.h"

Expand Down
3 changes: 2 additions & 1 deletion wmp.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
Expand Down Expand Up @@ -84,7 +85,7 @@ main(int argc, char **argv)
usage(argv0);
}

xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);
return 0;
Expand Down
3 changes: 2 additions & 1 deletion wmv.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdio.h>
#include <stdlib.h>
#include <err.h>
Expand Down Expand Up @@ -91,7 +92,7 @@ main(int argc, char **argv)
while (*argv)
move(strtoul(*argv++, NULL, 16), mode, x, y);

xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);

Expand Down
3 changes: 2 additions & 1 deletion wrs.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdio.h>
#include <stdlib.h>
#include <err.h>
Expand Down Expand Up @@ -84,7 +85,7 @@ main(int argc, char **argv)
while (*argv)
resize(strtoul(*argv++, NULL, 16), mode, x, y);

xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);

Expand Down
3 changes: 2 additions & 1 deletion wtf.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -35,7 +36,7 @@ main(int argc, char **argv)
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, win,
XCB_CURRENT_TIME);

xcb_flush(conn);
xcb_aux_sync(conn);
}

kill_xcb(&conn);
Expand Down
3 changes: 2 additions & 1 deletion wtp.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
Expand Down Expand Up @@ -52,7 +53,7 @@ main(int argc, char **argv)

teleport(win, atoi(argv[1]), atoi(argv[2]),
atoi(argv[3]), atoi(argv[4]));
xcb_flush(conn);
xcb_aux_sync(conn);

kill_xcb(&conn);

Expand Down

0 comments on commit dd268ec

Please sign in to comment.