...
 
Commits (28)
......@@ -32,6 +32,7 @@
#include <math.h>
#include <assert.h>
#include <getopt.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -290,7 +291,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -34,6 +34,7 @@
#include <assert.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -328,7 +329,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -45,6 +45,7 @@
#include <cairo.h>
#include <float.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -621,7 +622,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -34,6 +34,7 @@
#include <math.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -490,7 +491,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -212,7 +212,7 @@ panel_launcher_activate(struct panel_launcher *widget)
pid = fork();
if (pid < 0) {
fprintf(stderr, "fork failed: %m\n");
fprintf(stderr, "fork failed: %s\n", strerror(errno));
return;
}
......@@ -225,7 +225,8 @@ panel_launcher_activate(struct panel_launcher *widget)
exit(EXIT_FAILURE);
if (execve(argv[0], argv, widget->envp.data) < 0) {
fprintf(stderr, "execl '%s' failed: %m\n", argv[0]);
fprintf(stderr, "execl '%s' failed: %s\n", argv[0],
strerror(errno));
exit(1);
}
}
......@@ -1519,7 +1520,8 @@ int main(int argc, char *argv[])
desktop.display = display_create(&argc, argv);
if (desktop.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -35,6 +35,7 @@
#include <cairo.h>
#include <sys/epoll.h>
#include <stdbool.h>
#include <errno.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
......@@ -848,7 +849,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -580,7 +580,7 @@ data_source_send(void *data,
struct editor *editor = data;
if (write(fd, editor->selected_text, strlen(editor->selected_text) + 1) < 0)
fprintf(stderr, "write failed: %m\n");
fprintf(stderr, "write failed: %s\n", strerror(errno));
close(fd);
}
......@@ -1609,7 +1609,8 @@ main(int argc, char *argv[])
text_buffer = read_file(argv[1]);
if (text_buffer == NULL) {
fprintf(stderr, "could not read file '%s': %m\n", argv[1]);
fprintf(stderr, "could not read file '%s': %s\n",
argv[1], strerror(errno));
return -1;
}
}
......@@ -1618,7 +1619,8 @@ main(int argc, char *argv[])
editor.display = display_create(&argc, argv);
if (editor.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
free(text_buffer);
return -1;
}
......
......@@ -37,6 +37,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <cairo.h>
......@@ -515,14 +517,16 @@ main(int argc, char *argv[])
/* Connect to the display and have the arguments parsed */
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
/* Create new eventdemo window */
e = eventdemo_create(d);
if (e == NULL) {
fprintf(stderr, "failed to create eventdemo: %m\n");
fprintf(stderr, "failed to create eventdemo: %s\n",
strerror(errno));
return -1;
}
......
......@@ -30,6 +30,7 @@
#include <time.h>
#include <math.h>
#include <cairo.h>
#include <errno.h>
#include <sys/time.h>
#include <linux/input.h>
......@@ -172,7 +173,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -30,6 +30,7 @@
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <cairo.h>
#include <linux/input.h>
......@@ -518,7 +519,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -30,6 +30,7 @@
#include <string.h>
#include <math.h>
#include <time.h>
#include <errno.h>
#include <GL/gl.h>
#include <EGL/egl.h>
......@@ -488,7 +489,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
gears = gears_create(d);
......
......@@ -36,6 +36,7 @@
#include <time.h>
#include <cairo.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -419,7 +420,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -35,6 +35,7 @@
#include <signal.h>
#include <sys/mman.h>
#include <getopt.h>
#include <errno.h>
#include <wayland-cursor.h>
#include <wayland-client-protocol.h>
#include "shared/cairo-util.h"
......@@ -806,8 +807,8 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return ;
}
......@@ -815,7 +816,7 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (MAP_FAILED == p_wlCtx->data) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return;
}
......@@ -828,7 +829,8 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
WL_SHM_FORMAT_ARGB8888);
if (NULL == p_wlCtx->wlBuffer) {
fprintf(stderr, "wl_shm_create_buffer failed: %m\n");
fprintf(stderr, "wl_shm_create_buffer failed: %s\n",
strerror(errno));
close(fd);
return;
}
......
......@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <linux/input.h>
#include <cairo.h>
......@@ -1019,7 +1020,8 @@ main(int argc, char *argv[])
virtual_keyboard.display = display_create(&argc, argv);
if (virtual_keyboard.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -236,7 +236,7 @@ demo_clients = [
text_input_unstable_v1_client_protocol_h,
text_input_unstable_v1_protocol_c,
],
'deps': [ 'pangocairo' ]
'deps': [ 'pangocairo', 'gobject-2.0' ]
},
{ 'basename': 'eventdemo' },
{ 'basename': 'flower' },
......
......@@ -35,7 +35,7 @@
#include <sys/mman.h>
#include <signal.h>
#include <time.h>
#include <sys/poll.h>
#include <poll.h>
#include <float.h>
#include <math.h>
......@@ -97,8 +97,8 @@ attach_buffer(struct window *window, int width, int height)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
......@@ -296,6 +296,8 @@ static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
/* Just so we don’t leak the keymap fd */
close(fd);
}
static void
......
......@@ -34,6 +34,7 @@
#include <sys/epoll.h>
#include <sys/socket.h>
#include <unistd.h>
#include <errno.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
......@@ -330,8 +331,8 @@ launch_client(struct nested *nested, const char *path)
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
fprintf(stderr, "launch_client: "
"socketpair failed while launching '%s': %m\n",
path);
"socketpair failed while launching '%s': %s\n",
path, strerror(errno));
free(client);
return NULL;
}
......@@ -342,7 +343,8 @@ launch_client(struct nested *nested, const char *path)
close(sv[1]);
free(client);
fprintf(stderr, "launch_client: "
"fork failed while launching '%s': %m\n", path);
"fork failed while launching '%s': %s\n", path,
strerror(errno));
return NULL;
}
......@@ -354,7 +356,8 @@ launch_client(struct nested *nested, const char *path)
* get a non-CLOEXEC fd to pass through exec. */
clientfd = dup(sv[1]);
if (clientfd == -1) {
fprintf(stderr, "compositor: dup failed: %m\n");
fprintf(stderr, "compositor: dup failed: %s\n",
strerror(errno));
exit(-1);
}
......@@ -363,8 +366,8 @@ launch_client(struct nested *nested, const char *path)
execl(path, path, NULL);
fprintf(stderr, "compositor: executing '%s' failed: %m\n",
path);
fprintf(stderr, "compositor: executing '%s' failed: %s\n",
path, strerror(errno));
exit(-1);
}
......@@ -1116,7 +1119,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -35,6 +35,7 @@
#include <sys/mman.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
#include <wayland-client.h>
#include "shared/helpers.h"
......@@ -141,14 +142,14 @@ create_shm_buffers(struct display *display, struct buffer **buffers,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return -1;
}
......@@ -480,7 +481,7 @@ window_emulate_rendering(struct window *window)
ret = nanosleep(&delay, NULL);
if (ret)
printf("nanosleep failed: %m\n");
printf("nanosleep failed: %s\n", strerror(errno));
}
static void
......
......@@ -31,6 +31,7 @@
#include <cairo.h>
#include <math.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -439,7 +440,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <cairo.h>
#include <linux/input.h>
......@@ -288,7 +289,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -173,14 +173,14 @@ screenshot_create_shm_buffer(int width, int height, void **data_out,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return NULL;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return NULL;
}
......@@ -286,7 +286,8 @@ int main(int argc, char *argv[])
display = wl_display_connect(NULL);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -35,6 +35,7 @@
#include <sys/mman.h>
#include <sys/time.h>
#include <signal.h>
#include <errno.h>
#include <wayland-client.h>
#include "shared/os-compatibility.h"
......@@ -123,14 +124,14 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return -1;
}
......
......@@ -293,7 +293,7 @@ create_fbo_for_buffer(struct display *display, struct buffer *buffer)
EGL_NO_CONTEXT,
EGL_LINUX_DMA_BUF_EXT,
NULL, attribs);
if (buffer->egl_image == EGL_NO_IMAGE) {
if (buffer->egl_image == EGL_NO_IMAGE_KHR) {
fprintf(stderr, "EGLImageKHR creation failed\n");
return false;
}
......@@ -369,9 +369,17 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer,
#ifdef HAVE_GBM_MODIFIERS
buffer->plane_count = gbm_bo_get_plane_count(buffer->bo);
for (i = 0; i < buffer->plane_count; ++i) {
uint32_t handle = gbm_bo_get_handle_for_plane(buffer->bo, i).u32;
int ret = drmPrimeHandleToFD(display->gbm.drm_fd, handle, 0,
&buffer->dmabuf_fds[i]);
int ret;
union gbm_bo_handle handle;
handle = gbm_bo_get_handle_for_plane(buffer->bo, i);
if (handle.s32 == -1) {
fprintf(stderr, "error: failed to get gbm_bo_handle\n");
goto error;
}
ret = drmPrimeHandleToFD(display->gbm.drm_fd, handle.u32, 0,
&buffer->dmabuf_fds[i]);
if (ret < 0 || buffer->dmabuf_fds[i] < 0) {
fprintf(stderr, "error: failed to get dmabuf_fd\n");
goto error;
......
......@@ -640,6 +640,8 @@ static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
/* Just so we don’t leak the keymap fd */
close(fd);
}
static void
......
......@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <linux/input.h>
......@@ -490,7 +491,8 @@ main(int argc, char *argv[])
simple_im.display = wl_display_connect(NULL);
if (simple_im.display == NULL) {
fprintf(stderr, "Failed to connect to server: %m\n");
fprintf(stderr, "Failed to connect to server: %s\n",
strerror(errno));
return -1;
}
......@@ -516,7 +518,7 @@ main(int argc, char *argv[])
ret = wl_display_dispatch(simple_im.display);
if (ret == -1) {
fprintf(stderr, "Dispatch error: %m\n");
fprintf(stderr, "Dispatch error: %s\n", strerror(errno));
return -1;
}
......
......@@ -33,6 +33,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <signal.h>
#include <errno.h>
#include <wayland-client.h>
#include "shared/os-compatibility.h"
......@@ -98,14 +99,14 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return -1;
}
......
......@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <wayland-client.h>
......@@ -70,15 +71,15 @@ create_shm_buffer(struct touch *touch)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
exit(1);
}
touch->data =
mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (touch->data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
exit(1);
}
......
......@@ -29,6 +29,7 @@
#include <string.h>
#include <time.h>
#include <math.h>
#include <errno.h>
#include <cairo.h>
#include <wayland-client.h>
......@@ -273,7 +274,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <errno.h>
#include <linux/input.h>
#include <cairo.h>
......@@ -290,7 +291,8 @@ main(int argc, char *argv[])
stacking.display = display_create(&argc, argv);
if (stacking.display == NULL) {
fprintf(stderr, "Failed to create display: %m\n");
fprintf(stderr, "Failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -32,6 +32,7 @@
#include <cairo.h>
#include <math.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -788,7 +789,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -2207,10 +2207,29 @@ data_source_cancelled(void *data, struct wl_data_source *source)
wl_data_source_destroy(source);
}
static void
data_source_dnd_drop_performed(void *data, struct wl_data_source *source)
{
}
static void
data_source_dnd_finished(void *data, struct wl_data_source *source)
{
}
static void
data_source_action(void *data,
struct wl_data_source *source, uint32_t dnd_action)
{
}
static const struct wl_data_source_listener data_source_listener = {
data_source_target,
data_source_send,
data_source_cancelled
data_source_cancelled,
data_source_dnd_drop_performed,
data_source_dnd_finished,
data_source_action
};
static const char text_mime_type[] = "text/plain;charset=utf-8";
......@@ -3068,11 +3087,12 @@ terminal_run(struct terminal *terminal, const char *path)
setenv("TERM", option_term, 1);
setenv("COLORTERM", option_term, 1);
if (execl(path, path, NULL)) {
printf("exec failed: %m\n");
printf("exec failed: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
} else if (pid < 0) {
fprintf(stderr, "failed to fork and create pty (%m).\n");
fprintf(stderr, "failed to fork and create pty (%s).\n",
strerror(errno));
return -1;
}
......@@ -3139,7 +3159,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <cairo.h>
#include <linux/input.h>
......@@ -263,7 +264,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -276,8 +276,8 @@ setup_out_fd(const char *output, const char *outfd)
O_WRONLY | O_APPEND | O_CREAT, 0644);
if (fd < 0) {
fprintf(stderr,
"Error: opening file '%s' failed: %m\n",
output);
"Error: opening file '%s' failed: %s\n",
output, strerror(errno));
}
return fd;
}
......@@ -290,7 +290,8 @@ setup_out_fd(const char *output, const char *outfd)
flags = fcntl(fd, F_GETFL);
if (flags == -1) {
fprintf(stderr,
"Error: cannot use file descriptor %d: %m\n", fd);
"Error: cannot use file descriptor %d: %s\n", fd,
strerror(errno));
return -1;
}
......@@ -432,7 +433,8 @@ main(int argc, char **argv)
app.dpy = wl_display_connect(NULL);
if (!app.dpy) {
fprintf(stderr, "Error: Could not connect to Wayland display: %m\n");
fprintf(stderr, "Error: Could not connect to Wayland display: %s\n",
strerror(errno));
ret = 1;
goto out_parse;
}
......
......@@ -32,6 +32,7 @@
#include <time.h>
#include <assert.h>
#include <ctype.h>
#include <unistd.h>
#include <wayland-client.h>
......@@ -463,6 +464,8 @@ static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
/* Just so we don’t leak the keymap fd */
close(fd);
}
static void
......@@ -1853,7 +1856,8 @@ main(int argc, char **argv)
info.display = wl_display_connect(NULL);
if (!info.display) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -740,14 +740,14 @@ make_shm_pool(struct display *display, int size, void **data)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return NULL;
}
*data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (*data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return NULL;
}
......@@ -3922,8 +3922,9 @@ offer_io_func(struct task *task, uint32_t events)
offer->x, offer->y, offer->user_data);
if (len == 0) {
if (display->data_device_manager_version >=
WL_DATA_OFFER_FINISH_SINCE_VERSION)
if ((offer != offer->input->selection_offer) &&
(display->data_device_manager_version >=
WL_DATA_OFFER_FINISH_SINCE_VERSION))
wl_data_offer_finish(offer->offer);
close(offer->fd);
data_offer_destroy(offer);
......@@ -5828,6 +5829,29 @@ display_add_input(struct display *d, uint32_t id, int display_seat_version)
keyboard_repeat_func);
}
static void
display_add_data_device(struct display *d, uint32_t id, int ddm_version)
{
struct input *input;
d->data_device_manager_version = MIN(ddm_version, 3);
d->data_device_manager =
wl_registry_bind(d->registry, id,
&wl_data_device_manager_interface,
d->data_device_manager_version);
wl_list_for_each(input, &d->input_list, link) {
if (!input->data_device) {
input->data_device =
wl_data_device_manager_get_data_device(d->data_device_manager,
input->seat);
wl_data_device_add_listener(input->data_device,
&data_device_listener,
input);
}
}
}
static void
input_destroy(struct input *input)
{
......@@ -5932,11 +5956,7 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
wl_shm_add_listener(d->shm, &shm_listener, d);
} else if (strcmp(interface, "wl_data_device_manager") == 0) {
d->data_device_manager_version = MIN(version, 3);
d->data_device_manager =
wl_registry_bind(registry, id,
&wl_data_device_manager_interface,
d->data_device_manager_version);
display_add_data_device(d, id, version);
} else if (strcmp(interface, "xdg_wm_base") == 0) {
d->xdg_shell = wl_registry_bind(registry, id,
&xdg_wm_base_interface, 1);
......@@ -6148,7 +6168,8 @@ display_create(int *argc, char *argv[])
d->display = wl_display_connect(NULL);
if (d->display == NULL) {
fprintf(stderr, "failed to connect to Wayland display: %m\n");
fprintf(stderr, "failed to connect to Wayland display: %s\n",
strerror(errno));
free(d);
return NULL;
}
......@@ -6175,7 +6196,8 @@ display_create(int *argc, char *argv[])
wl_registry_add_listener(d->registry, &registry_listener, d);
if (wl_display_roundtrip(d->display) < 0) {
fprintf(stderr, "Failed to process Wayland connection: %m\n");
fprintf(stderr, "Failed to process Wayland connection: %s\n",
strerror(errno));
return NULL;
}
......@@ -6511,7 +6533,8 @@ toytimer_fire(struct task *tsk, uint32_t events)
* readable and getting here, there'll be nothing to
* read and we get EAGAIN. */
if (errno != EAGAIN)
fprintf(stderr, "timer read failed: %m\n");
fprintf(stderr, "timer read failed: %s\n",
strerror(errno));
return;
}
......@@ -6526,7 +6549,8 @@ toytimer_init(struct toytimer *tt, clockid_t clock, struct display *display,
tt->fd = timerfd_create(clock, TFD_CLOEXEC | TFD_NONBLOCK);
if (tt->fd == -1) {
fprintf(stderr, "creating timer failed: %m\n");
fprintf(stderr, "creating timer failed: %s\n",
strerror(errno));
abort();
}
......@@ -6551,7 +6575,7 @@ toytimer_arm(struct toytimer *tt, const struct itimerspec *its)
ret = timerfd_settime(tt->fd, 0, its, NULL);
if (ret < 0) {
fprintf(stderr, "timer setup failed: %m\n");
fprintf(stderr, "timer setup failed: %s\n", strerror(errno));
abort();
}
}
......
......@@ -42,7 +42,7 @@
#include <sys/socket.h>
#include <libinput.h>
#include <libevdev/libevdev.h>
#include <linux/input-event-codes.h>
#include <linux/input.h>
#include <sys/time.h>
#include <linux/limits.h>
......@@ -365,7 +365,7 @@ sigchld_handler(int signal_number, void *data)
}
if (pid < 0 && errno != ECHILD)
weston_log("waitpid error %m\n");
weston_log("waitpid error %s\n", strerror(errno));
return 1;
}
......@@ -391,7 +391,7 @@ child_client_exec(int sockfd, const char *path)
* non-CLOEXEC fd to pass through exec. */
clientfd = dup(sockfd);
if (clientfd == -1) {
weston_log("compositor: dup failed: %m\n");
weston_log("compositor: dup failed: %s\n", strerror(errno));
return;
}
......@@ -399,8 +399,8 @@ child_client_exec(int sockfd, const char *path)
setenv("WAYLAND_SOCKET", s, 1);
if (execl(path, path, NULL) < 0)
weston_log("compositor: executing '%s' failed: %m\n",
path);
weston_log("compositor: executing '%s' failed: %s\n",
path, strerror(errno));
}
WL_EXPORT struct wl_client *
......@@ -417,8 +417,8 @@ weston_client_launch(struct weston_compositor *compositor,
if (os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, sv) < 0) {
weston_log("weston_client_launch: "
"socketpair failed while launching '%s': %m\n",
path);
"socketpair failed while launching '%s': %s\n",
path, strerror(errno));
return NULL;
}
......@@ -427,7 +427,8 @@ weston_client_launch(struct weston_compositor *compositor,
close(sv[0]);
close(sv[1]);
weston_log("weston_client_launch: "
"fork failed while launching '%s': %m\n", path);
"fork failed while launching '%s': %s\n", path,
strerror(errno));
return NULL;
}
......@@ -812,13 +813,15 @@ weston_create_listening_socket(struct wl_display *display, const char *socket_na
{
if (socket_name) {
if (wl_display_add_socket(display, socket_name)) {
weston_log("fatal: failed to add socket: %m\n");
weston_log("fatal: failed to add socket: %s\n",
strerror(errno));
return -1;
}
} else {
socket_name = wl_display_add_socket_auto(display);
if (!socket_name) {
weston_log("fatal: failed to add socket: %m\n");
weston_log("fatal: failed to add socket: %s\n",
strerror(errno));
return -1;
}
}
......@@ -1815,7 +1818,7 @@ wet_layoutput_create_output(struct wet_layoutput *lo, const char *name)
output->output =
weston_compositor_create_output(lo->compositor->compositor,
name);
if (!output) {
if (!output->output) {
free(output);
return NULL;
}
......@@ -2326,6 +2329,7 @@ load_drm_backend(struct weston_compositor *c,
int use_shadow;
int ret = 0;
int use_pixman_config_ = 0;
int drm_use_current_mode = 0;
int32_t use_pixman_ = 0;
wet->drm_use_current_mode = false;
......@@ -2339,11 +2343,12 @@ load_drm_backend(struct weston_compositor *c,
{ WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
{ WESTON_OPTION_STRING, "drm-device", 0, &config.specific_device },
{ WESTON_OPTION_BOOLEAN, "current-mode", 0, &wet->drm_use_current_mode },
{ WESTON_OPTION_BOOLEAN, "current-mode", 0, &drm_use_current_mode },
{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
};
parse_options(options, ARRAY_LENGTH(options), argc, argv);
wet->drm_use_current_mode = drm_use_current_mode;
config.use_pixman = use_pixman_;
section = weston_config_get_section(wc, "core", NULL, NULL);
......@@ -2615,6 +2620,8 @@ load_x11_backend(struct weston_compositor *c,
char const *section_name;
int i;
int32_t use_pixman_config_ = 0;
int fullscreen = 0;
int no_input = 0;
int use_pixman_ = 0;
struct wet_output_config *parsed_options = wet_init_parsed_options(c);
......@@ -2630,13 +2637,15 @@ load_x11_backend(struct weston_compositor *c,
{ WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
{ WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
{ WESTON_OPTION_INTEGER, "scale", 0, &parsed_options->scale },
{ WESTON_OPTION_BOOLEAN, "fullscreen", 'f', &config.fullscreen },
{ WESTON_OPTION_BOOLEAN, "fullscreen", 'f', &fullscreen },
{ WESTON_OPTION_INTEGER, "output-count", 0, &option_count },
{ WESTON_OPTION_BOOLEAN, "no-input", 0, &config.no_input },
{ WESTON_OPTION_BOOLEAN, "no-input", 0, &no_input },
{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
};
parse_options(options, ARRAY_LENGTH(options), argc, argv);
config.fullscreen = fullscreen;
config.no_input = no_input;
config.use_pixman = use_pixman_;
config.base.struct_version = WESTON_X11_BACKEND_CONFIG_VERSION;
......@@ -2758,7 +2767,7 @@ load_wayland_backend(struct weston_compositor *c,
parse_options(wayland_options, ARRAY_LENGTH(wayland_options), argc, argv);
config.sprawl = sprawl_;
config.fullscreen = fullscreen_;
config.use_pixman = use_pixman_config_;
config.use_pixman = use_pixman_;
section = weston_config_get_section(wc, "shell", NULL, NULL);
weston_config_section_get_string(section, "cursor-theme",
......@@ -2974,6 +2983,10 @@ int main(int argc, char *argv[])
verify_xdg_runtime_dir();
display = wl_display_create();
if (display == NULL) {
weston_log("fatal: failed to create display\n");
goto out_display;
}
loop = wl_display_get_event_loop(display);
signals[0] = wl_event_loop_add_signal(loop, SIGTERM, on_term_signal,
......@@ -3083,7 +3096,8 @@ int main(int argc, char *argv[])
if (fd != -1) {
primary_client = wl_client_create(display, fd);
if (!primary_client) {
weston_log("fatal: failed to add client: %m\n");
weston_log("fatal: failed to add client: %s\n",
strerror(errno));
goto out;
}
primary_client_destroyed.notify =
......@@ -3169,6 +3183,7 @@ out_signals:
wl_display_destroy(display);
out_display:
weston_log_file_close();
if (config)
......
......@@ -117,11 +117,21 @@ if get_option('color-management-colord')
error('cms-colord requires colord >= 0.1.27 which was not found. Or, you can use \'-Dcolor-management-colord=false\'.')
endif
plugin_colord_deps = [ dep_libweston, dep_colord ]
foreach depname : [ 'glib-2.0', 'gobject-2.0' ]
dep = dependency(depname, required: false)
if not dep.found()
error('cms-colord requires \'@0@\' which was not found. If you rather not build this, set \'-Dcolor-management-colord=false\'.'.format(depname))
endif
plugin_colord_deps += dep
endforeach
plugin_colord = shared_library(
'cms-colord',
srcs_colord,
include_directories: include_directories('..', '../shared'),
dependencies: [ dep_libweston, dep_colord ],
dependencies: plugin_colord_deps,
name_prefix: '',
install: true,
install_dir: dir_module_weston
......
......@@ -207,7 +207,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED) {
weston_log("mmap failed: %m\n");
weston_log("mmap failed: %s\n", strerror(errno));
goto error;
}
......@@ -462,13 +462,13 @@ shared_output_get_shm_buffer(struct shared_output *so)
fd = os_create_anonymous_file(height * stride);
if (fd < 0) {
weston_log("os_create_anonymous_file: %m\n");
weston_log("os_create_anonymous_file: %s\n", strerror(errno));
return NULL;
}
data = mmap(NULL, height * stride, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
weston_log("mmap: %m\n");
weston_log("mmap: %s\n", strerror(errno));
goto out_close;
}
......@@ -940,7 +940,7 @@ shared_output_create(struct weston_output *output, int parent_fd)
so->parent.surface =
wl_compositor_create_surface(so->parent.compositor);
if (!so->parent.surface) {
weston_log("Screen share failed: %m\n");
weston_log("Screen share failed: %s\n", strerror(errno));
goto err_display;
}
......@@ -950,7 +950,7 @@ shared_output_create(struct weston_output *output, int parent_fd)
so->parent.output,
output->current_mode->refresh);
if (!so->parent.mode_feedback) {
weston_log("Screen share failed: %m\n");
weston_log("Screen share failed: %s\n", strerror(errno));
goto err_display;
}
zwp_fullscreen_shell_mode_feedback_v1_add_listener(so->parent.mode_feedback,
......@@ -964,7 +964,7 @@ shared_output_create(struct weston_output *output, int parent_fd)
wl_event_loop_add_fd(loop, epoll_fd, WL_EVENT_READABLE,
shared_output_handle_event, so);
if (!so->event_source) {
weston_log("Screen share failed: %m\n");
weston_log("Screen share failed: %s\n", strerror(errno));
goto err_display;
}
......@@ -1033,7 +1033,8 @@ weston_output_share(struct weston_output *output, const char* command)
};
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
weston_log("weston_output_share: socketpair failed: %m\n");
weston_log("weston_output_share: socketpair failed: %s\n",
strerror(errno));
return NULL;
}
......@@ -1042,7 +1043,8 @@ weston_output_share(struct weston_output *output, const char* command)
if (pid == -1) {
close(sv[0]);
close(sv[1]);
weston_log("weston_output_share: fork failed: %m\n");
weston_log("weston_output_share: fork failed: %s\n",
strerror(errno));
return NULL;
}
......@@ -1054,13 +1056,15 @@ weston_output_share(struct weston_output *output, const char* command)
/* Launch clients as the user. Do not launch clients with
* wrong euid. */
if (seteuid(getuid()) == -1) {
weston_log("weston_output_share: setuid failed: %m\n");
weston_log("weston_output_share: setuid failed: %s\n",
strerror(errno));
abort();
}
sv[1] = dup(sv[1]);
if (sv[1] == -1) {
weston_log("weston_output_share: dup failed: %m\n");
weston_log("weston_output_share: dup failed: %s\n",
strerror(errno));
abort();
}
......@@ -1068,7 +1072,8 @@ weston_output_share(struct weston_output *output, const char* command)
setenv("WAYLAND_SERVER_SOCKET", str, 1);
execv(argv[0], argv);
weston_log("weston_output_share: exec failed: %m\n");
weston_log("weston_output_share: exec failed: %s\n",
strerror(errno));
abort();
} else {
close(sv[1]);
......
......@@ -27,6 +27,8 @@
#include "config.h"
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <sys/socket.h>
#include "compositor.h"
......@@ -128,9 +130,10 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
NULL) < 0)
weston_log("exec of '%s %s -rootless "
"-listen %s -listen %s -wm %s "
"-terminate' failed: %m\n",
"-terminate' failed: %s\n",
xserver, display,
abstract_fd_str, unix_fd_str, wm_fd_str);
abstract_fd_str, unix_fd_str, wm_fd_str,
strerror(errno));
fail:
_exit(EXIT_FAILURE);
......
m4_define([weston_major_version], [6])
m4_define([weston_minor_version], [0])
m4_define([weston_micro_version], [0])
m4_define([weston_micro_version], [1])
m4_define([weston_version],
[weston_major_version.weston_minor_version.weston_micro_version])
m4_define([libweston_major_version], [6])
m4_define([libweston_minor_version], [0])
m4_define([libweston_patch_version], [0])
m4_define([libweston_patch_version], [1])
AC_PREREQ([2.64])
AC_INIT([weston],
......
......@@ -47,7 +47,6 @@ if get_option('shell-ivi')
ivi_test_ini = configure_file(
input: '../ivi-shell/weston.ini.in',
output: 'weston-ivi-test.ini',
install: false,
configuration: ivi_test_config
)
endif
......@@ -661,7 +661,8 @@ drm_output_pageflip_timer_create(struct drm_output *output)
output);
if (output->pageflip_timer == NULL) {
weston_log("creating drm pageflip timer failed: %m\n");
weston_log("creating drm pageflip timer failed: %s\n",
strerror(errno));
return -1;
}
......@@ -1079,7 +1080,7 @@ drm_fb_create_dumb(struct drm_backend *b, int width, int height,
fb->fd = b->drm.fd;
if (drm_fb_addfb(b, fb) != 0) {
weston_log("failed to create kms fb: %m\n");
weston_log("failed to create kms fb: %s\n", strerror(errno));
goto err_bo;
}
......@@ -1329,7 +1330,8 @@ drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend,
if (drm_fb_addfb(backend, fb) != 0) {
if (type == BUFFER_GBM_SURFACE)
weston_log("failed to create kms fb: %m\n");
weston_log("failed to create kms fb: %s\n",
strerror(errno));
goto err_free;
}
......@@ -2097,7 +2099,8 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage)
bo = gbm_surface_lock_front_buffer(output->gbm_surface);
if (!bo) {
weston_log("failed to lock front buffer: %m\n");
weston_log("failed to lock front buffer: %s\n",
strerror(errno));
return NULL;
}
......@@ -2206,7 +2209,7 @@ drm_output_set_gamma(struct weston_output *output_base,
output->crtc_id,
size, r, g, b);
if (rc)
weston_log("set gamma failed: %m\n");
weston_log("set gamma failed: %s\n", strerror(errno));
}
/* Determine the type of vblank synchronization to use for the output.
......@@ -2280,20 +2283,23 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
ret = drmModeSetPlane(backend->drm.fd, p->plane_id,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
if (ret)