Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check cairo supports x11 server #4434

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,19 @@ int main(int argc, char *argv[]) {
I3_REST_ATOMS_XMACRO
#undef xmacro

/* Check if cairo supports this X11 server */
{
cairo_surface_t *surface = cairo_xcb_surface_create(conn, root, get_visualtype_by_id(root_screen->root_visual), root_screen->width_in_pixels, root_screen->height_in_pixels);
cairo_status_t status = cairo_surface_status(surface);
cairo_surface_destroy(surface);

if (status != CAIRO_STATUS_SUCCESS) {
ELOG("Cairo does not support this X11 setup!\n");
ELOG("Trying to draw to the root window resulted in error %d: %s.\n", status, cairo_status_to_string(status));
exit(-1);
}
}

load_configuration(override_configpath, C_LOAD);

if (config.ipc_socket_path == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion testcases/complete-run.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ if ($options{xvfb}) {
# parent when ready, so that the wait call will be interrupted. We
# can’t implement this in Perl, as Perl’s waitpid transparently
# handles -EINTR.
exec('/bin/sh', '-c', qq|trap "exit" INT; trap : USR1; (trap '' USR1; exec Xvfb :$n -screen 0 640x480x8 -nolisten tcp) & PID=\$!; wait; if ! kill -0 \$PID 2>/dev/null; then echo 1:\$PID > $path; else echo 0:\$PID > $path; wait \$PID; fi|);
exec('/bin/sh', '-c', qq|trap "exit" INT; trap : USR1; (trap '' USR1; exec Xvfb :$n -screen 0 640x480x24 -nolisten tcp) & PID=\$!; wait; if ! kill -0 \$PID 2>/dev/null; then echo 1:\$PID > $path; else echo 0:\$PID > $path; wait \$PID; fi|);
die "exec: $!";
}
chomp(my $kill = slurp($path));
Expand Down