mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-05 05:05:57 +01:00
Merge pull request #1126 from emersion/wlr-log-prefix
util: add wlr_ prefix to log symbols
This commit is contained in:
commit
2518de655c
98 changed files with 631 additions and 629 deletions
|
@ -192,13 +192,13 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
||||||
|
|
||||||
struct wlr_session *session = wlr_session_create(display);
|
struct wlr_session *session = wlr_session_create(display);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log(L_ERROR, "Failed to start a DRM session");
|
wlr_log(WLR_ERROR, "Failed to start a DRM session");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gpu = wlr_session_find_gpu(session);
|
int gpu = wlr_session_find_gpu(session);
|
||||||
if (gpu == -1) {
|
if (gpu == -1) {
|
||||||
wlr_log(L_ERROR, "Failed to open DRM device");
|
wlr_log(WLR_ERROR, "Failed to open DRM device");
|
||||||
goto error_session;
|
goto error_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ static size_t parse_outputs_env(const char *name) {
|
||||||
char *end;
|
char *end;
|
||||||
int outputs = (int)strtol(outputs_str, &end, 10);
|
int outputs = (int)strtol(outputs_str, &end, 10);
|
||||||
if (*end || outputs < 0) {
|
if (*end || outputs < 0) {
|
||||||
wlr_log(L_ERROR, "%s specified with invalid integer, ignoring", name);
|
wlr_log(WLR_ERROR, "%s specified with invalid integer, ignoring", name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,13 +125,13 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
|
||||||
int gpus[8];
|
int gpus[8];
|
||||||
size_t num_gpus = wlr_session_find_gpus(session, 8, gpus);
|
size_t num_gpus = wlr_session_find_gpus(session, 8, gpus);
|
||||||
struct wlr_backend *primary_drm = NULL;
|
struct wlr_backend *primary_drm = NULL;
|
||||||
wlr_log(L_INFO, "Found %zu GPUs", num_gpus);
|
wlr_log(WLR_INFO, "Found %zu GPUs", num_gpus);
|
||||||
|
|
||||||
for (size_t i = 0; i < num_gpus; ++i) {
|
for (size_t i = 0; i < num_gpus; ++i) {
|
||||||
struct wlr_backend *drm = wlr_drm_backend_create(display, session,
|
struct wlr_backend *drm = wlr_drm_backend_create(display, session,
|
||||||
gpus[i], primary_drm, create_renderer_func);
|
gpus[i], primary_drm, create_renderer_func);
|
||||||
if (!drm) {
|
if (!drm) {
|
||||||
wlr_log(L_ERROR, "Failed to open DRM device %d", gpus[i]);
|
wlr_log(WLR_ERROR, "Failed to open DRM device %d", gpus[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
|
||||||
// DRM and libinput need a session
|
// DRM and libinput need a session
|
||||||
*session = wlr_session_create(display);
|
*session = wlr_session_create(display);
|
||||||
if (!*session) {
|
if (!*session) {
|
||||||
wlr_log(L_ERROR, "failed to start a session");
|
wlr_log(WLR_ERROR, "failed to start a session");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_ERROR, "unrecognized backend '%s'", name);
|
wlr_log(WLR_ERROR, "unrecognized backend '%s'", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
wlr_renderer_create_func_t create_renderer_func) {
|
wlr_renderer_create_func_t create_renderer_func) {
|
||||||
struct wlr_backend *backend = wlr_multi_backend_create(display);
|
struct wlr_backend *backend = wlr_multi_backend_create(display);
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
wlr_log(L_ERROR, "could not allocate multibackend");
|
wlr_log(WLR_ERROR, "could not allocate multibackend");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
if (names) {
|
if (names) {
|
||||||
names = strdup(names);
|
names = strdup(names);
|
||||||
if (names == NULL) {
|
if (names == NULL) {
|
||||||
wlr_log(L_ERROR, "allocation failed");
|
wlr_log(WLR_ERROR, "allocation failed");
|
||||||
wlr_backend_destroy(backend);
|
wlr_backend_destroy(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
struct wlr_backend *subbackend =
|
struct wlr_backend *subbackend =
|
||||||
attempt_backend_by_name(display, backend, &session, name, create_renderer_func);
|
attempt_backend_by_name(display, backend, &session, name, create_renderer_func);
|
||||||
if (subbackend == NULL) {
|
if (subbackend == NULL) {
|
||||||
wlr_log(L_ERROR, "failed to start backend '%s'", name);
|
wlr_log(WLR_ERROR, "failed to start backend '%s'", name);
|
||||||
wlr_backend_destroy(backend);
|
wlr_backend_destroy(backend);
|
||||||
wlr_session_destroy(session);
|
wlr_session_destroy(session);
|
||||||
free(names);
|
free(names);
|
||||||
|
@ -208,7 +208,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_multi_backend_add(backend, subbackend)) {
|
if (!wlr_multi_backend_add(backend, subbackend)) {
|
||||||
wlr_log(L_ERROR, "failed to add backend '%s'", name);
|
wlr_log(WLR_ERROR, "failed to add backend '%s'", name);
|
||||||
wlr_backend_destroy(backend);
|
wlr_backend_destroy(backend);
|
||||||
wlr_session_destroy(session);
|
wlr_session_destroy(session);
|
||||||
free(names);
|
free(names);
|
||||||
|
@ -247,14 +247,14 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
// Attempt DRM+libinput
|
// Attempt DRM+libinput
|
||||||
session = wlr_session_create(display);
|
session = wlr_session_create(display);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log(L_ERROR, "Failed to start a DRM session");
|
wlr_log(WLR_ERROR, "Failed to start a DRM session");
|
||||||
wlr_backend_destroy(backend);
|
wlr_backend_destroy(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_backend *libinput = wlr_libinput_backend_create(display, session);
|
struct wlr_backend *libinput = wlr_libinput_backend_create(display, session);
|
||||||
if (!libinput) {
|
if (!libinput) {
|
||||||
wlr_log(L_ERROR, "Failed to start libinput backend");
|
wlr_log(WLR_ERROR, "Failed to start libinput backend");
|
||||||
wlr_backend_destroy(backend);
|
wlr_backend_destroy(backend);
|
||||||
wlr_session_destroy(session);
|
wlr_session_destroy(session);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -264,7 +264,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
struct wlr_backend *primary_drm =
|
struct wlr_backend *primary_drm =
|
||||||
attempt_drm_backend(display, backend, session, create_renderer_func);
|
attempt_drm_backend(display, backend, session, create_renderer_func);
|
||||||
if (!primary_drm) {
|
if (!primary_drm) {
|
||||||
wlr_log(L_ERROR, "Failed to open any DRM device");
|
wlr_log(WLR_ERROR, "Failed to open any DRM device");
|
||||||
wlr_backend_destroy(libinput);
|
wlr_backend_destroy(libinput);
|
||||||
wlr_backend_destroy(backend);
|
wlr_backend_destroy(backend);
|
||||||
wlr_session_destroy(session);
|
wlr_session_destroy(session);
|
||||||
|
|
|
@ -17,7 +17,7 @@ static void atomic_begin(struct wlr_drm_crtc *crtc, struct atomic *atom) {
|
||||||
if (!crtc->atomic) {
|
if (!crtc->atomic) {
|
||||||
crtc->atomic = drmModeAtomicAlloc();
|
crtc->atomic = drmModeAtomicAlloc();
|
||||||
if (!crtc->atomic) {
|
if (!crtc->atomic) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
atom->failed = true;
|
atom->failed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ static bool atomic_end(int drm_fd, struct atomic *atom) {
|
||||||
|
|
||||||
uint32_t flags = DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_NONBLOCK;
|
uint32_t flags = DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_NONBLOCK;
|
||||||
if (drmModeAtomicCommit(drm_fd, atom->req, flags, NULL)) {
|
if (drmModeAtomicCommit(drm_fd, atom->req, flags, NULL)) {
|
||||||
wlr_log_errno(L_ERROR, "Atomic test failed");
|
wlr_log_errno(WLR_ERROR, "Atomic test failed");
|
||||||
drmModeAtomicSetCursor(atom->req, atom->cursor);
|
drmModeAtomicSetCursor(atom->req, atom->cursor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,13 @@ static bool atomic_commit(int drm_fd, struct atomic *atom,
|
||||||
|
|
||||||
int ret = drmModeAtomicCommit(drm_fd, atom->req, flags, conn);
|
int ret = drmModeAtomicCommit(drm_fd, atom->req, flags, conn);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
wlr_log_errno(L_ERROR, "%s: Atomic commit failed (%s)",
|
wlr_log_errno(WLR_ERROR, "%s: Atomic commit failed (%s)",
|
||||||
conn->output.name, modeset ? "modeset" : "pageflip");
|
conn->output.name, modeset ? "modeset" : "pageflip");
|
||||||
|
|
||||||
// Try to commit without new changes
|
// Try to commit without new changes
|
||||||
drmModeAtomicSetCursor(atom->req, atom->cursor);
|
drmModeAtomicSetCursor(atom->req, atom->cursor);
|
||||||
if (drmModeAtomicCommit(drm_fd, atom->req, flags, conn)) {
|
if (drmModeAtomicCommit(drm_fd, atom->req, flags, conn)) {
|
||||||
wlr_log_errno(L_ERROR,
|
wlr_log_errno(WLR_ERROR,
|
||||||
"%s: Atomic commit without new changes failed (%s)",
|
"%s: Atomic commit without new changes failed (%s)",
|
||||||
conn->output.name, modeset ? "modeset" : "pageflip");
|
conn->output.name, modeset ? "modeset" : "pageflip");
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ static bool atomic_commit(int drm_fd, struct atomic *atom,
|
||||||
|
|
||||||
static inline void atomic_add(struct atomic *atom, uint32_t id, uint32_t prop, uint64_t val) {
|
static inline void atomic_add(struct atomic *atom, uint32_t id, uint32_t prop, uint64_t val) {
|
||||||
if (!atom->failed && drmModeAtomicAddProperty(atom->req, id, prop, val) < 0) {
|
if (!atom->failed && drmModeAtomicAddProperty(atom->req, id, prop, val) < 0) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to add atomic DRM property");
|
wlr_log_errno(WLR_ERROR, "Failed to add atomic DRM property");
|
||||||
atom->failed = true;
|
atom->failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drmModeCreatePropertyBlob(drm->fd, mode, sizeof(*mode), &crtc->mode_id)) {
|
if (drmModeCreatePropertyBlob(drm->fd, mode, sizeof(*mode), &crtc->mode_id)) {
|
||||||
wlr_log_errno(L_ERROR, "Unable to create property blob");
|
wlr_log_errno(WLR_ERROR, "Unable to create property blob");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
|
||||||
|
|
||||||
if (drmModeCreatePropertyBlob(drm->fd, gamma,
|
if (drmModeCreatePropertyBlob(drm->fd, gamma,
|
||||||
sizeof(struct drm_color_lut) * size, &crtc->gamma_lut)) {
|
sizeof(struct drm_color_lut) * size, &crtc->gamma_lut)) {
|
||||||
wlr_log_errno(L_ERROR, "Unable to create property blob");
|
wlr_log_errno(WLR_ERROR, "Unable to create property blob");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
|
||||||
|
|
||||||
if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
|
if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
|
||||||
&gamma_lut_size)) {
|
&gamma_lut_size)) {
|
||||||
wlr_log(L_ERROR, "Unable to get gamma lut size");
|
wlr_log(WLR_ERROR, "Unable to get gamma lut size");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void session_signal(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_session *session = data;
|
struct wlr_session *session = data;
|
||||||
|
|
||||||
if (session->active) {
|
if (session->active) {
|
||||||
wlr_log(L_INFO, "DRM fd resumed");
|
wlr_log(WLR_INFO, "DRM fd resumed");
|
||||||
scan_drm_connectors(drm);
|
scan_drm_connectors(drm);
|
||||||
|
|
||||||
struct wlr_drm_connector *conn;
|
struct wlr_drm_connector *conn;
|
||||||
|
@ -92,7 +92,7 @@ static void session_signal(struct wl_listener *listener, void *data) {
|
||||||
conn->cursor_y);
|
conn->cursor_y);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_INFO, "DRM fd paused");
|
wlr_log(WLR_INFO, "DRM fd paused");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ static void drm_invalidated(struct wl_listener *listener, void *data) {
|
||||||
wl_container_of(listener, drm, drm_invalidated);
|
wl_container_of(listener, drm, drm_invalidated);
|
||||||
|
|
||||||
char *name = drmGetDeviceNameFromFd2(drm->fd);
|
char *name = drmGetDeviceNameFromFd2(drm->fd);
|
||||||
wlr_log(L_DEBUG, "%s invalidated", name);
|
wlr_log(WLR_DEBUG, "%s invalidated", name);
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
scan_drm_connectors(drm);
|
scan_drm_connectors(drm);
|
||||||
|
@ -121,13 +121,13 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
||||||
|
|
||||||
char *name = drmGetDeviceNameFromFd2(gpu_fd);
|
char *name = drmGetDeviceNameFromFd2(gpu_fd);
|
||||||
drmVersion *version = drmGetVersion(gpu_fd);
|
drmVersion *version = drmGetVersion(gpu_fd);
|
||||||
wlr_log(L_INFO, "Initializing DRM backend for %s (%s)", name, version->name);
|
wlr_log(WLR_INFO, "Initializing DRM backend for %s (%s)", name, version->name);
|
||||||
free(name);
|
free(name);
|
||||||
drmFreeVersion(version);
|
drmFreeVersion(version);
|
||||||
|
|
||||||
struct wlr_drm_backend *drm = calloc(1, sizeof(struct wlr_drm_backend));
|
struct wlr_drm_backend *drm = calloc(1, sizeof(struct wlr_drm_backend));
|
||||||
if (!drm) {
|
if (!drm) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_backend_init(&drm->backend, &backend_impl);
|
wlr_backend_init(&drm->backend, &backend_impl);
|
||||||
|
@ -147,7 +147,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
||||||
drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd,
|
drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd,
|
||||||
WL_EVENT_READABLE, handle_drm_event, NULL);
|
WL_EVENT_READABLE, handle_drm_event, NULL);
|
||||||
if (!drm->drm_event) {
|
if (!drm->drm_event) {
|
||||||
wlr_log(L_ERROR, "Failed to create DRM event source");
|
wlr_log(WLR_ERROR, "Failed to create DRM event source");
|
||||||
goto error_fd;
|
goto error_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!init_drm_renderer(drm, &drm->renderer, create_renderer_func)) {
|
if (!init_drm_renderer(drm, &drm->renderer, create_renderer_func)) {
|
||||||
wlr_log(L_ERROR, "Failed to initialize renderer");
|
wlr_log(WLR_ERROR, "Failed to initialize renderer");
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,19 +28,19 @@
|
||||||
|
|
||||||
bool check_drm_features(struct wlr_drm_backend *drm) {
|
bool check_drm_features(struct wlr_drm_backend *drm) {
|
||||||
if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
|
if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
|
||||||
wlr_log(L_ERROR, "DRM universal planes unsupported");
|
wlr_log(WLR_ERROR, "DRM universal planes unsupported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *no_atomic = getenv("WLR_DRM_NO_ATOMIC");
|
const char *no_atomic = getenv("WLR_DRM_NO_ATOMIC");
|
||||||
if (no_atomic && strcmp(no_atomic, "1") == 0) {
|
if (no_atomic && strcmp(no_atomic, "1") == 0) {
|
||||||
wlr_log(L_DEBUG, "WLR_DRM_NO_ATOMIC set, forcing legacy DRM interface");
|
wlr_log(WLR_DEBUG, "WLR_DRM_NO_ATOMIC set, forcing legacy DRM interface");
|
||||||
drm->iface = &legacy_iface;
|
drm->iface = &legacy_iface;
|
||||||
} else if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_ATOMIC, 1)) {
|
} else if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_ATOMIC, 1)) {
|
||||||
wlr_log(L_DEBUG, "Atomic modesetting unsupported, using legacy DRM interface");
|
wlr_log(WLR_DEBUG, "Atomic modesetting unsupported, using legacy DRM interface");
|
||||||
drm->iface = &legacy_iface;
|
drm->iface = &legacy_iface;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "Using atomic DRM interface");
|
wlr_log(WLR_DEBUG, "Using atomic DRM interface");
|
||||||
drm->iface = &atomic_iface;
|
drm->iface = &atomic_iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ static int cmp_plane(const void *arg1, const void *arg2) {
|
||||||
static bool init_planes(struct wlr_drm_backend *drm) {
|
static bool init_planes(struct wlr_drm_backend *drm) {
|
||||||
drmModePlaneRes *plane_res = drmModeGetPlaneResources(drm->fd);
|
drmModePlaneRes *plane_res = drmModeGetPlaneResources(drm->fd);
|
||||||
if (!plane_res) {
|
if (!plane_res) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM plane resources");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM plane resources");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_INFO, "Found %"PRIu32" DRM planes", plane_res->count_planes);
|
wlr_log(WLR_INFO, "Found %"PRIu32" DRM planes", plane_res->count_planes);
|
||||||
|
|
||||||
if (plane_res->count_planes == 0) {
|
if (plane_res->count_planes == 0) {
|
||||||
drmModeFreePlaneResources(plane_res);
|
drmModeFreePlaneResources(plane_res);
|
||||||
|
@ -71,7 +71,7 @@ static bool init_planes(struct wlr_drm_backend *drm) {
|
||||||
drm->num_planes = plane_res->count_planes;
|
drm->num_planes = plane_res->count_planes;
|
||||||
drm->planes = calloc(drm->num_planes, sizeof(*drm->planes));
|
drm->planes = calloc(drm->num_planes, sizeof(*drm->planes));
|
||||||
if (!drm->planes) {
|
if (!drm->planes) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
goto error_res;
|
goto error_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ static bool init_planes(struct wlr_drm_backend *drm) {
|
||||||
|
|
||||||
drmModePlane *plane = drmModeGetPlane(drm->fd, plane_res->planes[i]);
|
drmModePlane *plane = drmModeGetPlane(drm->fd, plane_res->planes[i]);
|
||||||
if (!plane) {
|
if (!plane) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM plane");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM plane");
|
||||||
goto error_planes;
|
goto error_planes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ static bool init_planes(struct wlr_drm_backend *drm) {
|
||||||
drmModeFreePlane(plane);
|
drmModeFreePlane(plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_INFO, "(%zu overlay, %zu primary, %zu cursor)",
|
wlr_log(WLR_INFO, "(%zu overlay, %zu primary, %zu cursor)",
|
||||||
drm->num_overlay_planes,
|
drm->num_overlay_planes,
|
||||||
drm->num_primary_planes,
|
drm->num_primary_planes,
|
||||||
drm->num_cursor_planes);
|
drm->num_cursor_planes);
|
||||||
|
@ -126,16 +126,16 @@ error_res:
|
||||||
bool init_drm_resources(struct wlr_drm_backend *drm) {
|
bool init_drm_resources(struct wlr_drm_backend *drm) {
|
||||||
drmModeRes *res = drmModeGetResources(drm->fd);
|
drmModeRes *res = drmModeGetResources(drm->fd);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM resources");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM resources");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_INFO, "Found %d DRM CRTCs", res->count_crtcs);
|
wlr_log(WLR_INFO, "Found %d DRM CRTCs", res->count_crtcs);
|
||||||
|
|
||||||
drm->num_crtcs = res->count_crtcs;
|
drm->num_crtcs = res->count_crtcs;
|
||||||
drm->crtcs = calloc(drm->num_crtcs, sizeof(drm->crtcs[0]));
|
drm->crtcs = calloc(drm->num_crtcs, sizeof(drm->crtcs[0]));
|
||||||
if (!drm->crtcs) {
|
if (!drm->crtcs) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
goto error_res;
|
goto error_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ static bool drm_connector_swap_buffers(struct wlr_output *output,
|
||||||
uint32_t fb_id = get_fb_for_bo(bo);
|
uint32_t fb_id = get_fb_for_bo(bo);
|
||||||
|
|
||||||
if (conn->pageflip_pending) {
|
if (conn->pageflip_pending) {
|
||||||
wlr_log(L_ERROR, "Skipping pageflip on output '%s'", conn->output.name);
|
wlr_log(WLR_ERROR, "Skipping pageflip on output '%s'", conn->output.name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ static void drm_connector_start_renderer(struct wlr_drm_connector *conn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Starting renderer on output '%s'", conn->output.name);
|
wlr_log(WLR_DEBUG, "Starting renderer on output '%s'", conn->output.name);
|
||||||
|
|
||||||
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)conn->output.backend;
|
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)conn->output.backend;
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
|
@ -322,7 +322,7 @@ void enable_drm_connector(struct wlr_output *output, bool enable) {
|
||||||
|
|
||||||
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
||||||
bool *changed_outputs) {
|
bool *changed_outputs) {
|
||||||
wlr_log(L_DEBUG, "Reallocating planes");
|
wlr_log(WLR_DEBUG, "Reallocating planes");
|
||||||
|
|
||||||
// overlay, primary, cursor
|
// overlay, primary, cursor
|
||||||
for (size_t type = 0; type < 3; ++type) {
|
for (size_t type = 0; type < 3; ++type) {
|
||||||
|
@ -362,7 +362,7 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
||||||
struct wlr_drm_plane *new = &drm->type_planes[type][crtc_res[i]];
|
struct wlr_drm_plane *new = &drm->type_planes[type][crtc_res[i]];
|
||||||
|
|
||||||
if (*old != new) {
|
if (*old != new) {
|
||||||
wlr_log(L_DEBUG, "Assigning plane %d -> %d to CRTC %d",
|
wlr_log(WLR_DEBUG, "Assigning plane %d -> %d to CRTC %d",
|
||||||
*old ? (int)(*old)->id : -1,
|
*old ? (int)(*old)->id : -1,
|
||||||
new ? (int)new->id : -1,
|
new ? (int)new->id : -1,
|
||||||
c->id);
|
c->id);
|
||||||
|
@ -391,7 +391,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm,
|
||||||
|
|
||||||
memset(possible_crtc, 0, sizeof(possible_crtc));
|
memset(possible_crtc, 0, sizeof(possible_crtc));
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Reallocating CRTCs for output '%s'", conn->output.name);
|
wlr_log(WLR_DEBUG, "Reallocating CRTCs for output '%s'", conn->output.name);
|
||||||
|
|
||||||
ssize_t index = -1, i = -1;
|
ssize_t index = -1, i = -1;
|
||||||
struct wlr_drm_connector *c;
|
struct wlr_drm_connector *c;
|
||||||
|
@ -401,7 +401,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm,
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "output '%s' crtc=%p state=%d",
|
wlr_log(WLR_DEBUG, "output '%s' crtc=%p state=%d",
|
||||||
c->output.name, c->crtc, c->state);
|
c->output.name, c->crtc, c->state);
|
||||||
|
|
||||||
if (c->crtc) {
|
if (c->crtc) {
|
||||||
|
@ -428,14 +428,14 @@ static void realloc_crtcs(struct wlr_drm_backend *drm,
|
||||||
|
|
||||||
// There is no point doing anything if this monitor doesn't get activated
|
// There is no point doing anything if this monitor doesn't get activated
|
||||||
if (!matched[index]) {
|
if (!matched[index]) {
|
||||||
wlr_log(L_DEBUG, "Could not match a CRTC for this output");
|
wlr_log(WLR_DEBUG, "Could not match a CRTC for this output");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < drm->num_crtcs; ++i) {
|
for (size_t i = 0; i < drm->num_crtcs; ++i) {
|
||||||
// We don't want any of the current monitors to be deactivated.
|
// We don't want any of the current monitors to be deactivated.
|
||||||
if (crtc[i] != UNMATCHED && !matched[crtc[i]]) {
|
if (crtc[i] != UNMATCHED && !matched[crtc[i]]) {
|
||||||
wlr_log(L_DEBUG, "Could not match a CRTC for other output %d",
|
wlr_log(WLR_DEBUG, "Could not match a CRTC for other output %d",
|
||||||
crtc[i]);
|
crtc[i]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm,
|
||||||
}
|
}
|
||||||
c->crtc = &drm->crtcs[i];
|
c->crtc = &drm->crtcs[i];
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Assigning CRTC %d to output '%s'",
|
wlr_log(WLR_DEBUG, "Assigning CRTC %d to output '%s'",
|
||||||
drm->crtcs[i].id, c->output.name);
|
drm->crtcs[i].id, c->output.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -471,12 +471,12 @@ static void realloc_crtcs(struct wlr_drm_backend *drm,
|
||||||
static uint32_t get_possible_crtcs(int fd, uint32_t conn_id) {
|
static uint32_t get_possible_crtcs(int fd, uint32_t conn_id) {
|
||||||
drmModeConnector *conn = drmModeGetConnector(fd, conn_id);
|
drmModeConnector *conn = drmModeGetConnector(fd, conn_id);
|
||||||
if (!conn) {
|
if (!conn) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM connector");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM connector");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->connection != DRM_MODE_CONNECTED || conn->count_modes == 0) {
|
if (conn->connection != DRM_MODE_CONNECTED || conn->count_modes == 0) {
|
||||||
wlr_log(L_ERROR, "Output is not connected");
|
wlr_log(WLR_ERROR, "Output is not connected");
|
||||||
goto error_conn;
|
goto error_conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ static uint32_t get_possible_crtcs(int fd, uint32_t conn_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enc) {
|
if (!enc) {
|
||||||
wlr_log(L_ERROR, "Failed to get DRM encoder");
|
wlr_log(WLR_ERROR, "Failed to get DRM encoder");
|
||||||
goto error_conn;
|
goto error_conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ static bool drm_connector_set_mode(struct wlr_output *output,
|
||||||
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
|
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
|
||||||
bool changed_outputs[wl_list_length(&drm->outputs)];
|
bool changed_outputs[wl_list_length(&drm->outputs)];
|
||||||
|
|
||||||
wlr_log(L_INFO, "Modesetting '%s' with '%ux%u@%u mHz'", conn->output.name,
|
wlr_log(WLR_INFO, "Modesetting '%s' with '%ux%u@%u mHz'", conn->output.name,
|
||||||
mode->width, mode->height, mode->refresh);
|
mode->width, mode->height, mode->refresh);
|
||||||
|
|
||||||
conn->possible_crtc = get_possible_crtcs(drm->fd, conn->id);
|
conn->possible_crtc = get_possible_crtcs(drm->fd, conn->id);
|
||||||
|
@ -521,10 +521,10 @@ static bool drm_connector_set_mode(struct wlr_output *output,
|
||||||
|
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
if (!crtc) {
|
if (!crtc) {
|
||||||
wlr_log(L_ERROR, "Unable to match %s with a CRTC", conn->output.name);
|
wlr_log(WLR_ERROR, "Unable to match %s with a CRTC", conn->output.name);
|
||||||
goto error_conn;
|
goto error_conn;
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "%s: crtc=%td ovr=%td pri=%td cur=%td", conn->output.name,
|
wlr_log(WLR_DEBUG, "%s: crtc=%td ovr=%td pri=%td cur=%td", conn->output.name,
|
||||||
crtc - drm->crtcs,
|
crtc - drm->crtcs,
|
||||||
crtc->overlay ? crtc->overlay - drm->overlay_planes : -1,
|
crtc->overlay ? crtc->overlay - drm->overlay_planes : -1,
|
||||||
crtc->primary ? crtc->primary - drm->primary_planes : -1,
|
crtc->primary ? crtc->primary - drm->primary_planes : -1,
|
||||||
|
@ -552,7 +552,7 @@ static bool drm_connector_set_mode(struct wlr_output *output,
|
||||||
|
|
||||||
if (!init_drm_plane_surfaces(crtc->primary, drm,
|
if (!init_drm_plane_surfaces(crtc->primary, drm,
|
||||||
mode->width, mode->height, GBM_FORMAT_XRGB8888)) {
|
mode->width, mode->height, GBM_FORMAT_XRGB8888)) {
|
||||||
wlr_log(L_ERROR, "Failed to initialize renderer for plane");
|
wlr_log(WLR_ERROR, "Failed to initialize renderer for plane");
|
||||||
goto error_conn;
|
goto error_conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ bool wlr_drm_connector_add_mode(struct wlr_output *output,
|
||||||
mode->wlr_mode.height = mode->drm_mode.vdisplay;
|
mode->wlr_mode.height = mode->drm_mode.vdisplay;
|
||||||
mode->wlr_mode.refresh = mode->drm_mode.vrefresh;
|
mode->wlr_mode.refresh = mode->drm_mode.vrefresh;
|
||||||
|
|
||||||
wlr_log(L_INFO, "Registered custom mode "
|
wlr_log(WLR_INFO, "Registered custom mode "
|
||||||
"%"PRId32"x%"PRId32"@%"PRId32,
|
"%"PRId32"x%"PRId32"@%"PRId32,
|
||||||
mode->wlr_mode.width, mode->wlr_mode.height,
|
mode->wlr_mode.width, mode->wlr_mode.height,
|
||||||
mode->wlr_mode.refresh);
|
mode->wlr_mode.refresh);
|
||||||
|
@ -616,7 +616,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
||||||
// We don't have a real cursor plane, so we make a fake one
|
// We don't have a real cursor plane, so we make a fake one
|
||||||
plane = calloc(1, sizeof(*plane));
|
plane = calloc(1, sizeof(*plane));
|
||||||
if (!plane) {
|
if (!plane) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
crtc->cursor = plane;
|
crtc->cursor = plane;
|
||||||
|
@ -632,14 +632,14 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
||||||
|
|
||||||
if (!init_drm_surface(&plane->surf, renderer, w, h,
|
if (!init_drm_surface(&plane->surf, renderer, w, h,
|
||||||
GBM_FORMAT_ARGB8888, 0)) {
|
GBM_FORMAT_ARGB8888, 0)) {
|
||||||
wlr_log(L_ERROR, "Cannot allocate cursor resources");
|
wlr_log(WLR_ERROR, "Cannot allocate cursor resources");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
plane->cursor_bo = gbm_bo_create(renderer->gbm, w, h,
|
plane->cursor_bo = gbm_bo_create(renderer->gbm, w, h,
|
||||||
GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
||||||
if (!plane->cursor_bo) {
|
if (!plane->cursor_bo) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to create cursor bo");
|
wlr_log_errno(WLR_ERROR, "Failed to create cursor bo");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
||||||
height = height * output->scale / scale;
|
height = height * output->scale / scale;
|
||||||
|
|
||||||
if (width > (int)plane->surf.width || height > (int)plane->surf.height) {
|
if (width > (int)plane->surf.width || height > (int)plane->surf.height) {
|
||||||
wlr_log(L_ERROR, "Cursor too large (max %dx%d)",
|
wlr_log(WLR_ERROR, "Cursor too large (max %dx%d)",
|
||||||
(int)plane->surf.width, (int)plane->surf.height);
|
(int)plane->surf.width, (int)plane->surf.height);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
||||||
void *bo_data;
|
void *bo_data;
|
||||||
if (!gbm_bo_map(plane->cursor_bo, 0, 0, bo_width, bo_height,
|
if (!gbm_bo_map(plane->cursor_bo, 0, 0, bo_width, bo_height,
|
||||||
GBM_BO_TRANSFER_WRITE, &bo_stride, &bo_data)) {
|
GBM_BO_TRANSFER_WRITE, &bo_stride, &bo_data)) {
|
||||||
wlr_log_errno(L_ERROR, "Unable to map buffer");
|
wlr_log_errno(WLR_ERROR, "Unable to map buffer");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ bool wlr_output_is_drm(struct wlr_output *output) {
|
||||||
|
|
||||||
static int retry_pageflip(void *data) {
|
static int retry_pageflip(void *data) {
|
||||||
struct wlr_drm_connector *conn = data;
|
struct wlr_drm_connector *conn = data;
|
||||||
wlr_log(L_INFO, "%s: Retrying pageflip", conn->output.name);
|
wlr_log(WLR_INFO, "%s: Retrying pageflip", conn->output.name);
|
||||||
drm_connector_start_renderer(conn);
|
drm_connector_start_renderer(conn);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -812,11 +812,11 @@ static const int32_t subpixel_map[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
wlr_log(L_INFO, "Scanning DRM connectors");
|
wlr_log(WLR_INFO, "Scanning DRM connectors");
|
||||||
|
|
||||||
drmModeRes *res = drmModeGetResources(drm->fd);
|
drmModeRes *res = drmModeGetResources(drm->fd);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM resources");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM resources");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,7 +830,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
drmModeConnector *drm_conn = drmModeGetConnector(drm->fd,
|
drmModeConnector *drm_conn = drmModeGetConnector(drm->fd,
|
||||||
res->connectors[i]);
|
res->connectors[i]);
|
||||||
if (!drm_conn) {
|
if (!drm_conn) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM connector");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM connector");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
drmModeEncoder *curr_enc = drmModeGetEncoder(drm->fd,
|
drmModeEncoder *curr_enc = drmModeGetEncoder(drm->fd,
|
||||||
|
@ -849,7 +849,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
if (!wlr_conn) {
|
if (!wlr_conn) {
|
||||||
wlr_conn = calloc(1, sizeof(*wlr_conn));
|
wlr_conn = calloc(1, sizeof(*wlr_conn));
|
||||||
if (!wlr_conn) {
|
if (!wlr_conn) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
drmModeFreeEncoder(curr_enc);
|
drmModeFreeEncoder(curr_enc);
|
||||||
drmModeFreeConnector(drm_conn);
|
drmModeFreeConnector(drm_conn);
|
||||||
continue;
|
continue;
|
||||||
|
@ -874,7 +874,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
drm_conn->connector_type_id);
|
drm_conn->connector_type_id);
|
||||||
|
|
||||||
wl_list_insert(&drm->outputs, &wlr_conn->link);
|
wl_list_insert(&drm->outputs, &wlr_conn->link);
|
||||||
wlr_log(L_INFO, "Found display '%s'", wlr_conn->output.name);
|
wlr_log(WLR_INFO, "Found display '%s'", wlr_conn->output.name);
|
||||||
} else {
|
} else {
|
||||||
seen[index] = true;
|
seen[index] = true;
|
||||||
}
|
}
|
||||||
|
@ -892,13 +892,13 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
|
|
||||||
if (wlr_conn->state == WLR_DRM_CONN_DISCONNECTED &&
|
if (wlr_conn->state == WLR_DRM_CONN_DISCONNECTED &&
|
||||||
drm_conn->connection == DRM_MODE_CONNECTED) {
|
drm_conn->connection == DRM_MODE_CONNECTED) {
|
||||||
wlr_log(L_INFO, "'%s' connected", wlr_conn->output.name);
|
wlr_log(WLR_INFO, "'%s' connected", wlr_conn->output.name);
|
||||||
wlr_log(L_DEBUG, "Current CRTC: %d",
|
wlr_log(WLR_DEBUG, "Current CRTC: %d",
|
||||||
wlr_conn->crtc ? (int)wlr_conn->crtc->id : -1);
|
wlr_conn->crtc ? (int)wlr_conn->crtc->id : -1);
|
||||||
|
|
||||||
wlr_conn->output.phys_width = drm_conn->mmWidth;
|
wlr_conn->output.phys_width = drm_conn->mmWidth;
|
||||||
wlr_conn->output.phys_height = drm_conn->mmHeight;
|
wlr_conn->output.phys_height = drm_conn->mmHeight;
|
||||||
wlr_log(L_INFO, "Physical size: %"PRId32"x%"PRId32,
|
wlr_log(WLR_INFO, "Physical size: %"PRId32"x%"PRId32,
|
||||||
wlr_conn->output.phys_width, wlr_conn->output.phys_height);
|
wlr_conn->output.phys_width, wlr_conn->output.phys_height);
|
||||||
wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
|
wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
|
||||||
|
|
||||||
|
@ -910,12 +910,12 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
parse_edid(&wlr_conn->output, edid_len, edid);
|
parse_edid(&wlr_conn->output, edid_len, edid);
|
||||||
free(edid);
|
free(edid);
|
||||||
|
|
||||||
wlr_log(L_INFO, "Detected modes:");
|
wlr_log(WLR_INFO, "Detected modes:");
|
||||||
|
|
||||||
for (int i = 0; i < drm_conn->count_modes; ++i) {
|
for (int i = 0; i < drm_conn->count_modes; ++i) {
|
||||||
struct wlr_drm_mode *mode = calloc(1, sizeof(*mode));
|
struct wlr_drm_mode *mode = calloc(1, sizeof(*mode));
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mode->drm_mode = drm_conn->modes[i];
|
mode->drm_mode = drm_conn->modes[i];
|
||||||
|
@ -923,7 +923,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
mode->wlr_mode.height = mode->drm_mode.vdisplay;
|
mode->wlr_mode.height = mode->drm_mode.vdisplay;
|
||||||
mode->wlr_mode.refresh = calculate_refresh_rate(&mode->drm_mode);
|
mode->wlr_mode.refresh = calculate_refresh_rate(&mode->drm_mode);
|
||||||
|
|
||||||
wlr_log(L_INFO, " %"PRId32"x%"PRId32"@%"PRId32,
|
wlr_log(WLR_INFO, " %"PRId32"x%"PRId32"@%"PRId32,
|
||||||
mode->wlr_mode.width, mode->wlr_mode.height,
|
mode->wlr_mode.width, mode->wlr_mode.height,
|
||||||
mode->wlr_mode.refresh);
|
mode->wlr_mode.refresh);
|
||||||
|
|
||||||
|
@ -933,13 +933,13 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
wlr_output_update_enabled(&wlr_conn->output, true);
|
wlr_output_update_enabled(&wlr_conn->output, true);
|
||||||
|
|
||||||
wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET;
|
wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET;
|
||||||
wlr_log(L_INFO, "Sending modesetting signal for '%s'",
|
wlr_log(WLR_INFO, "Sending modesetting signal for '%s'",
|
||||||
wlr_conn->output.name);
|
wlr_conn->output.name);
|
||||||
wlr_signal_emit_safe(&drm->backend.events.new_output,
|
wlr_signal_emit_safe(&drm->backend.events.new_output,
|
||||||
&wlr_conn->output);
|
&wlr_conn->output);
|
||||||
} else if (wlr_conn->state == WLR_DRM_CONN_CONNECTED &&
|
} else if (wlr_conn->state == WLR_DRM_CONN_CONNECTED &&
|
||||||
drm_conn->connection != DRM_MODE_CONNECTED) {
|
drm_conn->connection != DRM_MODE_CONNECTED) {
|
||||||
wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name);
|
wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->output.name);
|
||||||
|
|
||||||
wlr_output_update_enabled(&wlr_conn->output, false);
|
wlr_output_update_enabled(&wlr_conn->output, false);
|
||||||
drm_connector_cleanup(wlr_conn);
|
drm_connector_cleanup(wlr_conn);
|
||||||
|
@ -959,7 +959,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_INFO, "'%s' disappeared", conn->output.name);
|
wlr_log(WLR_INFO, "'%s' disappeared", conn->output.name);
|
||||||
drm_connector_cleanup(conn);
|
drm_connector_cleanup(conn);
|
||||||
|
|
||||||
drmModeFreeCrtc(conn->old_crtc);
|
drmModeFreeCrtc(conn->old_crtc);
|
||||||
|
@ -1024,7 +1024,7 @@ void restore_drm_outputs(struct wlr_drm_backend *drm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to_close) {
|
if (to_close) {
|
||||||
wlr_log(L_ERROR, "Timed out stopping output renderers");
|
wlr_log(WLR_ERROR, "Timed out stopping output renderers");
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each(conn, &drm->outputs, link) {
|
wl_list_for_each(conn, &drm->outputs, link) {
|
||||||
|
@ -1077,7 +1077,7 @@ static void drm_connector_cleanup(struct wlr_drm_connector *conn) {
|
||||||
conn->pageflip_pending = false;
|
conn->pageflip_pending = false;
|
||||||
/* Fallthrough */
|
/* Fallthrough */
|
||||||
case WLR_DRM_CONN_NEEDS_MODESET:
|
case WLR_DRM_CONN_NEEDS_MODESET:
|
||||||
wlr_log(L_INFO, "Emitting destruction signal for '%s'",
|
wlr_log(WLR_INFO, "Emitting destruction signal for '%s'",
|
||||||
conn->output.name);
|
conn->output.name);
|
||||||
wlr_signal_emit_safe(&conn->output.events.destroy, &conn->output);
|
wlr_signal_emit_safe(&conn->output.events.destroy, &conn->output);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,13 +12,13 @@ static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm,
|
||||||
if (mode) {
|
if (mode) {
|
||||||
if (drmModeSetCrtc(drm->fd, crtc->id, fb_id, 0, 0,
|
if (drmModeSetCrtc(drm->fd, crtc->id, fb_id, 0, 0,
|
||||||
&conn->id, 1, mode)) {
|
&conn->id, 1, mode)) {
|
||||||
wlr_log_errno(L_ERROR, "%s: Failed to set CRTC", conn->output.name);
|
wlr_log_errno(WLR_ERROR, "%s: Failed to set CRTC", conn->output.name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drmModePageFlip(drm->fd, crtc->id, fb_id, DRM_MODE_PAGE_FLIP_EVENT, conn)) {
|
if (drmModePageFlip(drm->fd, crtc->id, fb_id, DRM_MODE_PAGE_FLIP_EVENT, conn)) {
|
||||||
wlr_log_errno(L_ERROR, "%s: Failed to page flip", conn->output.name);
|
wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
|
||||||
|
|
||||||
if (drmModeSetCursor(drm->fd, crtc->id, gbm_bo_get_handle(bo).u32,
|
if (drmModeSetCursor(drm->fd, crtc->id, gbm_bo_get_handle(bo).u32,
|
||||||
plane->surf.width, plane->surf.height)) {
|
plane->surf.width, plane->surf.height)) {
|
||||||
wlr_log_errno(L_DEBUG, "Failed to set hardware cursor");
|
wlr_log_errno(WLR_DEBUG, "Failed to set hardware cursor");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,14 +63,14 @@ static bool scan_properties(int fd, uint32_t id, uint32_t type, uint32_t *result
|
||||||
const struct prop_info *info, size_t info_len) {
|
const struct prop_info *info, size_t info_len) {
|
||||||
drmModeObjectProperties *props = drmModeObjectGetProperties(fd, id, type);
|
drmModeObjectProperties *props = drmModeObjectGetProperties(fd, id, type);
|
||||||
if (!props) {
|
if (!props) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM object properties");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM object properties");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < props->count_props; ++i) {
|
for (uint32_t i = 0; i < props->count_props; ++i) {
|
||||||
drmModePropertyRes *prop = drmModeGetProperty(fd, props->props[i]);
|
drmModePropertyRes *prop = drmModeGetProperty(fd, props->props[i]);
|
||||||
if (!prop) {
|
if (!prop) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get DRM object property");
|
wlr_log_errno(WLR_ERROR, "Failed to get DRM object property");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ bool init_drm_renderer(struct wlr_drm_backend *drm,
|
||||||
struct wlr_drm_renderer *renderer, wlr_renderer_create_func_t create_renderer_func) {
|
struct wlr_drm_renderer *renderer, wlr_renderer_create_func_t create_renderer_func) {
|
||||||
renderer->gbm = gbm_create_device(drm->fd);
|
renderer->gbm = gbm_create_device(drm->fd);
|
||||||
if (!renderer->gbm) {
|
if (!renderer->gbm) {
|
||||||
wlr_log(L_ERROR, "Failed to create GBM device");
|
wlr_log(WLR_ERROR, "Failed to create GBM device");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ bool init_drm_renderer(struct wlr_drm_backend *drm,
|
||||||
EGL_PLATFORM_GBM_MESA, renderer->gbm, NULL, GBM_FORMAT_ARGB8888);
|
EGL_PLATFORM_GBM_MESA, renderer->gbm, NULL, GBM_FORMAT_ARGB8888);
|
||||||
|
|
||||||
if (!renderer->wlr_rend) {
|
if (!renderer->wlr_rend) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL/WLR renderer");
|
wlr_log(WLR_ERROR, "Failed to create EGL/WLR renderer");
|
||||||
goto error_gbm;
|
goto error_gbm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,13 +83,13 @@ bool init_drm_surface(struct wlr_drm_surface *surf,
|
||||||
surf->gbm = gbm_surface_create(renderer->gbm, width, height,
|
surf->gbm = gbm_surface_create(renderer->gbm, width, height,
|
||||||
format, GBM_BO_USE_RENDERING | flags);
|
format, GBM_BO_USE_RENDERING | flags);
|
||||||
if (!surf->gbm) {
|
if (!surf->gbm) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to create GBM surface");
|
wlr_log_errno(WLR_ERROR, "Failed to create GBM surface");
|
||||||
goto error_zero;
|
goto error_zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
surf->egl = wlr_egl_create_surface(&renderer->egl, surf->gbm);
|
surf->egl = wlr_egl_create_surface(&renderer->egl, surf->gbm);
|
||||||
if (surf->egl == EGL_NO_SURFACE) {
|
if (surf->egl == EGL_NO_SURFACE) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL surface");
|
wlr_log(WLR_ERROR, "Failed to create EGL surface");
|
||||||
goto error_gbm;
|
goto error_gbm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ uint32_t get_fb_for_bo(struct gbm_bo *bo) {
|
||||||
uint32_t format = gbm_bo_get_format(bo);
|
uint32_t format = gbm_bo_get_format(bo);
|
||||||
|
|
||||||
if (drmModeAddFB2(fd, width, height, format, handles, pitches, offsets, &id, 0)) {
|
if (drmModeAddFB2(fd, width, height, format, handles, pitches, offsets, &id, 0)) {
|
||||||
wlr_log_errno(L_ERROR, "Unable to add DRM framebuffer");
|
wlr_log_errno(WLR_ERROR, "Unable to add DRM framebuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
gbm_bo_set_user_data(bo, (void *)(uintptr_t)id, free_fb);
|
gbm_bo_set_user_data(bo, (void *)(uintptr_t)id, free_fb);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
static bool backend_start(struct wlr_backend *wlr_backend) {
|
static bool backend_start(struct wlr_backend *wlr_backend) {
|
||||||
struct wlr_headless_backend *backend =
|
struct wlr_headless_backend *backend =
|
||||||
(struct wlr_headless_backend *)wlr_backend;
|
(struct wlr_headless_backend *)wlr_backend;
|
||||||
wlr_log(L_INFO, "Starting headless backend");
|
wlr_log(WLR_INFO, "Starting headless backend");
|
||||||
|
|
||||||
struct wlr_headless_output *output;
|
struct wlr_headless_output *output;
|
||||||
wl_list_for_each(output, &backend->outputs, link) {
|
wl_list_for_each(output, &backend->outputs, link) {
|
||||||
|
@ -80,12 +80,12 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct wlr_backend *wlr_headless_backend_create(struct wl_display *display,
|
struct wlr_backend *wlr_headless_backend_create(struct wl_display *display,
|
||||||
wlr_renderer_create_func_t create_renderer_func) {
|
wlr_renderer_create_func_t create_renderer_func) {
|
||||||
wlr_log(L_INFO, "Creating headless backend");
|
wlr_log(WLR_INFO, "Creating headless backend");
|
||||||
|
|
||||||
struct wlr_headless_backend *backend =
|
struct wlr_headless_backend *backend =
|
||||||
calloc(1, sizeof(struct wlr_headless_backend));
|
calloc(1, sizeof(struct wlr_headless_backend));
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_headless_backend");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_headless_backend");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_backend_init(&backend->backend, &backend_impl);
|
wlr_backend_init(&backend->backend, &backend_impl);
|
||||||
|
@ -111,7 +111,7 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display,
|
||||||
NULL, (EGLint*)config_attribs, 0);
|
NULL, (EGLint*)config_attribs, 0);
|
||||||
|
|
||||||
if (!backend->renderer) {
|
if (!backend->renderer) {
|
||||||
wlr_log(L_ERROR, "Failed to create renderer");
|
wlr_log(WLR_ERROR, "Failed to create renderer");
|
||||||
free(backend);
|
free(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct wlr_input_device *wlr_headless_add_input_device(
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:
|
||||||
wlr_device->keyboard = calloc(1, sizeof(struct wlr_keyboard));
|
wlr_device->keyboard = calloc(1, sizeof(struct wlr_keyboard));
|
||||||
if (wlr_device->keyboard == NULL) {
|
if (wlr_device->keyboard == NULL) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_keyboard");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_keyboard");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
wlr_keyboard_init(wlr_device->keyboard, NULL);
|
wlr_keyboard_init(wlr_device->keyboard, NULL);
|
||||||
|
@ -46,7 +46,7 @@ struct wlr_input_device *wlr_headless_add_input_device(
|
||||||
case WLR_INPUT_DEVICE_POINTER:
|
case WLR_INPUT_DEVICE_POINTER:
|
||||||
wlr_device->pointer = calloc(1, sizeof(struct wlr_pointer));
|
wlr_device->pointer = calloc(1, sizeof(struct wlr_pointer));
|
||||||
if (wlr_device->pointer == NULL) {
|
if (wlr_device->pointer == NULL) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_pointer");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_pointer");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
wlr_pointer_init(wlr_device->pointer, NULL);
|
wlr_pointer_init(wlr_device->pointer, NULL);
|
||||||
|
@ -54,7 +54,7 @@ struct wlr_input_device *wlr_headless_add_input_device(
|
||||||
case WLR_INPUT_DEVICE_TOUCH:
|
case WLR_INPUT_DEVICE_TOUCH:
|
||||||
wlr_device->touch = calloc(1, sizeof(struct wlr_touch));
|
wlr_device->touch = calloc(1, sizeof(struct wlr_touch));
|
||||||
if (wlr_device->touch == NULL) {
|
if (wlr_device->touch == NULL) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_touch");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_touch");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
wlr_touch_init(wlr_device->touch, NULL);
|
wlr_touch_init(wlr_device->touch, NULL);
|
||||||
|
@ -62,7 +62,7 @@ struct wlr_input_device *wlr_headless_add_input_device(
|
||||||
case WLR_INPUT_DEVICE_TABLET_TOOL:
|
case WLR_INPUT_DEVICE_TABLET_TOOL:
|
||||||
wlr_device->tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
|
wlr_device->tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
|
||||||
if (wlr_device->tablet_tool == NULL) {
|
if (wlr_device->tablet_tool == NULL) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_tablet_tool");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_tool");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
wlr_tablet_tool_init(wlr_device->tablet_tool, NULL);
|
wlr_tablet_tool_init(wlr_device->tablet_tool, NULL);
|
||||||
|
@ -70,7 +70,7 @@ struct wlr_input_device *wlr_headless_add_input_device(
|
||||||
case WLR_INPUT_DEVICE_TABLET_PAD:
|
case WLR_INPUT_DEVICE_TABLET_PAD:
|
||||||
wlr_device->tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));
|
wlr_device->tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));
|
||||||
if (wlr_device->tablet_pad == NULL) {
|
if (wlr_device->tablet_pad == NULL) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_tablet_pad");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_pad");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
wlr_tablet_pad_init(wlr_device->tablet_pad, NULL);
|
wlr_tablet_pad_init(wlr_device->tablet_pad, NULL);
|
||||||
|
|
|
@ -13,7 +13,7 @@ static EGLSurface egl_create_surface(struct wlr_egl *egl, unsigned int width,
|
||||||
|
|
||||||
EGLSurface surf = eglCreatePbufferSurface(egl->display, egl->config, attribs);
|
EGLSurface surf = eglCreatePbufferSurface(egl->display, egl->config, attribs);
|
||||||
if (surf == EGL_NO_SURFACE) {
|
if (surf == EGL_NO_SURFACE) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL surface");
|
wlr_log(WLR_ERROR, "Failed to create EGL surface");
|
||||||
return EGL_NO_SURFACE;
|
return EGL_NO_SURFACE;
|
||||||
}
|
}
|
||||||
return surf;
|
return surf;
|
||||||
|
@ -33,7 +33,7 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width,
|
||||||
|
|
||||||
output->egl_surface = egl_create_surface(&backend->egl, width, height);
|
output->egl_surface = egl_create_surface(&backend->egl, width, height);
|
||||||
if (output->egl_surface == EGL_NO_SURFACE) {
|
if (output->egl_surface == EGL_NO_SURFACE) {
|
||||||
wlr_log(L_ERROR, "Failed to recreate EGL surface");
|
wlr_log(WLR_ERROR, "Failed to recreate EGL surface");
|
||||||
wlr_output_destroy(wlr_output);
|
wlr_output_destroy(wlr_output);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
|
||||||
struct wlr_headless_output *output =
|
struct wlr_headless_output *output =
|
||||||
calloc(1, sizeof(struct wlr_headless_output));
|
calloc(1, sizeof(struct wlr_headless_output));
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_headless_output");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_headless_output");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
output->backend = backend;
|
output->backend = backend;
|
||||||
|
@ -112,7 +112,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
|
||||||
|
|
||||||
output->egl_surface = egl_create_surface(&backend->egl, width, height);
|
output->egl_surface = egl_create_surface(&backend->egl, width, height);
|
||||||
if (output->egl_surface == EGL_NO_SURFACE) {
|
if (output->egl_surface == EGL_NO_SURFACE) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL surface");
|
wlr_log(WLR_ERROR, "Failed to create EGL surface");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ static const struct libinput_interface libinput_impl = {
|
||||||
static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) {
|
static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) {
|
||||||
struct wlr_libinput_backend *backend = _backend;
|
struct wlr_libinput_backend *backend = _backend;
|
||||||
if (libinput_dispatch(backend->libinput_context) != 0) {
|
if (libinput_dispatch(backend->libinput_context) != 0) {
|
||||||
wlr_log(L_ERROR, "Failed to dispatch libinput");
|
wlr_log(WLR_ERROR, "Failed to dispatch libinput");
|
||||||
// TODO: some kind of abort?
|
// TODO: some kind of abort?
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -40,24 +40,24 @@ static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) {
|
||||||
|
|
||||||
static void log_libinput(struct libinput *libinput_context,
|
static void log_libinput(struct libinput *libinput_context,
|
||||||
enum libinput_log_priority priority, const char *fmt, va_list args) {
|
enum libinput_log_priority priority, const char *fmt, va_list args) {
|
||||||
_wlr_vlog(L_ERROR, fmt, args);
|
_wlr_vlog(WLR_ERROR, fmt, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool backend_start(struct wlr_backend *_backend) {
|
static bool backend_start(struct wlr_backend *_backend) {
|
||||||
struct wlr_libinput_backend *backend =
|
struct wlr_libinput_backend *backend =
|
||||||
(struct wlr_libinput_backend *)_backend;
|
(struct wlr_libinput_backend *)_backend;
|
||||||
wlr_log(L_DEBUG, "Initializing libinput");
|
wlr_log(WLR_DEBUG, "Initializing libinput");
|
||||||
|
|
||||||
backend->libinput_context = libinput_udev_create_context(&libinput_impl,
|
backend->libinput_context = libinput_udev_create_context(&libinput_impl,
|
||||||
backend, backend->session->udev);
|
backend, backend->session->udev);
|
||||||
if (!backend->libinput_context) {
|
if (!backend->libinput_context) {
|
||||||
wlr_log(L_ERROR, "Failed to create libinput context");
|
wlr_log(WLR_ERROR, "Failed to create libinput context");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libinput_udev_assign_seat(backend->libinput_context,
|
if (libinput_udev_assign_seat(backend->libinput_context,
|
||||||
backend->session->seat) != 0) {
|
backend->session->seat) != 0) {
|
||||||
wlr_log(L_ERROR, "Failed to assign libinput seat");
|
wlr_log(WLR_ERROR, "Failed to assign libinput seat");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ static bool backend_start(struct wlr_backend *_backend) {
|
||||||
if (!no_devs && backend->wlr_device_lists.length == 0) {
|
if (!no_devs && backend->wlr_device_lists.length == 0) {
|
||||||
handle_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
|
handle_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
|
||||||
if (backend->wlr_device_lists.length == 0) {
|
if (backend->wlr_device_lists.length == 0) {
|
||||||
wlr_log(L_ERROR, "libinput initialization failed, no input devices");
|
wlr_log(WLR_ERROR, "libinput initialization failed, no input devices");
|
||||||
wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check");
|
wlr_log(WLR_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,10 @@ static bool backend_start(struct wlr_backend *_backend) {
|
||||||
backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd,
|
backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd,
|
||||||
WL_EVENT_READABLE, handle_libinput_readable, backend);
|
WL_EVENT_READABLE, handle_libinput_readable, backend);
|
||||||
if (!backend->input_event) {
|
if (!backend->input_event) {
|
||||||
wlr_log(L_ERROR, "Failed to create input event on event loop");
|
wlr_log(WLR_ERROR, "Failed to create input event on event loop");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "libinput successfully initialized");
|
wlr_log(WLR_DEBUG, "libinput successfully initialized");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,13 +162,13 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
|
||||||
|
|
||||||
struct wlr_libinput_backend *backend = calloc(1, sizeof(struct wlr_libinput_backend));
|
struct wlr_libinput_backend *backend = calloc(1, sizeof(struct wlr_libinput_backend));
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
|
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_backend_init(&backend->backend, &backend_impl);
|
wlr_backend_init(&backend->backend, &backend_impl);
|
||||||
|
|
||||||
if (!wlr_list_init(&backend->wlr_device_lists)) {
|
if (!wlr_list_init(&backend->wlr_device_lists)) {
|
||||||
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
|
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||||
goto error_backend;
|
goto error_backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,11 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
|
||||||
const char *name = libinput_device_get_name(libinput_dev);
|
const char *name = libinput_device_get_name(libinput_dev);
|
||||||
struct wl_list *wlr_devices = calloc(1, sizeof(struct wl_list));
|
struct wl_list *wlr_devices = calloc(1, sizeof(struct wl_list));
|
||||||
if (!wlr_devices) {
|
if (!wlr_devices) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_list_init(wlr_devices);
|
wl_list_init(wlr_devices);
|
||||||
wlr_log(L_DEBUG, "Added %s [%d:%d]", name, vendor, product);
|
wlr_log(WLR_DEBUG, "Added %s [%d:%d]", name, vendor, product);
|
||||||
|
|
||||||
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) {
|
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) {
|
||||||
struct wlr_input_device *wlr_dev = allocate_device(backend,
|
struct wlr_input_device *wlr_dev = allocate_device(backend,
|
||||||
|
@ -166,7 +166,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
wlr_log(L_ERROR, "Could not allocate new device");
|
wlr_log(WLR_ERROR, "Could not allocate new device");
|
||||||
struct wlr_input_device *dev, *tmp_dev;
|
struct wlr_input_device *dev, *tmp_dev;
|
||||||
wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) {
|
wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) {
|
||||||
free(dev);
|
free(dev);
|
||||||
|
@ -180,7 +180,7 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
|
||||||
int vendor = libinput_device_get_id_vendor(libinput_dev);
|
int vendor = libinput_device_get_id_vendor(libinput_dev);
|
||||||
int product = libinput_device_get_id_product(libinput_dev);
|
int product = libinput_device_get_id_product(libinput_dev);
|
||||||
const char *name = libinput_device_get_name(libinput_dev);
|
const char *name = libinput_device_get_name(libinput_dev);
|
||||||
wlr_log(L_DEBUG, "Removing %s [%d:%d]", name, vendor, product);
|
wlr_log(WLR_DEBUG, "Removing %s [%d:%d]", name, vendor, product);
|
||||||
if (!wlr_devices) {
|
if (!wlr_devices) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ void handle_libinput_event(struct wlr_libinput_backend *backend,
|
||||||
handle_tablet_pad_strip(event, libinput_dev);
|
handle_tablet_pad_strip(event, libinput_dev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wlr_log(L_DEBUG, "Unknown libinput event %d", event_type);
|
wlr_log(WLR_DEBUG, "Unknown libinput event %d", event_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ void handle_keyboard_key(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_KEYBOARD, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_KEYBOARD, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a keyboard event for a device with no keyboards?");
|
wlr_log(WLR_DEBUG, "Got a keyboard event for a device with no keyboards?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_keyboard *kbevent =
|
struct libinput_event_keyboard *kbevent =
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct wlr_pointer *create_libinput_pointer(
|
||||||
assert(libinput_dev);
|
assert(libinput_dev);
|
||||||
struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer));
|
struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer));
|
||||||
if (!wlr_pointer) {
|
if (!wlr_pointer) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_pointer");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_pointer");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_pointer_init(wlr_pointer, NULL);
|
wlr_pointer_init(wlr_pointer, NULL);
|
||||||
|
@ -25,7 +25,7 @@ void handle_pointer_motion(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a pointer event for a device with no pointers?");
|
wlr_log(WLR_DEBUG, "Got a pointer event for a device with no pointers?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
|
@ -44,7 +44,7 @@ void handle_pointer_motion_abs(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a pointer event for a device with no pointers?");
|
wlr_log(WLR_DEBUG, "Got a pointer event for a device with no pointers?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
|
@ -63,7 +63,7 @@ void handle_pointer_button(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a pointer event for a device with no pointers?");
|
wlr_log(WLR_DEBUG, "Got a pointer event for a device with no pointers?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
|
@ -89,7 +89,7 @@ void handle_pointer_axis(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a pointer event for a device with no pointers?");
|
wlr_log(WLR_DEBUG, "Got a pointer event for a device with no pointers?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct wlr_tablet_pad *create_libinput_tablet_pad(
|
||||||
assert(libinput_dev);
|
assert(libinput_dev);
|
||||||
struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));
|
struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));
|
||||||
if (!wlr_tablet_pad) {
|
if (!wlr_tablet_pad) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_tablet_pad");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_pad");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_tablet_pad_init(wlr_tablet_pad, NULL);
|
wlr_tablet_pad_init(wlr_tablet_pad, NULL);
|
||||||
|
@ -25,7 +25,7 @@ void handle_tablet_pad_button(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_PAD, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_PAD, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a tablet pad event for a device with no tablet pad?");
|
wlr_log(WLR_DEBUG, "Got a tablet pad event for a device with no tablet pad?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_tablet_pad *pevent =
|
struct libinput_event_tablet_pad *pevent =
|
||||||
|
@ -51,7 +51,7 @@ void handle_tablet_pad_ring(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_PAD, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_PAD, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a tablet pad event for a device with no tablet pad?");
|
wlr_log(WLR_DEBUG, "Got a tablet pad event for a device with no tablet pad?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_tablet_pad *pevent =
|
struct libinput_event_tablet_pad *pevent =
|
||||||
|
@ -78,7 +78,7 @@ void handle_tablet_pad_strip(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_PAD, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_PAD, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a tablet pad event for a device with no tablet pad?");
|
wlr_log(WLR_DEBUG, "Got a tablet pad event for a device with no tablet pad?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_tablet_pad *pevent =
|
struct libinput_event_tablet_pad *pevent =
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct wlr_tablet_tool *create_libinput_tablet_tool(
|
||||||
assert(libinput_dev);
|
assert(libinput_dev);
|
||||||
struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
|
struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
|
||||||
if (!wlr_tablet_tool) {
|
if (!wlr_tablet_tool) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_tablet_tool");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_tool");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_tablet_tool_init(wlr_tablet_tool, NULL);
|
wlr_tablet_tool_init(wlr_tablet_tool, NULL);
|
||||||
|
@ -25,7 +25,7 @@ void handle_tablet_tool_axis(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
wlr_log(WLR_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_tablet_tool *tevent =
|
struct libinput_event_tablet_tool *tevent =
|
||||||
|
@ -78,7 +78,7 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
wlr_log(WLR_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_tablet_tool *tevent =
|
struct libinput_event_tablet_tool *tevent =
|
||||||
|
@ -104,7 +104,7 @@ void handle_tablet_tool_tip(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
wlr_log(WLR_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handle_tablet_tool_axis(event, libinput_dev);
|
handle_tablet_tool_axis(event, libinput_dev);
|
||||||
|
@ -130,7 +130,7 @@ void handle_tablet_tool_button(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
wlr_log(WLR_DEBUG, "Got a tablet tool event for a device with no tablet tools?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handle_tablet_tool_axis(event, libinput_dev);
|
handle_tablet_tool_axis(event, libinput_dev);
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct wlr_touch *create_libinput_touch(
|
||||||
assert(libinput_dev);
|
assert(libinput_dev);
|
||||||
struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch));
|
struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch));
|
||||||
if (!wlr_touch) {
|
if (!wlr_touch) {
|
||||||
wlr_log(L_ERROR, "Unable to allocate wlr_touch");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_touch");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_touch_init(wlr_touch, NULL);
|
wlr_touch_init(wlr_touch, NULL);
|
||||||
|
@ -25,7 +25,7 @@ void handle_touch_down(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a touch event for a device with no touch?");
|
wlr_log(WLR_DEBUG, "Got a touch event for a device with no touch?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_touch *tevent =
|
struct libinput_event_touch *tevent =
|
||||||
|
@ -45,7 +45,7 @@ void handle_touch_up(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a touch event for a device with no touch?");
|
wlr_log(WLR_DEBUG, "Got a touch event for a device with no touch?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_touch *tevent =
|
struct libinput_event_touch *tevent =
|
||||||
|
@ -63,7 +63,7 @@ void handle_touch_motion(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a touch event for a device with no touch?");
|
wlr_log(WLR_DEBUG, "Got a touch event for a device with no touch?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_touch *tevent =
|
struct libinput_event_touch *tevent =
|
||||||
|
@ -83,7 +83,7 @@ void handle_touch_cancel(struct libinput_event *event,
|
||||||
struct wlr_input_device *wlr_dev =
|
struct wlr_input_device *wlr_dev =
|
||||||
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
get_appropriate_device(WLR_INPUT_DEVICE_TOUCH, libinput_dev);
|
||||||
if (!wlr_dev) {
|
if (!wlr_dev) {
|
||||||
wlr_log(L_DEBUG, "Got a touch event for a device with no touch?");
|
wlr_log(WLR_DEBUG, "Got a touch event for a device with no touch?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_event_touch *tevent =
|
struct libinput_event_touch *tevent =
|
||||||
|
|
|
@ -22,7 +22,7 @@ static bool multi_backend_start(struct wlr_backend *wlr_backend) {
|
||||||
struct subbackend_state *sub;
|
struct subbackend_state *sub;
|
||||||
wl_list_for_each(sub, &backend->backends, link) {
|
wl_list_for_each(sub, &backend->backends, link) {
|
||||||
if (!wlr_backend_start(sub->backend)) {
|
if (!wlr_backend_start(sub->backend)) {
|
||||||
wlr_log(L_ERROR, "Failed to initialize backend.");
|
wlr_log(WLR_ERROR, "Failed to initialize backend.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
|
||||||
struct wlr_multi_backend *backend =
|
struct wlr_multi_backend *backend =
|
||||||
calloc(1, sizeof(struct wlr_multi_backend));
|
calloc(1, sizeof(struct wlr_multi_backend));
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
wlr_log(L_ERROR, "Backend allocation failed");
|
wlr_log(WLR_ERROR, "Backend allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,14 +144,14 @@ bool wlr_multi_backend_add(struct wlr_backend *_multi,
|
||||||
multi_backend_get_renderer(&multi->backend);
|
multi_backend_get_renderer(&multi->backend);
|
||||||
struct wlr_renderer *backend_renderer = wlr_backend_get_renderer(backend);
|
struct wlr_renderer *backend_renderer = wlr_backend_get_renderer(backend);
|
||||||
if (multi_renderer != NULL && backend_renderer != NULL) {
|
if (multi_renderer != NULL && backend_renderer != NULL) {
|
||||||
wlr_log(L_ERROR, "Could not add backend: multiple renderers at the "
|
wlr_log(WLR_ERROR, "Could not add backend: multiple renderers at the "
|
||||||
"same time aren't supported");
|
"same time aren't supported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct subbackend_state *sub = calloc(1, sizeof(struct subbackend_state));
|
struct subbackend_state *sub = calloc(1, sizeof(struct subbackend_state));
|
||||||
if (sub == NULL) {
|
if (sub == NULL) {
|
||||||
wlr_log(L_ERROR, "Could not add backend: allocation failed");
|
wlr_log(WLR_ERROR, "Could not add backend: allocation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
wl_list_insert(&multi->backends, &sub->link);
|
wl_list_insert(&multi->backends, &sub->link);
|
||||||
|
|
|
@ -35,7 +35,7 @@ static int direct_session_open(struct wlr_session *base, const char *path) {
|
||||||
|
|
||||||
int fd = direct_ipc_open(session->sock, path);
|
int fd = direct_ipc_open(session->sock, path);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to open %s: %s%s", path, strerror(-fd),
|
wlr_log(WLR_ERROR, "Failed to open %s: %s%s", path, strerror(-fd),
|
||||||
fd == -EINVAL ? "; is another display server running?" : "");
|
fd == -EINVAL ? "; is another display server running?" : "");
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ static void direct_session_close(struct wlr_session *base, int fd) {
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd, &st) < 0) {
|
if (fstat(fd, &st) < 0) {
|
||||||
wlr_log_errno(L_ERROR, "Stat failed");
|
wlr_log_errno(WLR_ERROR, "Stat failed");
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ static void direct_session_destroy(struct wlr_session *base) {
|
||||||
ioctl(session->tty_fd, VT_SETMODE, &mode);
|
ioctl(session->tty_fd, VT_SETMODE, &mode);
|
||||||
|
|
||||||
if (errno) {
|
if (errno) {
|
||||||
wlr_log(L_ERROR, "Failed to restore tty");
|
wlr_log(WLR_ERROR, "Failed to restore tty");
|
||||||
}
|
}
|
||||||
|
|
||||||
direct_ipc_finish(session->sock, session->child);
|
direct_ipc_finish(session->sock, session->child);
|
||||||
|
@ -110,21 +110,21 @@ static int vt_handler(int signo, void *data) {
|
||||||
static bool setup_tty(struct direct_session *session, struct wl_display *display) {
|
static bool setup_tty(struct direct_session *session, struct wl_display *display) {
|
||||||
int fd = -1, tty = -1, tty0_fd = -1;
|
int fd = -1, tty = -1, tty0_fd = -1;
|
||||||
if ((tty0_fd = open("/dev/ttyv0", O_RDWR | O_CLOEXEC)) < 0) {
|
if ((tty0_fd = open("/dev/ttyv0", O_RDWR | O_CLOEXEC)) < 0) {
|
||||||
wlr_log_errno(L_ERROR, "Could not open /dev/ttyv0 to find a free vt");
|
wlr_log_errno(WLR_ERROR, "Could not open /dev/ttyv0 to find a free vt");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (ioctl(tty0_fd, VT_OPENQRY, &tty) != 0) {
|
if (ioctl(tty0_fd, VT_OPENQRY, &tty) != 0) {
|
||||||
wlr_log_errno(L_ERROR, "Could not find a free vt");
|
wlr_log_errno(WLR_ERROR, "Could not find a free vt");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
close(tty0_fd);
|
close(tty0_fd);
|
||||||
char tty_path[64];
|
char tty_path[64];
|
||||||
snprintf(tty_path, sizeof(tty_path), "/dev/ttyv%d", tty - 1);
|
snprintf(tty_path, sizeof(tty_path), "/dev/ttyv%d", tty - 1);
|
||||||
wlr_log(L_INFO, "Using tty %s", tty_path);
|
wlr_log(WLR_INFO, "Using tty %s", tty_path);
|
||||||
fd = open(tty_path, O_RDWR | O_NOCTTY | O_CLOEXEC);
|
fd = open(tty_path, O_RDWR | O_NOCTTY | O_CLOEXEC);
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
wlr_log_errno(L_ERROR, "Cannot open tty");
|
wlr_log_errno(WLR_ERROR, "Cannot open tty");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,17 +133,17 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
|
|
||||||
int old_kbmode;
|
int old_kbmode;
|
||||||
if (ioctl(fd, KDGKBMODE, &old_kbmode)) {
|
if (ioctl(fd, KDGKBMODE, &old_kbmode)) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to read tty %d keyboard mode", tty);
|
wlr_log_errno(WLR_ERROR, "Failed to read tty %d keyboard mode", tty);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, KDSKBMODE, K_CODE)) {
|
if (ioctl(fd, KDSKBMODE, K_CODE)) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to set keyboard mode K_CODE on tty %d", tty);
|
wlr_log_errno(WLR_ERROR, "Failed to set keyboard mode K_CODE on tty %d", tty);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, KDSETMODE, KD_GRAPHICS)) {
|
if (ioctl(fd, KDSETMODE, KD_GRAPHICS)) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to set graphics mode on tty %d", tty);
|
wlr_log_errno(WLR_ERROR, "Failed to set graphics mode on tty %d", tty);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ioctl(fd, VT_SETMODE, &mode) < 0) {
|
if (ioctl(fd, VT_SETMODE, &mode) < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to take control of tty %d", tty);
|
wlr_log(WLR_ERROR, "Failed to take control of tty %d", tty);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ error:
|
||||||
static struct wlr_session *direct_session_create(struct wl_display *disp) {
|
static struct wlr_session *direct_session_create(struct wl_display *disp) {
|
||||||
struct direct_session *session = calloc(1, sizeof(*session));
|
struct direct_session *session = calloc(1, sizeof(*session));
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ static struct wlr_session *direct_session_create(struct wl_display *disp) {
|
||||||
goto error_ipc;
|
goto error_ipc;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_INFO, "Successfully loaded direct session");
|
wlr_log(WLR_INFO, "Successfully loaded direct session");
|
||||||
|
|
||||||
snprintf(session->base.seat, sizeof(session->base.seat), "seat0");
|
snprintf(session->base.seat, sizeof(session->base.seat), "seat0");
|
||||||
session->base.impl = &session_direct;
|
session->base.impl = &session_direct;
|
||||||
|
|
|
@ -32,7 +32,7 @@ static bool have_permissions(void) {
|
||||||
cap_flag_value_t val;
|
cap_flag_value_t val;
|
||||||
|
|
||||||
if (!cap || cap_get_flag(cap, CAP_SYS_ADMIN, CAP_PERMITTED, &val) || val != CAP_SET) {
|
if (!cap || cap_get_flag(cap, CAP_SYS_ADMIN, CAP_PERMITTED, &val) || val != CAP_SET) {
|
||||||
wlr_log(L_ERROR, "Do not have CAP_SYS_ADMIN; cannot become DRM master");
|
wlr_log(WLR_ERROR, "Do not have CAP_SYS_ADMIN; cannot become DRM master");
|
||||||
cap_free(cap);
|
cap_free(cap);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ static bool have_permissions(void) {
|
||||||
static bool have_permissions(void) {
|
static bool have_permissions(void) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (geteuid() != 0) {
|
if (geteuid() != 0) {
|
||||||
wlr_log(L_ERROR, "Do not have root privileges; cannot become DRM master");
|
wlr_log(WLR_ERROR, "Do not have root privileges; cannot become DRM master");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -229,13 +229,13 @@ int direct_ipc_init(pid_t *pid_out) {
|
||||||
|
|
||||||
int sock[2];
|
int sock[2];
|
||||||
if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sock) < 0) {
|
if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sock) < 0) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to create socket pair");
|
wlr_log_errno(WLR_ERROR, "Failed to create socket pair");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
wlr_log_errno(L_ERROR, "Fork failed");
|
wlr_log_errno(WLR_ERROR, "Fork failed");
|
||||||
close(sock[0]);
|
close(sock[0]);
|
||||||
close(sock[1]);
|
close(sock[1]);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -38,7 +38,7 @@ static int direct_session_open(struct wlr_session *base, const char *path) {
|
||||||
|
|
||||||
int fd = direct_ipc_open(session->sock, path);
|
int fd = direct_ipc_open(session->sock, path);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to open %s: %s%s", path, strerror(-fd),
|
wlr_log(WLR_ERROR, "Failed to open %s: %s%s", path, strerror(-fd),
|
||||||
fd == -EINVAL ? "; is another display server running?" : "");
|
fd == -EINVAL ? "; is another display server running?" : "");
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ static void direct_session_close(struct wlr_session *base, int fd) {
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd, &st) < 0) {
|
if (fstat(fd, &st) < 0) {
|
||||||
wlr_log_errno(L_ERROR, "Stat failed");
|
wlr_log_errno(WLR_ERROR, "Stat failed");
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ static void direct_session_destroy(struct wlr_session *base) {
|
||||||
ioctl(session->tty_fd, VT_SETMODE, &mode);
|
ioctl(session->tty_fd, VT_SETMODE, &mode);
|
||||||
|
|
||||||
if (errno) {
|
if (errno) {
|
||||||
wlr_log(L_ERROR, "Failed to restore tty");
|
wlr_log(WLR_ERROR, "Failed to restore tty");
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_event_source_remove(session->vt_source);
|
wl_event_source_remove(session->vt_source);
|
||||||
|
@ -150,13 +150,13 @@ static int vt_handler(int signo, void *data) {
|
||||||
static bool setup_tty(struct direct_session *session, struct wl_display *display) {
|
static bool setup_tty(struct direct_session *session, struct wl_display *display) {
|
||||||
int fd = open("/dev/tty", O_RDWR);
|
int fd = open("/dev/tty", O_RDWR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
wlr_log_errno(L_ERROR, "Cannot open /dev/tty");
|
wlr_log_errno(WLR_ERROR, "Cannot open /dev/tty");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct vt_stat vt_stat;
|
struct vt_stat vt_stat;
|
||||||
if (ioctl(fd, VT_GETSTATE, &vt_stat)) {
|
if (ioctl(fd, VT_GETSTATE, &vt_stat)) {
|
||||||
wlr_log_errno(L_ERROR, "Could not get current tty number");
|
wlr_log_errno(WLR_ERROR, "Could not get current tty number");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,12 +165,12 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
|
|
||||||
ret = ioctl(fd, KDGETMODE, &kd_mode);
|
ret = ioctl(fd, KDGETMODE, &kd_mode);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to get tty mode");
|
wlr_log_errno(WLR_ERROR, "Failed to get tty mode");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kd_mode != KD_TEXT) {
|
if (kd_mode != KD_TEXT) {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"tty already in graphics mode; is another display server running?");
|
"tty already in graphics mode; is another display server running?");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -179,17 +179,17 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
ioctl(fd, VT_WAITACTIVE, tty);
|
ioctl(fd, VT_WAITACTIVE, tty);
|
||||||
|
|
||||||
if (ioctl(fd, KDGKBMODE, &old_kbmode)) {
|
if (ioctl(fd, KDGKBMODE, &old_kbmode)) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to read keyboard mode");
|
wlr_log_errno(WLR_ERROR, "Failed to read keyboard mode");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, KDSKBMODE, K_OFF)) {
|
if (ioctl(fd, KDSKBMODE, K_OFF)) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to set keyboard mode");
|
wlr_log_errno(WLR_ERROR, "Failed to set keyboard mode");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, KDSETMODE, KD_GRAPHICS)) {
|
if (ioctl(fd, KDSETMODE, KD_GRAPHICS)) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to set graphics mode on tty");
|
wlr_log_errno(WLR_ERROR, "Failed to set graphics mode on tty");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ioctl(fd, VT_SETMODE, &mode) < 0) {
|
if (ioctl(fd, VT_SETMODE, &mode) < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to take control of tty");
|
wlr_log(WLR_ERROR, "Failed to take control of tty");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ error:
|
||||||
static struct wlr_session *direct_session_create(struct wl_display *disp) {
|
static struct wlr_session *direct_session_create(struct wl_display *disp) {
|
||||||
struct direct_session *session = calloc(1, sizeof(*session));
|
struct direct_session *session = calloc(1, sizeof(*session));
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ static struct wlr_session *direct_session_create(struct wl_display *disp) {
|
||||||
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
|
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
|
||||||
session->base.impl = &session_direct;
|
session->base.impl = &session_direct;
|
||||||
|
|
||||||
wlr_log(L_INFO, "Successfully loaded direct session");
|
wlr_log(WLR_INFO, "Successfully loaded direct session");
|
||||||
return &session->base;
|
return &session->base;
|
||||||
|
|
||||||
error_ipc:
|
error_ipc:
|
||||||
|
|
|
@ -47,7 +47,7 @@ static int logind_take_device(struct wlr_session *base, const char *path) {
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(path, &st) < 0) {
|
if (stat(path, &st) < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to stat '%s'", path);
|
wlr_log(WLR_ERROR, "Failed to stat '%s'", path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,14 +55,14 @@ static int logind_take_device(struct wlr_session *base, const char *path) {
|
||||||
session->path, "org.freedesktop.login1.Session", "TakeDevice",
|
session->path, "org.freedesktop.login1.Session", "TakeDevice",
|
||||||
&error, &msg, "uu", major(st.st_rdev), minor(st.st_rdev));
|
&error, &msg, "uu", major(st.st_rdev), minor(st.st_rdev));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to take device '%s': %s", path, error.message);
|
wlr_log(WLR_ERROR, "Failed to take device '%s': %s", path, error.message);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int paused = 0;
|
int paused = 0;
|
||||||
ret = sd_bus_message_read(msg, "hb", &fd, &paused);
|
ret = sd_bus_message_read(msg, "hb", &fd, &paused);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to parse D-Bus response for '%s': %s",
|
wlr_log(WLR_ERROR, "Failed to parse D-Bus response for '%s': %s",
|
||||||
path, strerror(-ret));
|
path, strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ static int logind_take_device(struct wlr_session *base, const char *path) {
|
||||||
// so we just clone it.
|
// so we just clone it.
|
||||||
fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
wlr_log(L_ERROR, "Failed to clone file descriptor for '%s': %s",
|
wlr_log(WLR_ERROR, "Failed to clone file descriptor for '%s': %s",
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ static void logind_release_device(struct wlr_session *base, int fd) {
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd, &st) < 0) {
|
if (fstat(fd, &st) < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to stat device '%d'", fd);
|
wlr_log(WLR_ERROR, "Failed to stat device '%d'", fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ static void logind_release_device(struct wlr_session *base, int fd) {
|
||||||
session->path, "org.freedesktop.login1.Session", "ReleaseDevice",
|
session->path, "org.freedesktop.login1.Session", "ReleaseDevice",
|
||||||
&error, &msg, "uu", major(st.st_rdev), minor(st.st_rdev));
|
&error, &msg, "uu", major(st.st_rdev), minor(st.st_rdev));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to release device '%d'", fd);
|
wlr_log(WLR_ERROR, "Failed to release device '%d'", fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
|
@ -123,7 +123,7 @@ static bool logind_change_vt(struct wlr_session *base, unsigned vt) {
|
||||||
"/org/freedesktop/login1/seat/self", "org.freedesktop.login1.Seat", "SwitchTo",
|
"/org/freedesktop/login1/seat/self", "org.freedesktop.login1.Seat", "SwitchTo",
|
||||||
&error, &msg, "u", (uint32_t)vt);
|
&error, &msg, "u", (uint32_t)vt);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to change to vt '%d'", vt);
|
wlr_log(WLR_ERROR, "Failed to change to vt '%d'", vt);
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
|
@ -140,7 +140,7 @@ static bool find_session_path(struct logind_session *session) {
|
||||||
"/org/freedesktop/login1", "org.freedesktop.login1.Manager",
|
"/org/freedesktop/login1", "org.freedesktop.login1.Manager",
|
||||||
"GetSession", &error, &msg, "s", session->id);
|
"GetSession", &error, &msg, "s", session->id);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to get session path: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Failed to get session path: %s", strerror(-ret));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ static bool find_session_path(struct logind_session *session) {
|
||||||
|
|
||||||
ret = sd_bus_message_read(msg, "o", &path);
|
ret = sd_bus_message_read(msg, "o", &path);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Could not parse session path: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Could not parse session path: %s", strerror(-ret));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ static bool session_activate(struct logind_session *session) {
|
||||||
session->path, "org.freedesktop.login1.Session", "Activate",
|
session->path, "org.freedesktop.login1.Session", "Activate",
|
||||||
&error, &msg, "");
|
&error, &msg, "");
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to activate session");
|
wlr_log(WLR_ERROR, "Failed to activate session");
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
|
@ -187,7 +187,7 @@ static bool take_control(struct logind_session *session) {
|
||||||
session->path, "org.freedesktop.login1.Session", "TakeControl",
|
session->path, "org.freedesktop.login1.Session", "TakeControl",
|
||||||
&error, &msg, "b", false);
|
&error, &msg, "b", false);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to take control of session");
|
wlr_log(WLR_ERROR, "Failed to take control of session");
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
|
@ -204,7 +204,7 @@ static void release_control(struct logind_session *session) {
|
||||||
session->path, "org.freedesktop.login1.Session", "ReleaseControl",
|
session->path, "org.freedesktop.login1.Session", "ReleaseControl",
|
||||||
&error, &msg, "");
|
&error, &msg, "");
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to release control of session");
|
wlr_log(WLR_ERROR, "Failed to release control of session");
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
|
@ -224,7 +224,7 @@ static void logind_session_destroy(struct wlr_session *base) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int session_removed(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error) {
|
static int session_removed(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error) {
|
||||||
wlr_log(L_INFO, "SessionRemoved signal received");
|
wlr_log(WLR_INFO, "SessionRemoved signal received");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ static struct wlr_device *find_device(struct wlr_session *session, dev_t devnum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_ERROR, "Tried to use dev_t %lu not opened by session",
|
wlr_log(WLR_ERROR, "Tried to use dev_t %lu not opened by session",
|
||||||
(unsigned long)devnum);
|
(unsigned long)devnum);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ static int pause_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_e
|
||||||
const char *type;
|
const char *type;
|
||||||
ret = sd_bus_message_read(msg, "uus", &major, &minor, &type);
|
ret = sd_bus_message_read(msg, "uus", &major, &minor, &type);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to parse D-Bus response for PauseDevice: %s",
|
wlr_log(WLR_ERROR, "Failed to parse D-Bus response for PauseDevice: %s",
|
||||||
strerror(-ret));
|
strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ static int pause_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_e
|
||||||
session->path, "org.freedesktop.login1.Session", "PauseDeviceComplete",
|
session->path, "org.freedesktop.login1.Session", "PauseDeviceComplete",
|
||||||
ret_error, &msg, "uu", major, minor);
|
ret_error, &msg, "uu", major, minor);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to send PauseDeviceComplete signal: %s",
|
wlr_log(WLR_ERROR, "Failed to send PauseDeviceComplete signal: %s",
|
||||||
strerror(-ret));
|
strerror(-ret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ static int resume_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_
|
||||||
uint32_t major, minor;
|
uint32_t major, minor;
|
||||||
ret = sd_bus_message_read(msg, "uuh", &major, &minor, &fd);
|
ret = sd_bus_message_read(msg, "uuh", &major, &minor, &fd);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to parse D-Bus response for ResumeDevice: %s",
|
wlr_log(WLR_ERROR, "Failed to parse D-Bus response for ResumeDevice: %s",
|
||||||
strerror(-ret));
|
strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -314,21 +314,21 @@ static bool add_signal_matches(struct logind_session *session) {
|
||||||
snprintf(str, sizeof(str), fmt, "Manager", "SessionRemoved", "/org/freedesktop/login1");
|
snprintf(str, sizeof(str), fmt, "Manager", "SessionRemoved", "/org/freedesktop/login1");
|
||||||
ret = sd_bus_add_match(session->bus, NULL, str, session_removed, session);
|
ret = sd_bus_add_match(session->bus, NULL, str, session_removed, session);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(str, sizeof(str), fmt, "Session", "PauseDevice", session->path);
|
snprintf(str, sizeof(str), fmt, "Session", "PauseDevice", session->path);
|
||||||
ret = sd_bus_add_match(session->bus, NULL, str, pause_device, session);
|
ret = sd_bus_add_match(session->bus, NULL, str, pause_device, session);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(str, sizeof(str), fmt, "Session", "ResumeDevice", session->path);
|
snprintf(str, sizeof(str), fmt, "Session", "ResumeDevice", session->path);
|
||||||
ret = sd_bus_add_match(session->bus, NULL, str, resume_device, session);
|
ret = sd_bus_add_match(session->bus, NULL, str, resume_device, session);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,20 +347,20 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) {
|
||||||
int ret;
|
int ret;
|
||||||
struct logind_session *session = calloc(1, sizeof(*session));
|
struct logind_session *session = calloc(1, sizeof(*session));
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
|
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_pid_get_session(getpid(), &session->id);
|
ret = sd_pid_get_session(getpid(), &session->id);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to get session id: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Failed to get session id: %s", strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *seat;
|
char *seat;
|
||||||
ret = sd_session_get_seat(session->id, &seat);
|
ret = sd_session_get_seat(session->id, &seat);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Failed to get seat id: %s", strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
|
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
|
||||||
|
@ -368,7 +368,7 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) {
|
||||||
if (strcmp(seat, "seat0") == 0) {
|
if (strcmp(seat, "seat0") == 0) {
|
||||||
ret = sd_session_get_vt(session->id, &session->base.vtnr);
|
ret = sd_session_get_vt(session->id, &session->base.vtnr);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Session not running in virtual terminal");
|
wlr_log(WLR_ERROR, "Session not running in virtual terminal");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) {
|
||||||
|
|
||||||
ret = sd_bus_default_system(&session->bus);
|
ret = sd_bus_default_system(&session->bus);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(L_ERROR, "Failed to open D-Bus connection: %s", strerror(-ret));
|
wlr_log(WLR_ERROR, "Failed to open D-Bus connection: %s", strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) {
|
||||||
goto error_bus;
|
goto error_bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_INFO, "Successfully loaded logind session");
|
wlr_log(WLR_INFO, "Successfully loaded logind session");
|
||||||
|
|
||||||
session->base.impl = &session_logind;
|
session->base.impl = &session_logind;
|
||||||
return &session->base;
|
return &session->base;
|
||||||
|
|
|
@ -36,7 +36,7 @@ static int udev_event(int fd, uint32_t mask, void *data) {
|
||||||
|
|
||||||
const char *action = udev_device_get_action(udev_dev);
|
const char *action = udev_device_get_action(udev_dev);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "udev event for %s (%s)",
|
wlr_log(WLR_DEBUG, "udev event for %s (%s)",
|
||||||
udev_device_get_sysname(udev_dev), action);
|
udev_device_get_sysname(udev_dev), action);
|
||||||
|
|
||||||
if (!action || strcmp(action, "change") != 0) {
|
if (!action || strcmp(action, "change") != 0) {
|
||||||
|
@ -73,7 +73,7 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log(L_ERROR, "Failed to load session backend");
|
wlr_log(WLR_ERROR, "Failed to load session backend");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,13 +83,13 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) {
|
||||||
|
|
||||||
session->udev = udev_new();
|
session->udev = udev_new();
|
||||||
if (!session->udev) {
|
if (!session->udev) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to create udev context");
|
wlr_log_errno(WLR_ERROR, "Failed to create udev context");
|
||||||
goto error_session;
|
goto error_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->mon = udev_monitor_new_from_netlink(session->udev, "udev");
|
session->mon = udev_monitor_new_from_netlink(session->udev, "udev");
|
||||||
if (!session->mon) {
|
if (!session->mon) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to create udev monitor");
|
wlr_log_errno(WLR_ERROR, "Failed to create udev monitor");
|
||||||
goto error_udev;
|
goto error_udev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) {
|
||||||
session->udev_event = wl_event_loop_add_fd(event_loop, fd,
|
session->udev_event = wl_event_loop_add_fd(event_loop, fd,
|
||||||
WL_EVENT_READABLE, udev_event, session);
|
WL_EVENT_READABLE, udev_event, session);
|
||||||
if (!session->udev_event) {
|
if (!session->udev_event) {
|
||||||
wlr_log_errno(L_ERROR, "Failed to create udev event source");
|
wlr_log_errno(WLR_ERROR, "Failed to create udev event source");
|
||||||
goto error_mon;
|
goto error_mon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,13 +142,13 @@ int wlr_session_open_file(struct wlr_session *session, const char *path) {
|
||||||
|
|
||||||
struct wlr_device *dev = malloc(sizeof(*dev));
|
struct wlr_device *dev = malloc(sizeof(*dev));
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd, &st) < 0) {
|
if (fstat(fd, &st) < 0) {
|
||||||
wlr_log_errno(L_ERROR, "Stat failed");
|
wlr_log_errno(WLR_ERROR, "Stat failed");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ static struct wlr_device *find_device(struct wlr_session *session, int fd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_ERROR, "Tried to use fd %d not opened by session", fd);
|
wlr_log(WLR_ERROR, "Tried to use fd %d not opened by session", fd);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ static size_t explicit_find_gpus(struct wlr_session *session,
|
||||||
size_t ret_len, int ret[static ret_len], const char *str) {
|
size_t ret_len, int ret[static ret_len], const char *str) {
|
||||||
char *gpus = strdup(str);
|
char *gpus = strdup(str);
|
||||||
if (!gpus) {
|
if (!gpus) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ static size_t explicit_find_gpus(struct wlr_session *session,
|
||||||
|
|
||||||
ret[i] = open_if_kms(session, ptr);
|
ret[i] = open_if_kms(session, ptr);
|
||||||
if (ret[i] < 0) {
|
if (ret[i] < 0) {
|
||||||
wlr_log(L_ERROR, "Unable to open %s as DRM device", ptr);
|
wlr_log(WLR_ERROR, "Unable to open %s as DRM device", ptr);
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ size_t wlr_session_find_gpus(struct wlr_session *session,
|
||||||
|
|
||||||
struct udev_enumerate *en = udev_enumerate_new(session->udev);
|
struct udev_enumerate *en = udev_enumerate_new(session->udev);
|
||||||
if (!en) {
|
if (!en) {
|
||||||
wlr_log(L_ERROR, "Failed to create udev enumeration");
|
wlr_log(WLR_ERROR, "Failed to create udev enumeration");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,11 @@ static int dispatch_events(int fd, uint32_t mask, void *data) {
|
||||||
*/
|
*/
|
||||||
static bool backend_start(struct wlr_backend *_backend) {
|
static bool backend_start(struct wlr_backend *_backend) {
|
||||||
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
|
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
|
||||||
wlr_log(L_INFO, "Initializating wayland backend");
|
wlr_log(WLR_INFO, "Initializating wayland backend");
|
||||||
|
|
||||||
poll_wl_registry(backend);
|
poll_wl_registry(backend);
|
||||||
if (!backend->compositor || !backend->shell) {
|
if (!backend->compositor || !backend->shell) {
|
||||||
wlr_log_errno(L_ERROR, "Could not obtain retrieve required globals");
|
wlr_log_errno(WLR_ERROR, "Could not obtain retrieve required globals");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,11 +140,11 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
||||||
const char *remote, wlr_renderer_create_func_t create_renderer_func) {
|
const char *remote, wlr_renderer_create_func_t create_renderer_func) {
|
||||||
wlr_log(L_INFO, "Creating wayland backend");
|
wlr_log(WLR_INFO, "Creating wayland backend");
|
||||||
|
|
||||||
struct wlr_wl_backend *backend = calloc(1, sizeof(struct wlr_wl_backend));
|
struct wlr_wl_backend *backend = calloc(1, sizeof(struct wlr_wl_backend));
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
|
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_backend_init(&backend->backend, &backend_impl);
|
wlr_backend_init(&backend->backend, &backend_impl);
|
||||||
|
@ -156,13 +156,13 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
||||||
|
|
||||||
backend->remote_display = wl_display_connect(remote);
|
backend->remote_display = wl_display_connect(remote);
|
||||||
if (!backend->remote_display) {
|
if (!backend->remote_display) {
|
||||||
wlr_log_errno(L_ERROR, "Could not connect to remote display");
|
wlr_log_errno(WLR_ERROR, "Could not connect to remote display");
|
||||||
goto error_connect;
|
goto error_connect;
|
||||||
}
|
}
|
||||||
|
|
||||||
backend->registry = wl_display_get_registry(backend->remote_display);
|
backend->registry = wl_display_get_registry(backend->remote_display);
|
||||||
if (backend->registry == NULL) {
|
if (backend->registry == NULL) {
|
||||||
wlr_log_errno(L_ERROR, "Could not obtain reference to remote registry");
|
wlr_log_errno(WLR_ERROR, "Could not obtain reference to remote registry");
|
||||||
goto error_registry;
|
goto error_registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
||||||
backend->remote_display, config_attribs, WL_SHM_FORMAT_ARGB8888);
|
backend->remote_display, config_attribs, WL_SHM_FORMAT_ARGB8888);
|
||||||
|
|
||||||
if (backend->renderer == NULL) {
|
if (backend->renderer == NULL) {
|
||||||
wlr_log(L_ERROR, "Could not create renderer");
|
wlr_log(WLR_ERROR, "Could not create renderer");
|
||||||
goto error_renderer;
|
goto error_renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ static bool output_swap_buffers(struct wlr_output *wlr_output,
|
||||||
(struct wlr_wl_output *)wlr_output;
|
(struct wlr_wl_output *)wlr_output;
|
||||||
|
|
||||||
if (output->frame_callback != NULL) {
|
if (output->frame_callback != NULL) {
|
||||||
wlr_log(L_ERROR, "Skipping buffer swap");
|
wlr_log(WLR_ERROR, "Skipping buffer swap");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
|
||||||
|
|
||||||
struct wlr_wl_output *output;
|
struct wlr_wl_output *output;
|
||||||
if (!(output = calloc(sizeof(struct wlr_wl_output), 1))) {
|
if (!(output = calloc(sizeof(struct wlr_wl_output), 1))) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_wl_output");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_wl_output");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_output_init(&output->wlr_output, &backend->backend, &output_impl,
|
wlr_output_init(&output->wlr_output, &backend->backend, &output_impl,
|
||||||
|
@ -267,20 +267,20 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
|
||||||
|
|
||||||
output->surface = wl_compositor_create_surface(backend->compositor);
|
output->surface = wl_compositor_create_surface(backend->compositor);
|
||||||
if (!output->surface) {
|
if (!output->surface) {
|
||||||
wlr_log_errno(L_ERROR, "Could not create output surface");
|
wlr_log_errno(WLR_ERROR, "Could not create output surface");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
wl_surface_set_user_data(output->surface, output);
|
wl_surface_set_user_data(output->surface, output);
|
||||||
output->xdg_surface =
|
output->xdg_surface =
|
||||||
zxdg_shell_v6_get_xdg_surface(backend->shell, output->surface);
|
zxdg_shell_v6_get_xdg_surface(backend->shell, output->surface);
|
||||||
if (!output->xdg_surface) {
|
if (!output->xdg_surface) {
|
||||||
wlr_log_errno(L_ERROR, "Could not get xdg surface");
|
wlr_log_errno(WLR_ERROR, "Could not get xdg surface");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
output->xdg_toplevel =
|
output->xdg_toplevel =
|
||||||
zxdg_surface_v6_get_toplevel(output->xdg_surface);
|
zxdg_surface_v6_get_toplevel(output->xdg_surface);
|
||||||
if (!output->xdg_toplevel) {
|
if (!output->xdg_toplevel) {
|
||||||
wlr_log_errno(L_ERROR, "Could not get xdg toplevel");
|
wlr_log_errno(WLR_ERROR, "Could not get xdg toplevel");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ static const struct zxdg_shell_v6_listener xdg_shell_listener = {
|
||||||
static void registry_global(void *data, struct wl_registry *registry,
|
static void registry_global(void *data, struct wl_registry *registry,
|
||||||
uint32_t name, const char *interface, uint32_t version) {
|
uint32_t name, const char *interface, uint32_t version) {
|
||||||
struct wlr_wl_backend *backend = data;
|
struct wlr_wl_backend *backend = data;
|
||||||
wlr_log(L_DEBUG, "Remote wayland global: %s v%d", interface, version);
|
wlr_log(WLR_DEBUG, "Remote wayland global: %s v%d", interface, version);
|
||||||
|
|
||||||
if (strcmp(interface, wl_compositor_interface.name) == 0) {
|
if (strcmp(interface, wl_compositor_interface.name) == 0) {
|
||||||
backend->compositor = wl_registry_bind(registry, name,
|
backend->compositor = wl_registry_bind(registry, name,
|
||||||
|
|
|
@ -275,7 +275,7 @@ static struct wlr_wl_input_device *create_wl_input_device(
|
||||||
struct wlr_wl_input_device *dev =
|
struct wlr_wl_input_device *dev =
|
||||||
calloc(1, sizeof(struct wlr_wl_input_device));
|
calloc(1, sizeof(struct wlr_wl_input_device));
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dev->backend = backend;
|
dev->backend = backend;
|
||||||
|
@ -331,7 +331,7 @@ void create_wl_pointer(struct wl_pointer *wl_pointer,
|
||||||
|
|
||||||
struct wlr_wl_pointer *pointer = calloc(1, sizeof(struct wlr_wl_pointer));
|
struct wlr_wl_pointer *pointer = calloc(1, sizeof(struct wlr_wl_pointer));
|
||||||
if (pointer == NULL) {
|
if (pointer == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pointer->wl_pointer = wl_pointer;
|
pointer->wl_pointer = wl_pointer;
|
||||||
|
@ -344,7 +344,7 @@ void create_wl_pointer(struct wl_pointer *wl_pointer,
|
||||||
create_wl_input_device(backend, WLR_INPUT_DEVICE_POINTER);
|
create_wl_input_device(backend, WLR_INPUT_DEVICE_POINTER);
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
free(pointer);
|
free(pointer);
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pointer->input_device = dev;
|
pointer->input_device = dev;
|
||||||
|
@ -363,7 +363,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
||||||
assert(backend->seat == wl_seat);
|
assert(backend->seat == wl_seat);
|
||||||
|
|
||||||
if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
|
if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
|
||||||
wlr_log(L_DEBUG, "seat %p offered pointer", (void*) wl_seat);
|
wlr_log(WLR_DEBUG, "seat %p offered pointer", (void*) wl_seat);
|
||||||
|
|
||||||
struct wl_pointer *wl_pointer = wl_seat_get_pointer(wl_seat);
|
struct wl_pointer *wl_pointer = wl_seat_get_pointer(wl_seat);
|
||||||
backend->pointer = wl_pointer;
|
backend->pointer = wl_pointer;
|
||||||
|
@ -376,18 +376,18 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
||||||
wl_pointer_add_listener(wl_pointer, &pointer_listener, backend);
|
wl_pointer_add_listener(wl_pointer, &pointer_listener, backend);
|
||||||
}
|
}
|
||||||
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
||||||
wlr_log(L_DEBUG, "seat %p offered keyboard", (void*) wl_seat);
|
wlr_log(WLR_DEBUG, "seat %p offered keyboard", (void*) wl_seat);
|
||||||
struct wlr_wl_input_device *dev = create_wl_input_device(backend,
|
struct wlr_wl_input_device *dev = create_wl_input_device(backend,
|
||||||
WLR_INPUT_DEVICE_KEYBOARD);
|
WLR_INPUT_DEVICE_KEYBOARD);
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
|
struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
|
||||||
wlr_dev->keyboard = calloc(1, sizeof(struct wlr_keyboard));
|
wlr_dev->keyboard = calloc(1, sizeof(struct wlr_keyboard));
|
||||||
if (!wlr_dev->keyboard) {
|
if (!wlr_dev->keyboard) {
|
||||||
free(dev);
|
free(dev);
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_keyboard_init(wlr_dev->keyboard, NULL);
|
wlr_keyboard_init(wlr_dev->keyboard, NULL);
|
||||||
|
|
|
@ -244,13 +244,13 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||||
|
|
||||||
x11->xlib_conn = XOpenDisplay(x11_display);
|
x11->xlib_conn = XOpenDisplay(x11_display);
|
||||||
if (!x11->xlib_conn) {
|
if (!x11->xlib_conn) {
|
||||||
wlr_log(L_ERROR, "Failed to open X connection");
|
wlr_log(WLR_ERROR, "Failed to open X connection");
|
||||||
goto error_x11;
|
goto error_x11;
|
||||||
}
|
}
|
||||||
|
|
||||||
x11->xcb_conn = XGetXCBConnection(x11->xlib_conn);
|
x11->xcb_conn = XGetXCBConnection(x11->xlib_conn);
|
||||||
if (!x11->xcb_conn || xcb_connection_has_error(x11->xcb_conn)) {
|
if (!x11->xcb_conn || xcb_connection_has_error(x11->xcb_conn)) {
|
||||||
wlr_log(L_ERROR, "Failed to open xcb connection");
|
wlr_log(WLR_ERROR, "Failed to open xcb connection");
|
||||||
goto error_display;
|
goto error_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||||
int events = WL_EVENT_READABLE | WL_EVENT_ERROR | WL_EVENT_HANGUP;
|
int events = WL_EVENT_READABLE | WL_EVENT_ERROR | WL_EVENT_HANGUP;
|
||||||
x11->event_source = wl_event_loop_add_fd(ev, fd, events, x11_event, x11);
|
x11->event_source = wl_event_loop_add_fd(ev, fd, events, x11_event, x11);
|
||||||
if (!x11->event_source) {
|
if (!x11->event_source) {
|
||||||
wlr_log(L_ERROR, "Could not create event source");
|
wlr_log(WLR_ERROR, "Could not create event source");
|
||||||
goto error_display;
|
goto error_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||||
x11->xlib_conn, NULL, x11->screen->root_visual);
|
x11->xlib_conn, NULL, x11->screen->root_visual);
|
||||||
|
|
||||||
if (x11->renderer == NULL) {
|
if (x11->renderer == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to create renderer");
|
wlr_log(WLR_ERROR, "Failed to create renderer");
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
|
||||||
|
|
||||||
output->surf = wlr_egl_create_surface(&x11->egl, &output->win);
|
output->surf = wlr_egl_create_surface(&x11->egl, &output->win);
|
||||||
if (!output->surf) {
|
if (!output->surf) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL surface");
|
wlr_log(WLR_ERROR, "Failed to create EGL surface");
|
||||||
free(output);
|
free(output);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ void *main_loop(void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
|
|
||||||
if (parse_args(argc, argv) != 0) {
|
if (parse_args(argc, argv) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -179,7 +179,7 @@ static const struct xdg_surface_listener xdg_surface_listener = {
|
||||||
|
|
||||||
static void xdg_popup_configure(void *data, struct xdg_popup *xdg_popup,
|
static void xdg_popup_configure(void *data, struct xdg_popup *xdg_popup,
|
||||||
int32_t x, int32_t y, int32_t width, int32_t height) {
|
int32_t x, int32_t y, int32_t width, int32_t height) {
|
||||||
wlr_log(L_DEBUG, "Popup configured %dx%d@%d,%d",
|
wlr_log(WLR_DEBUG, "Popup configured %dx%d@%d,%d",
|
||||||
width, height, x, y);
|
width, height, x, y);
|
||||||
popup_width = width;
|
popup_width = width;
|
||||||
popup_height = height;
|
popup_height = height;
|
||||||
|
@ -199,7 +199,7 @@ static void popup_destroy(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_popup_done(void *data, struct xdg_popup *xdg_popup) {
|
static void xdg_popup_done(void *data, struct xdg_popup *xdg_popup) {
|
||||||
wlr_log(L_DEBUG, "Popup done");
|
wlr_log(WLR_DEBUG, "Popup done");
|
||||||
popup_destroy();
|
popup_destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,17 +378,17 @@ static void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
|
|
||||||
static void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard,
|
static void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
uint32_t serial, struct wl_surface *surface, struct wl_array *keys) {
|
uint32_t serial, struct wl_surface *surface, struct wl_array *keys) {
|
||||||
wlr_log(L_DEBUG, "Keyboard enter");
|
wlr_log(WLR_DEBUG, "Keyboard enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard,
|
static void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
uint32_t serial, struct wl_surface *surface) {
|
uint32_t serial, struct wl_surface *surface) {
|
||||||
wlr_log(L_DEBUG, "Keyboard leave");
|
wlr_log(WLR_DEBUG, "Keyboard leave");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
|
static void wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
uint32_t serial, uint32_t time, uint32_t key, uint32_t state) {
|
uint32_t serial, uint32_t time, uint32_t key, uint32_t state) {
|
||||||
wlr_log(L_DEBUG, "Key event: %d %d", key, state);
|
wlr_log(WLR_DEBUG, "Key event: %d %d", key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard,
|
static void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
|
@ -474,7 +474,7 @@ static const struct wl_registry_listener registry_listener = {
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
char *namespace = "wlroots";
|
char *namespace = "wlroots";
|
||||||
int exclusive_zone = 0;
|
int exclusive_zone = 0;
|
||||||
int32_t margin_right = 0, margin_bottom = 0, margin_left = 0;
|
int32_t margin_right = 0, margin_bottom = 0, margin_left = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct sample_keyboard {
|
||||||
void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device,
|
void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device,
|
||||||
struct sample_state *sample) {
|
struct sample_state *sample) {
|
||||||
struct sample_output *output;
|
struct sample_output *output;
|
||||||
wlr_log(L_ERROR, "Configuring cursor %p for device %p", cursor, device);
|
wlr_log(WLR_ERROR, "Configuring cursor %p for device %p", cursor, device);
|
||||||
|
|
||||||
// reset mappings
|
// reset mappings
|
||||||
wlr_cursor_map_to_output(cursor, NULL);
|
wlr_cursor_map_to_output(cursor, NULL);
|
||||||
|
@ -237,7 +237,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
||||||
|
@ -277,7 +277,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
struct wl_display *display = wl_display_create();
|
struct wl_display *display = wl_display_create();
|
||||||
struct sample_state state = {
|
struct sample_state state = {
|
||||||
.default_color = { 0.25f, 0.25f, 0.25f, 1 },
|
.default_color = { 0.25f, 0.25f, 0.25f, 1 },
|
||||||
|
@ -303,17 +303,17 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
struct wlr_xcursor_theme *theme = wlr_xcursor_theme_load("default", 16);
|
struct wlr_xcursor_theme *theme = wlr_xcursor_theme_load("default", 16);
|
||||||
if (!theme) {
|
if (!theme) {
|
||||||
wlr_log(L_ERROR, "Failed to load cursor theme");
|
wlr_log(WLR_ERROR, "Failed to load cursor theme");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
state.xcursor = wlr_xcursor_theme_get_cursor(theme, "left_ptr");
|
state.xcursor = wlr_xcursor_theme_get_cursor(theme, "left_ptr");
|
||||||
if (!state.xcursor) {
|
if (!state.xcursor) {
|
||||||
wlr_log(L_ERROR, "Failed to load left_ptr cursor");
|
wlr_log(WLR_ERROR, "Failed to load left_ptr cursor");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_backend_start(wlr)) {
|
if (!wlr_backend_start(wlr)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
||||||
|
@ -250,7 +250,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
struct wl_display *display = wl_display_create();
|
struct wl_display *display = wl_display_create();
|
||||||
struct sample_state state = {
|
struct sample_state state = {
|
||||||
.x_vel = 500,
|
.x_vel = 500,
|
||||||
|
@ -277,7 +277,7 @@ int main(int argc, char *argv[]) {
|
||||||
cat_tex.pixel_data);
|
cat_tex.pixel_data);
|
||||||
|
|
||||||
if (!wlr_backend_start(wlr)) {
|
if (!wlr_backend_start(wlr)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_touch_cancel(struct wl_listener *listener, void *data) {
|
static void handle_touch_cancel(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(L_DEBUG, "TODO: touch cancel");
|
wlr_log(WLR_DEBUG, "TODO: touch cancel");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
|
static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
|
||||||
|
@ -302,7 +302,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
||||||
|
@ -316,7 +316,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
struct wl_display *display = wl_display_create();
|
struct wl_display *display = wl_display_create();
|
||||||
struct sample_state state = {
|
struct sample_state state = {
|
||||||
.default_color = { 0.25f, 0.25f, 0.25f, 1 },
|
.default_color = { 0.25f, 0.25f, 0.25f, 1 },
|
||||||
|
@ -375,7 +375,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
state.xcursor_manager = wlr_xcursor_manager_create("default", 24);
|
state.xcursor_manager = wlr_xcursor_manager_create("default", 24);
|
||||||
if (!state.xcursor_manager) {
|
if (!state.xcursor_manager) {
|
||||||
wlr_log(L_ERROR, "Failed to load left_ptr cursor");
|
wlr_log(WLR_ERROR, "Failed to load left_ptr cursor");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ int main(int argc, char *argv[]) {
|
||||||
clock_gettime(CLOCK_MONOTONIC, &state.last_frame);
|
clock_gettime(CLOCK_MONOTONIC, &state.last_frame);
|
||||||
|
|
||||||
if (!wlr_backend_start(wlr)) {
|
if (!wlr_backend_start(wlr)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
||||||
|
@ -220,14 +220,14 @@ int main(int argc, char *argv[]) {
|
||||||
} else if (strcmp(optarg, "flipped-270") == 0) {
|
} else if (strcmp(optarg, "flipped-270") == 0) {
|
||||||
transform = WL_OUTPUT_TRANSFORM_FLIPPED_270;
|
transform = WL_OUTPUT_TRANSFORM_FLIPPED_270;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown transform value: %s", optarg);
|
wlr_log(WLR_ERROR, "got unknown transform value: %s", optarg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
struct wl_display *display = wl_display_create();
|
struct wl_display *display = wl_display_create();
|
||||||
struct sample_state state = {
|
struct sample_state state = {
|
||||||
.display = display,
|
.display = display,
|
||||||
|
@ -248,7 +248,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
state.renderer = wlr_backend_get_renderer(wlr);
|
state.renderer = wlr_backend_get_renderer(wlr);
|
||||||
if (!state.renderer) {
|
if (!state.renderer) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(WLR_ERROR, "Could not start compositor, OOM");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -256,12 +256,12 @@ int main(int argc, char *argv[]) {
|
||||||
WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
|
WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
|
||||||
cat_tex.pixel_data);
|
cat_tex.pixel_data);
|
||||||
if (!state.cat_texture) {
|
if (!state.cat_texture) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(WLR_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_backend_start(wlr)) {
|
if (!wlr_backend_start(wlr)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ static void write_image(const char *filename, int width, int height,
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
|
|
||||||
struct wl_display * display = wl_display_connect(NULL);
|
struct wl_display * display = wl_display_connect(NULL);
|
||||||
if (display == NULL) {
|
if (display == NULL) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct sample_keyboard {
|
||||||
};
|
};
|
||||||
|
|
||||||
void output_frame_notify(struct wl_listener *listener, void *data) {
|
void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(L_DEBUG, "Output removed");
|
wlr_log(WLR_DEBUG, "Output removed");
|
||||||
struct sample_output *sample_output = wl_container_of(listener, sample_output, frame);
|
struct sample_output *sample_output = wl_container_of(listener, sample_output, frame);
|
||||||
struct sample_state *sample = sample_output->sample;
|
struct sample_state *sample = sample_output->sample;
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
|
@ -131,7 +131,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
||||||
|
@ -144,7 +144,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
struct wl_display *display = wl_display_create();
|
struct wl_display *display = wl_display_create();
|
||||||
struct sample_state state = {
|
struct sample_state state = {
|
||||||
.color = { 1.0, 0.0, 0.0 },
|
.color = { 1.0, 0.0, 0.0 },
|
||||||
|
@ -163,7 +163,7 @@ int main(void) {
|
||||||
clock_gettime(CLOCK_MONOTONIC, &state.last_frame);
|
clock_gettime(CLOCK_MONOTONIC, &state.last_frame);
|
||||||
|
|
||||||
if (!wlr_backend_start(wlr)) {
|
if (!wlr_backend_start(wlr)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,7 +295,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
||||||
|
@ -340,7 +340,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
struct wl_display *display = wl_display_create();
|
struct wl_display *display = wl_display_create();
|
||||||
struct sample_state state = {
|
struct sample_state state = {
|
||||||
.display = display,
|
.display = display,
|
||||||
|
@ -362,11 +362,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
state.renderer = wlr_backend_get_renderer(wlr);
|
state.renderer = wlr_backend_get_renderer(wlr);
|
||||||
if (!state.renderer) {
|
if (!state.renderer) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(WLR_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (!wlr_backend_start(wlr)) {
|
if (!wlr_backend_start(wlr)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
||||||
|
@ -236,7 +236,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
struct wl_display *display = wl_display_create();
|
struct wl_display *display = wl_display_create();
|
||||||
struct sample_state state = {
|
struct sample_state state = {
|
||||||
.display = display
|
.display = display
|
||||||
|
@ -258,19 +258,19 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
state.renderer = wlr_backend_get_renderer(wlr);
|
state.renderer = wlr_backend_get_renderer(wlr);
|
||||||
if (!state.renderer) {
|
if (!state.renderer) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(WLR_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
state.cat_texture = wlr_texture_from_pixels(state.renderer,
|
state.cat_texture = wlr_texture_from_pixels(state.renderer,
|
||||||
WL_SHM_FORMAT_ARGB8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
|
WL_SHM_FORMAT_ARGB8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
|
||||||
cat_tex.pixel_data);
|
cat_tex.pixel_data);
|
||||||
if (!state.cat_texture) {
|
if (!state.cat_texture) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(WLR_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_backend_start(wlr)) {
|
if (!wlr_backend_start(wlr)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(wlr);
|
wlr_backend_destroy(wlr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
2
glgen.sh
2
glgen.sh
|
@ -26,7 +26,7 @@ DECL_FMT='extern %s %s;'
|
||||||
DEFN_FMT='%s %s;'
|
DEFN_FMT='%s %s;'
|
||||||
LOADER_FMT='%s = (%s)eglGetProcAddress("%s");'
|
LOADER_FMT='%s = (%s)eglGetProcAddress("%s");'
|
||||||
CHECK_FMT='if (!%s) {
|
CHECK_FMT='if (!%s) {
|
||||||
wlr_log(L_ERROR, "Unable to load %s");
|
wlr_log(WLR_ERROR, "Unable to load %s");
|
||||||
return false;
|
return false;
|
||||||
}'
|
}'
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ struct wlr_gles2_texture *get_gles2_texture_in_context(
|
||||||
|
|
||||||
void push_gles2_marker(const char *file, const char *func);
|
void push_gles2_marker(const char *file, const char *func);
|
||||||
void pop_gles2_marker(void);
|
void pop_gles2_marker(void);
|
||||||
#define PUSH_GLES2_DEBUG push_gles2_marker(wlr_strip_path(__FILE__), __func__)
|
#define PUSH_GLES2_DEBUG push_gles2_marker(_wlr_strip_path(__FILE__), __func__)
|
||||||
#define POP_GLES2_DEBUG pop_gles2_marker()
|
#define POP_GLES2_DEBUG pop_gles2_marker()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,35 +6,36 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
typedef enum {
|
enum wlr_log_importance {
|
||||||
L_SILENT = 0,
|
WLR_SILENT = 0,
|
||||||
L_ERROR = 1,
|
WLR_ERROR = 1,
|
||||||
L_INFO = 2,
|
WLR_INFO = 2,
|
||||||
L_DEBUG = 3,
|
WLR_DEBUG = 3,
|
||||||
L_LAST,
|
WLR_LOG_IMPORTANCE_LAST,
|
||||||
} log_importance_t;
|
};
|
||||||
|
|
||||||
typedef void (*log_callback_t)(log_importance_t importance, const char *fmt, va_list args);
|
typedef void (*wlr_log_func_t)(enum wlr_log_importance importance,
|
||||||
|
const char *fmt, va_list args);
|
||||||
|
|
||||||
// Will log all messages less than or equal to `verbosity`
|
// Will log all messages less than or equal to `verbosity`
|
||||||
// If `callback` is NULL, wlr will use its default logger.
|
// If `callback` is NULL, wlr will use its default logger.
|
||||||
void wlr_log_init(log_importance_t verbosity, log_callback_t callback);
|
void wlr_log_init(enum wlr_log_importance verbosity, wlr_log_func_t callback);
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
|
#define _WLR_ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
|
||||||
#else
|
#else
|
||||||
#define ATTRIB_PRINTF(start, end)
|
#define _WLR_ATTRIB_PRINTF(start, end)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void _wlr_log(log_importance_t verbosity, const char *format, ...) ATTRIB_PRINTF(2, 3);
|
void _wlr_log(enum wlr_log_importance verbosity, const char *format, ...) _WLR_ATTRIB_PRINTF(2, 3);
|
||||||
void _wlr_vlog(log_importance_t verbosity, const char *format, va_list args) ATTRIB_PRINTF(2, 0);
|
void _wlr_vlog(enum wlr_log_importance verbosity, const char *format, va_list args) _WLR_ATTRIB_PRINTF(2, 0);
|
||||||
const char *wlr_strip_path(const char *filepath);
|
const char *_wlr_strip_path(const char *filepath);
|
||||||
|
|
||||||
#define wlr_log(verb, fmt, ...) \
|
#define wlr_log(verb, fmt, ...) \
|
||||||
_wlr_log(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
|
_wlr_log(verb, "[%s:%d] " fmt, _wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
|
||||||
|
|
||||||
#define wlr_vlog(verb, fmt, args) \
|
#define wlr_vlog(verb, fmt, args) \
|
||||||
_wlr_vlog(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, args)
|
_wlr_vlog(verb, "[%s:%d] " fmt, _wlr_strip_path(__FILE__), __LINE__, args)
|
||||||
|
|
||||||
#define wlr_log_errno(verb, fmt, ...) \
|
#define wlr_log_errno(verb, fmt, ...) \
|
||||||
wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno))
|
wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno))
|
||||||
|
|
68
render/egl.c
68
render/egl.c
|
@ -13,7 +13,7 @@ static bool egl_get_config(EGLDisplay disp, EGLint *attribs, EGLConfig *out,
|
||||||
|
|
||||||
ret = eglGetConfigs(disp, NULL, 0, &count);
|
ret = eglGetConfigs(disp, NULL, 0, &count);
|
||||||
if (ret == EGL_FALSE || count == 0) {
|
if (ret == EGL_FALSE || count == 0) {
|
||||||
wlr_log(L_ERROR, "eglGetConfigs returned no configs");
|
wlr_log(WLR_ERROR, "eglGetConfigs returned no configs");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ static bool egl_get_config(EGLDisplay disp, EGLint *attribs, EGLConfig *out,
|
||||||
|
|
||||||
ret = eglChooseConfig(disp, attribs, configs, count, &matched);
|
ret = eglChooseConfig(disp, attribs, configs, count, &matched);
|
||||||
if (ret == EGL_FALSE) {
|
if (ret == EGL_FALSE) {
|
||||||
wlr_log(L_ERROR, "eglChooseConfig failed");
|
wlr_log(WLR_ERROR, "eglChooseConfig failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,17 +38,17 @@ static bool egl_get_config(EGLDisplay disp, EGLint *attribs, EGLConfig *out,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_ERROR, "no valid egl config found");
|
wlr_log(WLR_ERROR, "no valid egl config found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static log_importance_t egl_log_importance_to_wlr(EGLint type) {
|
static enum wlr_log_importance egl_log_importance_to_wlr(EGLint type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EGL_DEBUG_MSG_CRITICAL_KHR: return L_ERROR;
|
case EGL_DEBUG_MSG_CRITICAL_KHR: return WLR_ERROR;
|
||||||
case EGL_DEBUG_MSG_ERROR_KHR: return L_ERROR;
|
case EGL_DEBUG_MSG_ERROR_KHR: return WLR_ERROR;
|
||||||
case EGL_DEBUG_MSG_WARN_KHR: return L_ERROR;
|
case EGL_DEBUG_MSG_WARN_KHR: return WLR_ERROR;
|
||||||
case EGL_DEBUG_MSG_INFO_KHR: return L_INFO;
|
case EGL_DEBUG_MSG_INFO_KHR: return WLR_INFO;
|
||||||
default: return L_INFO;
|
default: return WLR_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ static void print_dmabuf_formats(struct wlr_egl *egl) {
|
||||||
snprintf(&str_formats[i*5], (num - i) * 5 + 1, "%.4s ",
|
snprintf(&str_formats[i*5], (num - i) * 5 + 1, "%.4s ",
|
||||||
(char*)&formats[i]);
|
(char*)&formats[i]);
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "Supported dmabuf buffer formats: %s", str_formats);
|
wlr_log(WLR_DEBUG, "Supported dmabuf buffer formats: %s", str_formats);
|
||||||
free(formats);
|
free(formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
|
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
|
||||||
wlr_log(L_ERROR, "Failed to bind to the OpenGL ES API");
|
wlr_log(WLR_ERROR, "Failed to bind to the OpenGL ES API");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,26 +125,26 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
egl->display = eglGetPlatformDisplayEXT(platform, remote_display, NULL);
|
egl->display = eglGetPlatformDisplayEXT(platform, remote_display, NULL);
|
||||||
}
|
}
|
||||||
if (egl->display == EGL_NO_DISPLAY) {
|
if (egl->display == EGL_NO_DISPLAY) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL display");
|
wlr_log(WLR_ERROR, "Failed to create EGL display");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint major, minor;
|
EGLint major, minor;
|
||||||
if (eglInitialize(egl->display, &major, &minor) == EGL_FALSE) {
|
if (eglInitialize(egl->display, &major, &minor) == EGL_FALSE) {
|
||||||
wlr_log(L_ERROR, "Failed to initialize EGL");
|
wlr_log(WLR_ERROR, "Failed to initialize EGL");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!egl_get_config(egl->display, config_attribs, &egl->config, visual_id)) {
|
if (!egl_get_config(egl->display, config_attribs, &egl->config, visual_id)) {
|
||||||
wlr_log(L_ERROR, "Failed to get EGL config");
|
wlr_log(WLR_ERROR, "Failed to get EGL config");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
egl->exts_str = eglQueryString(egl->display, EGL_EXTENSIONS);
|
egl->exts_str = eglQueryString(egl->display, EGL_EXTENSIONS);
|
||||||
|
|
||||||
wlr_log(L_INFO, "Using EGL %d.%d", (int)major, (int)minor);
|
wlr_log(WLR_INFO, "Using EGL %d.%d", (int)major, (int)minor);
|
||||||
wlr_log(L_INFO, "Supported EGL extensions: %s", egl->exts_str);
|
wlr_log(WLR_INFO, "Supported EGL extensions: %s", egl->exts_str);
|
||||||
wlr_log(L_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
|
wlr_log(WLR_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
|
||||||
|
|
||||||
egl->exts.image_base_khr =
|
egl->exts.image_base_khr =
|
||||||
check_egl_ext(egl->exts_str, "EGL_KHR_image_base")
|
check_egl_ext(egl->exts_str, "EGL_KHR_image_base")
|
||||||
|
@ -201,7 +201,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
egl->context = eglCreateContext(egl->display, egl->config,
|
egl->context = eglCreateContext(egl->display, egl->config,
|
||||||
EGL_NO_CONTEXT, attribs);
|
EGL_NO_CONTEXT, attribs);
|
||||||
if (egl->context == EGL_NO_CONTEXT) {
|
if (egl->context == EGL_NO_CONTEXT) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL context");
|
wlr_log(WLR_ERROR, "Failed to create EGL context");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,15 +210,15 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
eglQueryContext(egl->display, egl->context,
|
eglQueryContext(egl->display, egl->context,
|
||||||
EGL_CONTEXT_PRIORITY_LEVEL_IMG, &priority);
|
EGL_CONTEXT_PRIORITY_LEVEL_IMG, &priority);
|
||||||
if (priority != EGL_CONTEXT_PRIORITY_HIGH_IMG) {
|
if (priority != EGL_CONTEXT_PRIORITY_HIGH_IMG) {
|
||||||
wlr_log(L_INFO, "Failed to obtain a high priority context");
|
wlr_log(WLR_INFO, "Failed to obtain a high priority context");
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "Obtained high priority context");
|
wlr_log(WLR_DEBUG, "Obtained high priority context");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
if (!eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
egl->context)) {
|
egl->context)) {
|
||||||
wlr_log(L_ERROR, "Failed to make EGL context current");
|
wlr_log(WLR_ERROR, "Failed to make EGL context current");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window) {
|
||||||
EGLSurface surf = eglCreatePlatformWindowSurfaceEXT(egl->display,
|
EGLSurface surf = eglCreatePlatformWindowSurfaceEXT(egl->display,
|
||||||
egl->config, window, NULL);
|
egl->config, window, NULL);
|
||||||
if (surf == EGL_NO_SURFACE) {
|
if (surf == EGL_NO_SURFACE) {
|
||||||
wlr_log(L_ERROR, "Failed to create EGL surface");
|
wlr_log(WLR_ERROR, "Failed to create EGL surface");
|
||||||
return EGL_NO_SURFACE;
|
return EGL_NO_SURFACE;
|
||||||
}
|
}
|
||||||
return surf;
|
return surf;
|
||||||
|
@ -292,7 +292,7 @@ static int egl_get_buffer_age(struct wlr_egl *egl, EGLSurface surface) {
|
||||||
EGLBoolean ok = eglQuerySurface(egl->display, surface,
|
EGLBoolean ok = eglQuerySurface(egl->display, surface,
|
||||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
wlr_log(L_ERROR, "Failed to get EGL surface buffer age");
|
wlr_log(WLR_ERROR, "Failed to get EGL surface buffer age");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ static int egl_get_buffer_age(struct wlr_egl *egl, EGLSurface surface) {
|
||||||
bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface,
|
bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface,
|
||||||
int *buffer_age) {
|
int *buffer_age) {
|
||||||
if (!eglMakeCurrent(egl->display, surface, surface, egl->context)) {
|
if (!eglMakeCurrent(egl->display, surface, surface, egl->context)) {
|
||||||
wlr_log(L_ERROR, "eglMakeCurrent failed");
|
wlr_log(WLR_ERROR, "eglMakeCurrent failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
wlr_log(L_ERROR, "eglSwapBuffers failed");
|
wlr_log(WLR_ERROR, "eglSwapBuffers failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -462,24 +462,24 @@ int wlr_egl_get_dmabuf_formats(struct wlr_egl *egl,
|
||||||
int **formats) {
|
int **formats) {
|
||||||
if (!egl->exts.image_dmabuf_import_ext ||
|
if (!egl->exts.image_dmabuf_import_ext ||
|
||||||
!egl->exts.image_dmabuf_import_modifiers_ext) {
|
!egl->exts.image_dmabuf_import_modifiers_ext) {
|
||||||
wlr_log(L_DEBUG, "dmabuf extension not present");
|
wlr_log(WLR_DEBUG, "dmabuf extension not present");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint num;
|
EGLint num;
|
||||||
if (!eglQueryDmaBufFormatsEXT(egl->display, 0, NULL, &num)) {
|
if (!eglQueryDmaBufFormatsEXT(egl->display, 0, NULL, &num)) {
|
||||||
wlr_log(L_ERROR, "failed to query number of dmabuf formats");
|
wlr_log(WLR_ERROR, "failed to query number of dmabuf formats");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*formats = calloc(num, sizeof(int));
|
*formats = calloc(num, sizeof(int));
|
||||||
if (*formats == NULL) {
|
if (*formats == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
|
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglQueryDmaBufFormatsEXT(egl->display, num, *formats, &num)) {
|
if (!eglQueryDmaBufFormatsEXT(egl->display, num, *formats, &num)) {
|
||||||
wlr_log(L_ERROR, "failed to query dmabuf format");
|
wlr_log(WLR_ERROR, "failed to query dmabuf format");
|
||||||
free(*formats);
|
free(*formats);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -490,26 +490,26 @@ int wlr_egl_get_dmabuf_modifiers(struct wlr_egl *egl,
|
||||||
int format, uint64_t **modifiers) {
|
int format, uint64_t **modifiers) {
|
||||||
if (!egl->exts.image_dmabuf_import_ext ||
|
if (!egl->exts.image_dmabuf_import_ext ||
|
||||||
!egl->exts.image_dmabuf_import_modifiers_ext) {
|
!egl->exts.image_dmabuf_import_modifiers_ext) {
|
||||||
wlr_log(L_DEBUG, "dmabuf extension not present");
|
wlr_log(WLR_DEBUG, "dmabuf extension not present");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint num;
|
EGLint num;
|
||||||
if (!eglQueryDmaBufModifiersEXT(egl->display, format, 0,
|
if (!eglQueryDmaBufModifiersEXT(egl->display, format, 0,
|
||||||
NULL, NULL, &num)) {
|
NULL, NULL, &num)) {
|
||||||
wlr_log(L_ERROR, "failed to query dmabuf number of modifiers");
|
wlr_log(WLR_ERROR, "failed to query dmabuf number of modifiers");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*modifiers = calloc(num, sizeof(uint64_t));
|
*modifiers = calloc(num, sizeof(uint64_t));
|
||||||
if (*modifiers == NULL) {
|
if (*modifiers == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
|
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglQueryDmaBufModifiersEXT(egl->display, format, num,
|
if (!eglQueryDmaBufModifiersEXT(egl->display, format, num,
|
||||||
*modifiers, NULL, &num)) {
|
*modifiers, NULL, &num)) {
|
||||||
wlr_log(L_ERROR, "failed to query dmabuf modifiers");
|
wlr_log(WLR_ERROR, "failed to query dmabuf modifiers");
|
||||||
free(*modifiers);
|
free(*modifiers);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ bool wlr_egl_export_image_to_dmabuf(struct wlr_egl *egl, EGLImageKHR image,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (attribs->n_planes > WLR_DMABUF_MAX_PLANES) {
|
if (attribs->n_planes > WLR_DMABUF_MAX_PLANES) {
|
||||||
wlr_log(L_ERROR, "EGL returned %d planes, but only %d are supported",
|
wlr_log(WLR_ERROR, "EGL returned %d planes, but only %d are supported",
|
||||||
attribs->n_planes, WLR_DMABUF_MAX_PLANES);
|
attribs->n_planes, WLR_DMABUF_MAX_PLANES);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
|
||||||
|
|
||||||
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
|
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
|
||||||
if (fmt == NULL) {
|
if (fmt == NULL) {
|
||||||
wlr_log(L_ERROR, "Cannot read pixels: unsupported pixel format");
|
wlr_log(WLR_ERROR, "Cannot read pixels: unsupported pixel format");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ static void gles2_init_wl_display(struct wlr_renderer *wlr_renderer,
|
||||||
struct wlr_gles2_renderer *renderer =
|
struct wlr_gles2_renderer *renderer =
|
||||||
gles2_get_renderer_in_context(wlr_renderer);
|
gles2_get_renderer_in_context(wlr_renderer);
|
||||||
if (!wlr_egl_bind_display(renderer->egl, wl_display)) {
|
if (!wlr_egl_bind_display(renderer->egl, wl_display)) {
|
||||||
wlr_log(L_INFO, "failed to bind wl_display to EGL");
|
wlr_log(WLR_INFO, "failed to bind wl_display to EGL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,18 +389,18 @@ void pop_gles2_marker(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static log_importance_t gles2_log_importance_to_wlr(GLenum type) {
|
static enum wlr_log_importance gles2_log_importance_to_wlr(GLenum type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GL_DEBUG_TYPE_ERROR_KHR: return L_ERROR;
|
case GL_DEBUG_TYPE_ERROR_KHR: return WLR_ERROR;
|
||||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR: return L_DEBUG;
|
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR: return WLR_DEBUG;
|
||||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR: return L_ERROR;
|
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR: return WLR_ERROR;
|
||||||
case GL_DEBUG_TYPE_PORTABILITY_KHR: return L_DEBUG;
|
case GL_DEBUG_TYPE_PORTABILITY_KHR: return WLR_DEBUG;
|
||||||
case GL_DEBUG_TYPE_PERFORMANCE_KHR: return L_DEBUG;
|
case GL_DEBUG_TYPE_PERFORMANCE_KHR: return WLR_DEBUG;
|
||||||
case GL_DEBUG_TYPE_OTHER_KHR: return L_DEBUG;
|
case GL_DEBUG_TYPE_OTHER_KHR: return WLR_DEBUG;
|
||||||
case GL_DEBUG_TYPE_MARKER_KHR: return L_DEBUG;
|
case GL_DEBUG_TYPE_MARKER_KHR: return WLR_DEBUG;
|
||||||
case GL_DEBUG_TYPE_PUSH_GROUP_KHR: return L_DEBUG;
|
case GL_DEBUG_TYPE_PUSH_GROUP_KHR: return WLR_DEBUG;
|
||||||
case GL_DEBUG_TYPE_POP_GROUP_KHR: return L_DEBUG;
|
case GL_DEBUG_TYPE_POP_GROUP_KHR: return WLR_DEBUG;
|
||||||
default: return L_DEBUG;
|
default: return WLR_DEBUG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,9 +490,9 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
|
||||||
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
|
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
|
||||||
|
|
||||||
renderer->exts_str = (const char*) glGetString(GL_EXTENSIONS);
|
renderer->exts_str = (const char*) glGetString(GL_EXTENSIONS);
|
||||||
wlr_log(L_INFO, "Using %s", glGetString(GL_VERSION));
|
wlr_log(WLR_INFO, "Using %s", glGetString(GL_VERSION));
|
||||||
wlr_log(L_INFO, "GL vendor: %s", glGetString(GL_VENDOR));
|
wlr_log(WLR_INFO, "GL vendor: %s", glGetString(GL_VENDOR));
|
||||||
wlr_log(L_INFO, "Supported GLES2 extensions: %s", renderer->exts_str);
|
wlr_log(WLR_INFO, "Supported GLES2 extensions: %s", renderer->exts_str);
|
||||||
|
|
||||||
if (glDebugMessageCallbackKHR && glDebugMessageControlKHR) {
|
if (glDebugMessageCallbackKHR && glDebugMessageControlKHR) {
|
||||||
glEnable(GL_DEBUG_OUTPUT_KHR);
|
glEnable(GL_DEBUG_OUTPUT_KHR);
|
||||||
|
|
|
@ -44,13 +44,13 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
|
||||||
get_gles2_texture_in_context(wlr_texture);
|
get_gles2_texture_in_context(wlr_texture);
|
||||||
|
|
||||||
if (texture->type != WLR_GLES2_TEXTURE_GLTEX) {
|
if (texture->type != WLR_GLES2_TEXTURE_GLTEX) {
|
||||||
wlr_log(L_ERROR, "Cannot write pixels to immutable texture");
|
wlr_log(WLR_ERROR, "Cannot write pixels to immutable texture");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
|
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
|
||||||
if (fmt == NULL) {
|
if (fmt == NULL) {
|
||||||
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
|
wlr_log(WLR_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,14 +141,14 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
|
||||||
|
|
||||||
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
|
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
|
||||||
if (fmt == NULL) {
|
if (fmt == NULL) {
|
||||||
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
|
wlr_log(WLR_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_gles2_texture *texture =
|
struct wlr_gles2_texture *texture =
|
||||||
calloc(1, sizeof(struct wlr_gles2_texture));
|
calloc(1, sizeof(struct wlr_gles2_texture));
|
||||||
if (texture == NULL) {
|
if (texture == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_texture_init(&texture->wlr_texture, &texture_impl);
|
wlr_texture_init(&texture->wlr_texture, &texture_impl);
|
||||||
|
@ -183,7 +183,7 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
|
||||||
struct wlr_gles2_texture *texture =
|
struct wlr_gles2_texture *texture =
|
||||||
calloc(1, sizeof(struct wlr_gles2_texture));
|
calloc(1, sizeof(struct wlr_gles2_texture));
|
||||||
if (texture == NULL) {
|
if (texture == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_texture_init(&texture->wlr_texture, &texture_impl);
|
wlr_texture_init(&texture->wlr_texture, &texture_impl);
|
||||||
|
@ -212,7 +212,7 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
|
||||||
texture->has_alpha = true;
|
texture->has_alpha = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wlr_log(L_ERROR, "Invalid or unsupported EGL buffer format");
|
wlr_log(WLR_ERROR, "Invalid or unsupported EGL buffer format");
|
||||||
free(texture);
|
free(texture);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!egl->exts.image_dmabuf_import_ext) {
|
if (!egl->exts.image_dmabuf_import_ext) {
|
||||||
wlr_log(L_ERROR, "Cannot create DMA-BUF texture: EGL extension "
|
wlr_log(WLR_ERROR, "Cannot create DMA-BUF texture: EGL extension "
|
||||||
"unavailable");
|
"unavailable");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
|
||||||
struct wlr_gles2_texture *texture =
|
struct wlr_gles2_texture *texture =
|
||||||
calloc(1, sizeof(struct wlr_gles2_texture));
|
calloc(1, sizeof(struct wlr_gles2_texture));
|
||||||
if (texture == NULL) {
|
if (texture == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_texture_init(&texture->wlr_texture, &texture_impl);
|
wlr_texture_init(&texture->wlr_texture, &texture_impl);
|
||||||
|
|
|
@ -28,10 +28,10 @@ bool _gles2_flush_errors(const char *file, int line) {
|
||||||
failure = true;
|
failure = true;
|
||||||
if (err == GL_OUT_OF_MEMORY) {
|
if (err == GL_OUT_OF_MEMORY) {
|
||||||
// The OpenGL context is now undefined
|
// The OpenGL context is now undefined
|
||||||
_wlr_log(L_ERROR, "[%s:%d] Fatal GL error: out of memory", file, line);
|
_wlr_log(WLR_ERROR, "[%s:%d] Fatal GL error: out of memory", file, line);
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
_wlr_log(L_ERROR, "[%s:%d] GL error %d %s", file, line, err, gles2_strerror(err));
|
_wlr_log(WLR_ERROR, "[%s:%d] GL error %d %s", file, line, err, gles2_strerror(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return failure;
|
return failure;
|
||||||
|
|
|
@ -157,14 +157,14 @@ bool wlr_renderer_format_supported(struct wlr_renderer *r,
|
||||||
void wlr_renderer_init_wl_display(struct wlr_renderer *r,
|
void wlr_renderer_init_wl_display(struct wlr_renderer *r,
|
||||||
struct wl_display *wl_display) {
|
struct wl_display *wl_display) {
|
||||||
if (wl_display_init_shm(wl_display)) {
|
if (wl_display_init_shm(wl_display)) {
|
||||||
wlr_log(L_ERROR, "Failed to initialize shm");
|
wlr_log(WLR_ERROR, "Failed to initialize shm");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len;
|
size_t len;
|
||||||
const enum wl_shm_format *formats = wlr_renderer_get_formats(r, &len);
|
const enum wl_shm_format *formats = wlr_renderer_get_formats(r, &len);
|
||||||
if (formats == NULL) {
|
if (formats == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to initialize shm: cannot get formats");
|
wlr_log(WLR_ERROR, "Failed to initialize shm: cannot get formats");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ struct wlr_renderer *wlr_renderer_autocreate(struct wlr_egl *egl,
|
||||||
EGLenum platform, void *remote_display, EGLint *config_attribs,
|
EGLenum platform, void *remote_display, EGLint *config_attribs,
|
||||||
EGLint visual_id) {
|
EGLint visual_id) {
|
||||||
if (!wlr_egl_init(egl, platform, remote_display, config_attribs, visual_id)) {
|
if (!wlr_egl_init(egl, platform, remote_display, config_attribs, visual_id)) {
|
||||||
wlr_log(L_ERROR, "Could not initialize EGL");
|
wlr_log(WLR_ERROR, "Could not initialize EGL");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ static void usage(const char *name, int ret) {
|
||||||
static struct wlr_box *parse_geometry(const char *str) {
|
static struct wlr_box *parse_geometry(const char *str) {
|
||||||
// format: {width}x{height}+{x}+{y}
|
// format: {width}x{height}+{x}+{y}
|
||||||
if (strlen(str) > 255) {
|
if (strlen(str) > 255) {
|
||||||
wlr_log(L_ERROR, "cannot parse geometry string, too long");
|
wlr_log(WLR_ERROR, "cannot parse geometry string, too long");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ static struct wlr_box *parse_geometry(const char *str) {
|
||||||
return box;
|
return box;
|
||||||
|
|
||||||
invalid_input:
|
invalid_input:
|
||||||
wlr_log(L_ERROR, "could not parse geometry string: %s", str);
|
wlr_log(WLR_ERROR, "could not parse geometry string: %s", str);
|
||||||
free(buf);
|
free(buf);
|
||||||
free(box);
|
free(box);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -177,7 +177,7 @@ void add_binding_config(struct wl_list *bindings, const char* combination,
|
||||||
xkb_keysym_t sym = xkb_keysym_from_name(symname,
|
xkb_keysym_t sym = xkb_keysym_from_name(symname,
|
||||||
XKB_KEYSYM_NO_FLAGS);
|
XKB_KEYSYM_NO_FLAGS);
|
||||||
if (sym == XKB_KEY_NoSymbol) {
|
if (sym == XKB_KEY_NoSymbol) {
|
||||||
wlr_log(L_ERROR, "got unknown key binding symbol: %s",
|
wlr_log(WLR_ERROR, "got unknown key binding symbol: %s",
|
||||||
symname);
|
symname);
|
||||||
free(bc);
|
free(bc);
|
||||||
bc = NULL;
|
bc = NULL;
|
||||||
|
@ -228,7 +228,7 @@ static void config_handle_cursor(struct roots_config *config,
|
||||||
free(cc->default_image);
|
free(cc->default_image);
|
||||||
cc->default_image = strdup(value);
|
cc->default_image = strdup(value);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown cursor config: %s", name);
|
wlr_log(WLR_ERROR, "got unknown cursor config: %s", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ static void config_handle_keyboard(struct roots_config *config,
|
||||||
if (strcmp(name, "meta-key") == 0) {
|
if (strcmp(name, "meta-key") == 0) {
|
||||||
kc->meta_key = parse_modifier(value);
|
kc->meta_key = parse_modifier(value);
|
||||||
if (kc->meta_key == 0) {
|
if (kc->meta_key == 0) {
|
||||||
wlr_log(L_ERROR, "got unknown meta key: %s", name);
|
wlr_log(WLR_ERROR, "got unknown meta key: %s", name);
|
||||||
}
|
}
|
||||||
} else if (strcmp(name, "rules") == 0) {
|
} else if (strcmp(name, "rules") == 0) {
|
||||||
kc->rules = strdup(value);
|
kc->rules = strdup(value);
|
||||||
|
@ -269,7 +269,7 @@ static void config_handle_keyboard(struct roots_config *config,
|
||||||
} else if (strcmp(name, "repeat-delay") == 0) {
|
} else if (strcmp(name, "repeat-delay") == 0) {
|
||||||
kc->repeat_delay = strtol(value, NULL, 10);
|
kc->repeat_delay = strtol(value, NULL, 10);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown keyboard config: %s", name);
|
wlr_log(WLR_ERROR, "got unknown keyboard config: %s", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,10 +291,10 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||||
} else if (strcasecmp(value, "false") == 0) {
|
} else if (strcasecmp(value, "false") == 0) {
|
||||||
config->xwayland = false;
|
config->xwayland = false;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown xwayland value: %s", value);
|
wlr_log(WLR_ERROR, "got unknown xwayland value: %s", value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown core config: %s", name);
|
wlr_log(WLR_ERROR, "got unknown core config: %s", name);
|
||||||
}
|
}
|
||||||
} else if (strncmp(output_prefix, section, strlen(output_prefix)) == 0) {
|
} else if (strncmp(output_prefix, section, strlen(output_prefix)) == 0) {
|
||||||
const char *output_name = section + strlen(output_prefix);
|
const char *output_name = section + strlen(output_prefix);
|
||||||
|
@ -324,7 +324,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||||
} else if (strcasecmp(value, "false") == 0) {
|
} else if (strcasecmp(value, "false") == 0) {
|
||||||
oc->enable = false;
|
oc->enable = false;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got invalid output enable value: %s", value);
|
wlr_log(WLR_ERROR, "got invalid output enable value: %s", value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(name, "x") == 0) {
|
} else if (strcmp(name, "x") == 0) {
|
||||||
oc->x = strtol(value, NULL, 10);
|
oc->x = strtol(value, NULL, 10);
|
||||||
|
@ -351,7 +351,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||||
} else if (strcmp(value, "flipped-270") == 0) {
|
} else if (strcmp(value, "flipped-270") == 0) {
|
||||||
oc->transform = WL_OUTPUT_TRANSFORM_FLIPPED_270;
|
oc->transform = WL_OUTPUT_TRANSFORM_FLIPPED_270;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown transform value: %s", value);
|
wlr_log(WLR_ERROR, "got unknown transform value: %s", value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(name, "mode") == 0) {
|
} else if (strcmp(name, "mode") == 0) {
|
||||||
char *end;
|
char *end;
|
||||||
|
@ -365,7 +365,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||||
oc->mode.refresh_rate = strtof(end, &end);
|
oc->mode.refresh_rate = strtof(end, &end);
|
||||||
assert(strcmp("Hz", end) == 0);
|
assert(strcmp("Hz", end) == 0);
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "Configured output %s with mode %dx%d@%f",
|
wlr_log(WLR_DEBUG, "Configured output %s with mode %dx%d@%f",
|
||||||
oc->name, oc->mode.width, oc->mode.height,
|
oc->name, oc->mode.width, oc->mode.height,
|
||||||
oc->mode.refresh_rate);
|
oc->mode.refresh_rate);
|
||||||
} else if (strcmp(name, "modeline") == 0) {
|
} else if (strcmp(name, "modeline") == 0) {
|
||||||
|
@ -375,7 +375,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||||
wl_list_insert(&oc->modes, &mode->link);
|
wl_list_insert(&oc->modes, &mode->link);
|
||||||
} else {
|
} else {
|
||||||
free(mode);
|
free(mode);
|
||||||
wlr_log(L_ERROR, "Invalid modeline: %s", value);
|
wlr_log(WLR_ERROR, "Invalid modeline: %s", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strncmp(cursor_prefix, section, strlen(cursor_prefix)) == 0) {
|
} else if (strncmp(cursor_prefix, section, strlen(cursor_prefix)) == 0) {
|
||||||
|
@ -418,12 +418,12 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||||
} else if (strcasecmp(value, "false") == 0) {
|
} else if (strcasecmp(value, "false") == 0) {
|
||||||
dc->tap_enabled = false;
|
dc->tap_enabled = false;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"got unknown tap_enabled value: %s",
|
"got unknown tap_enabled value: %s",
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown device config: %s", name);
|
wlr_log(WLR_ERROR, "got unknown device config: %s", name);
|
||||||
}
|
}
|
||||||
} else if (strcmp(section, "keyboard") == 0) {
|
} else if (strcmp(section, "keyboard") == 0) {
|
||||||
config_handle_keyboard(config, "", name, value);
|
config_handle_keyboard(config, "", name, value);
|
||||||
|
@ -434,7 +434,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||||
} else if (strcmp(section, "bindings") == 0) {
|
} else if (strcmp(section, "bindings") == 0) {
|
||||||
add_binding_config(&config->bindings, name, value);
|
add_binding_config(&config->bindings, name, value);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown config section: %s", section);
|
wlr_log(WLR_ERROR, "got unknown config section: %s", section);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -478,12 +478,12 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) {
|
||||||
if (getcwd(cwd, sizeof(cwd)) != NULL) {
|
if (getcwd(cwd, sizeof(cwd)) != NULL) {
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
if (snprintf(buf, MAXPATHLEN, "%s/%s", cwd, "rootston.ini") >= MAXPATHLEN) {
|
if (snprintf(buf, MAXPATHLEN, "%s/%s", cwd, "rootston.ini") >= MAXPATHLEN) {
|
||||||
wlr_log(L_ERROR, "config path too long");
|
wlr_log(WLR_ERROR, "config path too long");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
config->config_path = strdup(buf);
|
config->config_path = strdup(buf);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "could not get cwd");
|
wlr_log(WLR_ERROR, "could not get cwd");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) {
|
||||||
int result = ini_parse(config->config_path, config_ini_handler, config);
|
int result = ini_parse(config->config_path, config_ini_handler, config);
|
||||||
|
|
||||||
if (result == -1) {
|
if (result == -1) {
|
||||||
wlr_log(L_DEBUG, "No config file found. Using sensible defaults.");
|
wlr_log(WLR_DEBUG, "No config file found. Using sensible defaults.");
|
||||||
add_binding_config(&config->bindings, "Logo+Shift+E", "exit");
|
add_binding_config(&config->bindings, "Logo+Shift+E", "exit");
|
||||||
add_binding_config(&config->bindings, "Ctrl+q", "close");
|
add_binding_config(&config->bindings, "Ctrl+q", "close");
|
||||||
add_binding_config(&config->bindings, "Alt+Tab", "next_window");
|
add_binding_config(&config->bindings, "Alt+Tab", "next_window");
|
||||||
|
@ -501,10 +501,10 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) {
|
||||||
kc->name = strdup("");
|
kc->name = strdup("");
|
||||||
wl_list_insert(&config->keyboards, &kc->link);
|
wl_list_insert(&config->keyboards, &kc->link);
|
||||||
} else if (result == -2) {
|
} else if (result == -2) {
|
||||||
wlr_log(L_ERROR, "Could not allocate memory to parse config file");
|
wlr_log(WLR_ERROR, "Could not allocate memory to parse config file");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else if (result != 0) {
|
} else if (result != 0) {
|
||||||
wlr_log(L_ERROR, "Could not parse config file");
|
wlr_log(WLR_ERROR, "Could not parse config file");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -429,7 +429,7 @@ void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor,
|
||||||
}
|
}
|
||||||
if (event->seat_client->client != focused_client ||
|
if (event->seat_client->client != focused_client ||
|
||||||
cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
||||||
wlr_log(L_DEBUG, "Denying request to set cursor from unfocused client");
|
wlr_log(WLR_DEBUG, "Denying request to set cursor from unfocused client");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -757,7 +757,7 @@ static void input_inhibit_deactivate(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct roots_desktop *desktop_create(struct roots_server *server,
|
struct roots_desktop *desktop_create(struct roots_server *server,
|
||||||
struct roots_config *config) {
|
struct roots_config *config) {
|
||||||
wlr_log(L_DEBUG, "Initializing roots desktop");
|
wlr_log(WLR_DEBUG, "Initializing roots desktop");
|
||||||
|
|
||||||
struct roots_desktop *desktop = calloc(1, sizeof(struct roots_desktop));
|
struct roots_desktop *desktop = calloc(1, sizeof(struct roots_desktop));
|
||||||
if (desktop == NULL) {
|
if (desktop == NULL) {
|
||||||
|
@ -816,7 +816,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
||||||
desktop->xcursor_manager = wlr_xcursor_manager_create(cursor_theme,
|
desktop->xcursor_manager = wlr_xcursor_manager_create(cursor_theme,
|
||||||
ROOTS_XCURSOR_SIZE);
|
ROOTS_XCURSOR_SIZE);
|
||||||
if (desktop->xcursor_manager == NULL) {
|
if (desktop->xcursor_manager == NULL) {
|
||||||
wlr_log(L_ERROR, "Cannot create XCursor manager for theme %s",
|
wlr_log(WLR_ERROR, "Cannot create XCursor manager for theme %s",
|
||||||
cursor_theme);
|
cursor_theme);
|
||||||
free(desktop);
|
free(desktop);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -830,7 +830,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
||||||
desktop->xwayland_surface.notify = handle_xwayland_surface;
|
desktop->xwayland_surface.notify = handle_xwayland_surface;
|
||||||
|
|
||||||
if (wlr_xcursor_manager_load(desktop->xcursor_manager, 1)) {
|
if (wlr_xcursor_manager_load(desktop->xcursor_manager, 1)) {
|
||||||
wlr_log(L_ERROR, "Cannot load XWayland XCursor theme");
|
wlr_log(WLR_ERROR, "Cannot load XWayland XCursor theme");
|
||||||
}
|
}
|
||||||
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
||||||
desktop->xcursor_manager, cursor_default, 1);
|
desktop->xcursor_manager, cursor_default, 1);
|
||||||
|
|
|
@ -56,11 +56,11 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct roots_seat *seat = input_get_seat(input, seat_name);
|
struct roots_seat *seat = input_get_seat(input, seat_name);
|
||||||
if (!seat) {
|
if (!seat) {
|
||||||
wlr_log(L_ERROR, "could not create roots seat");
|
wlr_log(WLR_ERROR, "could not create roots seat");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "New input device: %s (%d:%d) %s seat:%s", device->name,
|
wlr_log(WLR_DEBUG, "New input device: %s (%d:%d) %s seat:%s", device->name,
|
||||||
device->vendor, device->product, device_type(device->type), seat_name);
|
device->vendor, device->product, device_type(device->type), seat_name);
|
||||||
|
|
||||||
roots_seat_add_device(seat, device);
|
roots_seat_add_device(seat, device);
|
||||||
|
@ -69,7 +69,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
|
||||||
struct libinput_device *libinput_dev =
|
struct libinput_device *libinput_dev =
|
||||||
wlr_libinput_get_device_handle(device);
|
wlr_libinput_get_device_handle(device);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "input has config, tap_enabled: %d\n", dc->tap_enabled);
|
wlr_log(WLR_DEBUG, "input has config, tap_enabled: %d\n", dc->tap_enabled);
|
||||||
if (dc->tap_enabled) {
|
if (dc->tap_enabled) {
|
||||||
libinput_device_config_tap_set_enabled(libinput_dev,
|
libinput_device_config_tap_set_enabled(libinput_dev,
|
||||||
LIBINPUT_CONFIG_TAP_ENABLED);
|
LIBINPUT_CONFIG_TAP_ENABLED);
|
||||||
|
@ -79,7 +79,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct roots_input *input_create(struct roots_server *server,
|
struct roots_input *input_create(struct roots_server *server,
|
||||||
struct roots_config *config) {
|
struct roots_config *config) {
|
||||||
wlr_log(L_DEBUG, "Initializing roots input");
|
wlr_log(WLR_DEBUG, "Initializing roots input");
|
||||||
assert(server->desktop);
|
assert(server->desktop);
|
||||||
|
|
||||||
struct roots_input *input = calloc(1, sizeof(struct roots_input));
|
struct roots_input *input = calloc(1, sizeof(struct roots_input));
|
||||||
|
|
|
@ -115,7 +115,7 @@ static void keyboard_binding_execute(struct roots_keyboard *keyboard,
|
||||||
const char *shell_cmd = command + strlen(exec_prefix);
|
const char *shell_cmd = command + strlen(exec_prefix);
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
wlr_log(L_ERROR, "cannot execute binding command: fork() failed");
|
wlr_log(WLR_ERROR, "cannot execute binding command: fork() failed");
|
||||||
return;
|
return;
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
execl("/bin/sh", "/bin/sh", "-c", shell_cmd, (void *)NULL);
|
execl("/bin/sh", "/bin/sh", "-c", shell_cmd, (void *)NULL);
|
||||||
|
@ -126,7 +126,7 @@ static void keyboard_binding_execute(struct roots_keyboard *keyboard,
|
||||||
view_maximize(focus, !focus->maximized);
|
view_maximize(focus, !focus->maximized);
|
||||||
}
|
}
|
||||||
} else if (strcmp(command, "nop") == 0) {
|
} else if (strcmp(command, "nop") == 0) {
|
||||||
wlr_log(L_DEBUG, "nop command");
|
wlr_log(WLR_DEBUG, "nop command");
|
||||||
} else if (strcmp(command, "toggle_outputs") == 0) {
|
} else if (strcmp(command, "toggle_outputs") == 0) {
|
||||||
outputs_enabled = !outputs_enabled;
|
outputs_enabled = !outputs_enabled;
|
||||||
struct roots_output *output;
|
struct roots_output *output;
|
||||||
|
@ -134,7 +134,7 @@ static void keyboard_binding_execute(struct roots_keyboard *keyboard,
|
||||||
wlr_output_enable(output->wlr_output, outputs_enabled);
|
wlr_output_enable(output->wlr_output, outputs_enabled);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "unknown binding command: %s", command);
|
wlr_log(WLR_ERROR, "unknown binding command: %s", command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
||||||
rules.options = config->options;
|
rules.options = config->options;
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (context == NULL) {
|
if (context == NULL) {
|
||||||
wlr_log(L_ERROR, "Cannot create XKB context");
|
wlr_log(WLR_ERROR, "Cannot create XKB context");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
||||||
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
if (keymap == NULL) {
|
if (keymap == NULL) {
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
wlr_log(L_ERROR, "Cannot create XKB keymap");
|
wlr_log(WLR_ERROR, "Cannot create XKB keymap");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_layer_surface *layer_surface = data;
|
struct wlr_layer_surface *layer_surface = data;
|
||||||
struct roots_desktop *desktop =
|
struct roots_desktop *desktop =
|
||||||
wl_container_of(listener, desktop, layer_shell_surface);
|
wl_container_of(listener, desktop, layer_shell_surface);
|
||||||
wlr_log(L_DEBUG, "new layer surface: namespace %s layer %d anchor %d "
|
wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d "
|
||||||
"size %dx%d margin %d,%d,%d,%d",
|
"size %dx%d margin %d,%d,%d,%d",
|
||||||
layer_surface->namespace, layer_surface->layer, layer_surface->layer,
|
layer_surface->namespace, layer_surface->layer, layer_surface->layer,
|
||||||
layer_surface->client_pending.desired_width,
|
layer_surface->client_pending.desired_width,
|
||||||
|
@ -390,7 +390,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
seat->cursor->cursor->x,
|
seat->cursor->cursor->x,
|
||||||
seat->cursor->cursor->y);
|
seat->cursor->cursor->y);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
wlr_log(L_ERROR, "Couldn't find output at (%.0f,%.0f)",
|
wlr_log(WLR_ERROR, "Couldn't find output at (%.0f,%.0f)",
|
||||||
seat->cursor->cursor->x,
|
seat->cursor->cursor->x,
|
||||||
seat->cursor->cursor->y);
|
seat->cursor->cursor->y);
|
||||||
output = wlr_output_layout_get_center_output(desktop->layout);
|
output = wlr_output_layout_get_center_output(desktop->layout);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
struct roots_server server = { 0 };
|
struct roots_server server = { 0 };
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
wlr_log_init(L_DEBUG, NULL);
|
wlr_log_init(WLR_DEBUG, NULL);
|
||||||
server.config = roots_config_create_from_args(argc, argv);
|
server.config = roots_config_create_from_args(argc, argv);
|
||||||
server.wl_display = wl_display_create();
|
server.wl_display = wl_display_create();
|
||||||
server.wl_event_loop = wl_display_get_event_loop(server.wl_display);
|
server.wl_event_loop = wl_display_get_event_loop(server.wl_display);
|
||||||
|
@ -23,7 +23,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
server.backend = wlr_backend_autocreate(server.wl_display, NULL);
|
server.backend = wlr_backend_autocreate(server.wl_display, NULL);
|
||||||
if (server.backend == NULL) {
|
if (server.backend == NULL) {
|
||||||
wlr_log(L_ERROR, "could not start backend");
|
wlr_log(WLR_ERROR, "could not start backend");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,16 +37,16 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
const char *socket = wl_display_add_socket_auto(server.wl_display);
|
const char *socket = wl_display_add_socket_auto(server.wl_display);
|
||||||
if (!socket) {
|
if (!socket) {
|
||||||
wlr_log_errno(L_ERROR, "Unable to open wayland socket");
|
wlr_log_errno(WLR_ERROR, "Unable to open wayland socket");
|
||||||
wlr_backend_destroy(server.backend);
|
wlr_backend_destroy(server.backend);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_INFO, "Running compositor on wayland display '%s'", socket);
|
wlr_log(WLR_INFO, "Running compositor on wayland display '%s'", socket);
|
||||||
setenv("_WAYLAND_DISPLAY", socket, true);
|
setenv("_WAYLAND_DISPLAY", socket, true);
|
||||||
|
|
||||||
if (!wlr_backend_start(server.backend)) {
|
if (!wlr_backend_start(server.backend)) {
|
||||||
wlr_log(L_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(server.backend);
|
wlr_backend_destroy(server.backend);
|
||||||
wl_display_destroy(server.wl_display);
|
wl_display_destroy(server.wl_display);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -65,7 +65,7 @@ int main(int argc, char **argv) {
|
||||||
const char *cmd = server.config->startup_cmd;
|
const char *cmd = server.config->startup_cmd;
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
wlr_log(L_ERROR, "cannot execute binding command: fork() failed");
|
wlr_log(WLR_ERROR, "cannot execute binding command: fork() failed");
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL);
|
execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,9 +758,9 @@ static void set_mode(struct wlr_output *output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!best) {
|
if (!best) {
|
||||||
wlr_log(L_ERROR, "Configured mode for %s not available", output->name);
|
wlr_log(WLR_ERROR, "Configured mode for %s not available", output->name);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "Assigning configured mode to %s", output->name);
|
wlr_log(WLR_DEBUG, "Assigning configured mode to %s", output->name);
|
||||||
wlr_output_set_mode(output, best);
|
wlr_output_set_mode(output, best);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -817,8 +817,8 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
struct roots_input *input = desktop->server->input;
|
struct roots_input *input = desktop->server->input;
|
||||||
struct roots_config *config = desktop->config;
|
struct roots_config *config = desktop->config;
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name);
|
wlr_log(WLR_DEBUG, "Output '%s' added", wlr_output->name);
|
||||||
wlr_log(L_DEBUG, "'%s %s %s' %"PRId32"mm x %"PRId32"mm", wlr_output->make,
|
wlr_log(WLR_DEBUG, "'%s %s %s' %"PRId32"mm x %"PRId32"mm", wlr_output->make,
|
||||||
wlr_output->model, wlr_output->serial, wlr_output->phys_width,
|
wlr_output->model, wlr_output->serial, wlr_output->phys_width,
|
||||||
wlr_output->phys_height);
|
wlr_output->phys_height);
|
||||||
|
|
||||||
|
@ -866,7 +866,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!wl_list_empty(&output_config->modes)) {
|
if (!wl_list_empty(&output_config->modes)) {
|
||||||
wlr_log(L_ERROR, "Can only add modes for DRM backend");
|
wlr_log(WLR_ERROR, "Can only add modes for DRM backend");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (output_config->mode.width) {
|
if (output_config->mode.width) {
|
||||||
|
|
|
@ -443,7 +443,7 @@ static void seat_add_keyboard(struct roots_seat *seat,
|
||||||
struct roots_keyboard *keyboard =
|
struct roots_keyboard *keyboard =
|
||||||
roots_keyboard_create(device, seat->input);
|
roots_keyboard_create(device, seat->input);
|
||||||
if (keyboard == NULL) {
|
if (keyboard == NULL) {
|
||||||
wlr_log(L_ERROR, "could not allocate keyboard for seat");
|
wlr_log(WLR_ERROR, "could not allocate keyboard for seat");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ static void seat_add_pointer(struct roots_seat *seat,
|
||||||
struct wlr_input_device *device) {
|
struct wlr_input_device *device) {
|
||||||
struct roots_pointer *pointer = calloc(sizeof(struct roots_pointer), 1);
|
struct roots_pointer *pointer = calloc(sizeof(struct roots_pointer), 1);
|
||||||
if (!pointer) {
|
if (!pointer) {
|
||||||
wlr_log(L_ERROR, "could not allocate pointer for seat");
|
wlr_log(WLR_ERROR, "could not allocate pointer for seat");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ static void seat_add_touch(struct roots_seat *seat,
|
||||||
struct wlr_input_device *device) {
|
struct wlr_input_device *device) {
|
||||||
struct roots_touch *touch = calloc(sizeof(struct roots_touch), 1);
|
struct roots_touch *touch = calloc(sizeof(struct roots_touch), 1);
|
||||||
if (!touch) {
|
if (!touch) {
|
||||||
wlr_log(L_ERROR, "could not allocate touch for seat");
|
wlr_log(WLR_ERROR, "could not allocate touch for seat");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ static void seat_add_tablet_tool(struct roots_seat *seat,
|
||||||
struct roots_tablet_tool *tablet_tool =
|
struct roots_tablet_tool *tablet_tool =
|
||||||
calloc(sizeof(struct roots_tablet_tool), 1);
|
calloc(sizeof(struct roots_tablet_tool), 1);
|
||||||
if (!tablet_tool) {
|
if (!tablet_tool) {
|
||||||
wlr_log(L_ERROR, "could not allocate tablet_tool for seat");
|
wlr_log(WLR_ERROR, "could not allocate tablet_tool for seat");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
||||||
seat->cursor->xcursor_manager =
|
seat->cursor->xcursor_manager =
|
||||||
wlr_xcursor_manager_create(cursor_theme, ROOTS_XCURSOR_SIZE);
|
wlr_xcursor_manager_create(cursor_theme, ROOTS_XCURSOR_SIZE);
|
||||||
if (seat->cursor->xcursor_manager == NULL) {
|
if (seat->cursor->xcursor_manager == NULL) {
|
||||||
wlr_log(L_ERROR, "Cannot create XCursor manager for theme %s",
|
wlr_log(WLR_ERROR, "Cannot create XCursor manager for theme %s",
|
||||||
cursor_theme);
|
cursor_theme);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -618,7 +618,7 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
||||||
wl_list_for_each(output, &seat->input->server->desktop->outputs, link) {
|
wl_list_for_each(output, &seat->input->server->desktop->outputs, link) {
|
||||||
float scale = output->wlr_output->scale;
|
float scale = output->wlr_output->scale;
|
||||||
if (wlr_xcursor_manager_load(seat->cursor->xcursor_manager, scale)) {
|
if (wlr_xcursor_manager_load(seat->cursor->xcursor_manager, scale)) {
|
||||||
wlr_log(L_ERROR, "Cannot load xcursor theme for output '%s' "
|
wlr_log(WLR_ERROR, "Cannot load xcursor theme for output '%s' "
|
||||||
"with scale %f", output->wlr_output->name, scale);
|
"with scale %f", output->wlr_output->name, scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ struct roots_seat_view *roots_seat_view_from_view(
|
||||||
if (!found) {
|
if (!found) {
|
||||||
seat_view = seat_add_view(seat, view);
|
seat_view = seat_add_view(seat, view);
|
||||||
if (seat_view == NULL) {
|
if (seat_view == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ void handle_virtual_keyboard(struct wl_listener *listener, void *data) {
|
||||||
struct roots_seat *seat = input_seat_from_wlr_seat(desktop->server->input,
|
struct roots_seat *seat = input_seat_from_wlr_seat(desktop->server->input,
|
||||||
keyboard->seat);
|
keyboard->seat);
|
||||||
if (!seat) {
|
if (!seat) {
|
||||||
wlr_log(L_ERROR, "could not find roots seat");
|
wlr_log(WLR_ERROR, "could not find roots seat");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,11 +196,11 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_wl_shell_surface *surface = data;
|
struct wlr_wl_shell_surface *surface = data;
|
||||||
|
|
||||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_POPUP) {
|
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_POPUP) {
|
||||||
wlr_log(L_DEBUG, "new wl shell popup");
|
wlr_log(WLR_DEBUG, "new wl shell popup");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new wl shell surface: title=%s, class=%s",
|
wlr_log(WLR_DEBUG, "new wl shell surface: title=%s, class=%s",
|
||||||
surface->title, surface->class);
|
surface->title, surface->class);
|
||||||
wlr_wl_shell_surface_ping(surface);
|
wlr_wl_shell_surface_ping(surface);
|
||||||
|
|
||||||
|
|
|
@ -398,14 +398,14 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE);
|
assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE);
|
||||||
|
|
||||||
if (surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
if (surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||||
wlr_log(L_DEBUG, "new xdg popup");
|
wlr_log(WLR_DEBUG, "new xdg popup");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct roots_desktop *desktop =
|
struct roots_desktop *desktop =
|
||||||
wl_container_of(listener, desktop, xdg_shell_surface);
|
wl_container_of(listener, desktop, xdg_shell_surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new xdg toplevel: title=%s, app_id=%s",
|
wlr_log(WLR_DEBUG, "new xdg toplevel: title=%s, app_id=%s",
|
||||||
surface->toplevel->title, surface->toplevel->app_id);
|
surface->toplevel->title, surface->toplevel->app_id);
|
||||||
wlr_xdg_surface_ping(surface);
|
wlr_xdg_surface_ping(surface);
|
||||||
|
|
||||||
|
|
|
@ -399,14 +399,14 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
||||||
assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE);
|
assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE);
|
||||||
|
|
||||||
if (surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) {
|
if (surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) {
|
||||||
wlr_log(L_DEBUG, "new xdg popup");
|
wlr_log(WLR_DEBUG, "new xdg popup");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct roots_desktop *desktop =
|
struct roots_desktop *desktop =
|
||||||
wl_container_of(listener, desktop, xdg_shell_v6_surface);
|
wl_container_of(listener, desktop, xdg_shell_v6_surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new xdg toplevel: title=%s, app_id=%s",
|
wlr_log(WLR_DEBUG, "new xdg toplevel: title=%s, app_id=%s",
|
||||||
surface->toplevel->title, surface->toplevel->app_id);
|
surface->toplevel->title, surface->toplevel->app_id);
|
||||||
wlr_xdg_surface_v6_ping(surface);
|
wlr_xdg_surface_v6_ping(surface);
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
||||||
wl_container_of(listener, desktop, xwayland_surface);
|
wl_container_of(listener, desktop, xwayland_surface);
|
||||||
|
|
||||||
struct wlr_xwayland_surface *surface = data;
|
struct wlr_xwayland_surface *surface = data;
|
||||||
wlr_log(L_DEBUG, "new xwayland surface: title=%s, class=%s, instance=%s",
|
wlr_log(WLR_DEBUG, "new xwayland surface: title=%s, class=%s, instance=%s",
|
||||||
surface->title, surface->class, surface->instance);
|
surface->title, surface->class, surface->instance);
|
||||||
wlr_xwayland_surface_ping(surface);
|
wlr_xwayland_surface_ping(surface);
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(
|
||||||
struct wlr_data_device_manager *manager =
|
struct wlr_data_device_manager *manager =
|
||||||
calloc(1, sizeof(struct wlr_data_device_manager));
|
calloc(1, sizeof(struct wlr_data_device_manager));
|
||||||
if (manager == NULL) {
|
if (manager == NULL) {
|
||||||
wlr_log(L_ERROR, "could not create data device manager");
|
wlr_log(WLR_ERROR, "could not create data device manager");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(
|
||||||
wl_global_create(display, &wl_data_device_manager_interface,
|
wl_global_create(display, &wl_data_device_manager_interface,
|
||||||
DATA_DEVICE_MANAGER_VERSION, manager, data_device_manager_bind);
|
DATA_DEVICE_MANAGER_VERSION, manager, data_device_manager_bind);
|
||||||
if (!manager->global) {
|
if (!manager->global) {
|
||||||
wlr_log(L_ERROR, "could not create data device manager wl_global");
|
wlr_log(WLR_ERROR, "could not create data device manager wl_global");
|
||||||
free(manager);
|
free(manager);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ static void seat_handle_get_pointer(struct wl_client *client,
|
||||||
struct wlr_seat_client *seat_client =
|
struct wlr_seat_client *seat_client =
|
||||||
wlr_seat_client_from_resource(seat_resource);
|
wlr_seat_client_from_resource(seat_resource);
|
||||||
if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) {
|
if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) {
|
||||||
wlr_log(L_ERROR, "Client sent get_pointer on seat without the "
|
wlr_log(WLR_ERROR, "Client sent get_pointer on seat without the "
|
||||||
"pointer capability");
|
"pointer capability");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ static void seat_handle_get_keyboard(struct wl_client *client,
|
||||||
struct wlr_seat_client *seat_client =
|
struct wlr_seat_client *seat_client =
|
||||||
wlr_seat_client_from_resource(seat_resource);
|
wlr_seat_client_from_resource(seat_resource);
|
||||||
if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
||||||
wlr_log(L_ERROR, "Client sent get_keyboard on seat without the "
|
wlr_log(WLR_ERROR, "Client sent get_keyboard on seat without the "
|
||||||
"keyboard capability");
|
"keyboard capability");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ static void seat_handle_get_touch(struct wl_client *client,
|
||||||
struct wlr_seat_client *seat_client =
|
struct wlr_seat_client *seat_client =
|
||||||
wlr_seat_client_from_resource(seat_resource);
|
wlr_seat_client_from_resource(seat_resource);
|
||||||
if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_TOUCH)) {
|
if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_TOUCH)) {
|
||||||
wlr_log(L_ERROR, "Client sent get_touch on seat without the "
|
wlr_log(WLR_ERROR, "Client sent get_touch on seat without the "
|
||||||
"touch capability");
|
"touch capability");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
||||||
for (size_t i = 0; i < num_keycodes; ++i) {
|
for (size_t i = 0; i < num_keycodes; ++i) {
|
||||||
uint32_t *p = wl_array_add(&keys, sizeof(uint32_t));
|
uint32_t *p = wl_array_add(&keys, sizeof(uint32_t));
|
||||||
if (!p) {
|
if (!p) {
|
||||||
wlr_log(L_ERROR, "Cannot allocate memory, skipping keycode: %d\n",
|
wlr_log(WLR_ERROR, "Cannot allocate memory, skipping keycode: %d\n",
|
||||||
keycodes[i]);
|
keycodes[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
|
||||||
struct wlr_touch_point *point =
|
struct wlr_touch_point *point =
|
||||||
touch_point_create(seat, touch_id, surface, sx, sy);
|
touch_point_create(seat, touch_id, surface, sx, sy);
|
||||||
if (!point) {
|
if (!point) {
|
||||||
wlr_log(L_ERROR, "could not create touch point");
|
wlr_log(WLR_ERROR, "could not create touch point");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ void wlr_seat_touch_point_focus(struct wlr_seat *seat,
|
||||||
assert(surface);
|
assert(surface);
|
||||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||||
if (!point) {
|
if (!point) {
|
||||||
wlr_log(L_ERROR, "got touch point focus for unknown touch point");
|
wlr_log(WLR_ERROR, "got touch point focus for unknown touch point");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_surface *focus = point->focus_surface;
|
struct wlr_surface *focus = point->focus_surface;
|
||||||
|
@ -262,7 +262,7 @@ void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time,
|
||||||
int32_t touch_id) {
|
int32_t touch_id) {
|
||||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||||
if (!point) {
|
if (!point) {
|
||||||
wlr_log(L_ERROR, "got touch point focus for unknown touch point");
|
wlr_log(WLR_ERROR, "got touch point focus for unknown touch point");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
|
||||||
double sy) {
|
double sy) {
|
||||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||||
if (!point) {
|
if (!point) {
|
||||||
wlr_log(L_ERROR, "got touch down for unknown touch point");
|
wlr_log(WLR_ERROR, "got touch down for unknown touch point");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
|
||||||
void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time, int32_t touch_id) {
|
void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time, int32_t touch_id) {
|
||||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||||
if (!point) {
|
if (!point) {
|
||||||
wlr_log(L_ERROR, "got touch up for unknown touch point");
|
wlr_log(WLR_ERROR, "got touch up for unknown touch point");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ void wlr_seat_touch_send_motion(struct wlr_seat *seat, uint32_t time, int32_t to
|
||||||
double sx, double sy) {
|
double sx, double sy) {
|
||||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||||
if (!point) {
|
if (!point) {
|
||||||
wlr_log(L_ERROR, "got touch motion for unknown touch point");
|
wlr_log(WLR_ERROR, "got touch motion for unknown touch point");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,12 +86,12 @@ struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer,
|
||||||
// re-using the same DMA-BUF for the next frames, so we don't release
|
// re-using the same DMA-BUF for the next frames, so we don't release
|
||||||
// the buffer yet.
|
// the buffer yet.
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "Cannot upload texture: unknown buffer type");
|
wlr_log(WLR_ERROR, "Cannot upload texture: unknown buffer type");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture == NULL) {
|
if (texture == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to upload texture");
|
wlr_log(WLR_ERROR, "Failed to upload texture");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ static void subcompositor_init(struct wlr_subcompositor *subcompositor,
|
||||||
&wl_subcompositor_interface, SUBCOMPOSITOR_VERSION, subcompositor,
|
&wl_subcompositor_interface, SUBCOMPOSITOR_VERSION, subcompositor,
|
||||||
subcompositor_bind);
|
subcompositor_bind);
|
||||||
if (subcompositor->global == NULL) {
|
if (subcompositor->global == NULL) {
|
||||||
wlr_log_errno(L_ERROR, "Could not allocate subcompositor global");
|
wlr_log_errno(WLR_ERROR, "Could not allocate subcompositor global");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_list_init(&subcompositor->resources);
|
wl_list_init(&subcompositor->resources);
|
||||||
|
@ -218,7 +218,7 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
||||||
struct wlr_compositor *compositor =
|
struct wlr_compositor *compositor =
|
||||||
calloc(1, sizeof(struct wlr_compositor));
|
calloc(1, sizeof(struct wlr_compositor));
|
||||||
if (!compositor) {
|
if (!compositor) {
|
||||||
wlr_log_errno(L_ERROR, "Could not allocate wlr compositor");
|
wlr_log_errno(WLR_ERROR, "Could not allocate wlr compositor");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
||||||
COMPOSITOR_VERSION, compositor, compositor_bind);
|
COMPOSITOR_VERSION, compositor, compositor_bind);
|
||||||
if (!compositor->global) {
|
if (!compositor->global) {
|
||||||
free(compositor);
|
free(compositor);
|
||||||
wlr_log_errno(L_ERROR, "Could not allocate compositor global");
|
wlr_log_errno(WLR_ERROR, "Could not allocate compositor global");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
compositor->renderer = renderer;
|
compositor->renderer = renderer;
|
||||||
|
|
|
@ -59,13 +59,13 @@ struct wlr_cursor_state {
|
||||||
struct wlr_cursor *wlr_cursor_create(void) {
|
struct wlr_cursor *wlr_cursor_create(void) {
|
||||||
struct wlr_cursor *cur = calloc(1, sizeof(struct wlr_cursor));
|
struct wlr_cursor *cur = calloc(1, sizeof(struct wlr_cursor));
|
||||||
if (!cur) {
|
if (!cur) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_cursor");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur->state = calloc(1, sizeof(struct wlr_cursor_state));
|
cur->state = calloc(1, sizeof(struct wlr_cursor_state));
|
||||||
if (!cur->state) {
|
if (!cur->state) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_cursor_state");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_state");
|
||||||
free(cur);
|
free(cur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ static struct wlr_cursor_device *cursor_device_create(
|
||||||
struct wlr_cursor_device *c_device =
|
struct wlr_cursor_device *c_device =
|
||||||
calloc(1, sizeof(struct wlr_cursor_device));
|
calloc(1, sizeof(struct wlr_cursor_device));
|
||||||
if (!c_device) {
|
if (!c_device) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_cursor_device");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_device");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
|
||||||
if (dev->type != WLR_INPUT_DEVICE_POINTER &&
|
if (dev->type != WLR_INPUT_DEVICE_POINTER &&
|
||||||
dev->type != WLR_INPUT_DEVICE_TOUCH &&
|
dev->type != WLR_INPUT_DEVICE_TOUCH &&
|
||||||
dev->type != WLR_INPUT_DEVICE_TABLET_TOOL) {
|
dev->type != WLR_INPUT_DEVICE_TABLET_TOOL) {
|
||||||
wlr_log(L_ERROR, "only device types of pointer, touch or tablet tool"
|
wlr_log(WLR_ERROR, "only device types of pointer, touch or tablet tool"
|
||||||
"are supported");
|
"are supported");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -623,14 +623,14 @@ static void layout_add(struct wlr_cursor_state *state,
|
||||||
struct wlr_cursor_output_cursor *output_cursor =
|
struct wlr_cursor_output_cursor *output_cursor =
|
||||||
calloc(1, sizeof(struct wlr_cursor_output_cursor));
|
calloc(1, sizeof(struct wlr_cursor_output_cursor));
|
||||||
if (output_cursor == NULL) {
|
if (output_cursor == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_cursor_output_cursor");
|
wlr_log(WLR_ERROR, "Failed to allocate wlr_cursor_output_cursor");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
output_cursor->cursor = state->cursor;
|
output_cursor->cursor = state->cursor;
|
||||||
|
|
||||||
output_cursor->output_cursor = wlr_output_cursor_create(l_output->output);
|
output_cursor->output_cursor = wlr_output_cursor_create(l_output->output);
|
||||||
if (output_cursor->output_cursor == NULL) {
|
if (output_cursor->output_cursor == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to create wlr_output_cursor");
|
wlr_log(WLR_ERROR, "Failed to create wlr_output_cursor");
|
||||||
free(output_cursor);
|
free(output_cursor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -698,7 +698,7 @@ void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
|
||||||
struct wlr_input_device *dev, struct wlr_output *output) {
|
struct wlr_input_device *dev, struct wlr_output *output) {
|
||||||
struct wlr_cursor_device *c_device = get_cursor_device(cur, dev);
|
struct wlr_cursor_device *c_device = get_cursor_device(cur, dev);
|
||||||
if (!c_device) {
|
if (!c_device) {
|
||||||
wlr_log(L_ERROR, "Cannot map device \"%s\" to output"
|
wlr_log(WLR_ERROR, "Cannot map device \"%s\" to output"
|
||||||
"(not found in this cursor)", dev->name);
|
"(not found in this cursor)", dev->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
|
||||||
void wlr_cursor_map_to_region(struct wlr_cursor *cur,
|
void wlr_cursor_map_to_region(struct wlr_cursor *cur,
|
||||||
struct wlr_box *box) {
|
struct wlr_box *box) {
|
||||||
if (box && wlr_box_empty(box)) {
|
if (box && wlr_box_empty(box)) {
|
||||||
wlr_log(L_ERROR, "cannot map cursor to an empty region");
|
wlr_log(WLR_ERROR, "cannot map cursor to an empty region");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,14 +719,14 @@ void wlr_cursor_map_to_region(struct wlr_cursor *cur,
|
||||||
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
|
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
|
||||||
struct wlr_input_device *dev, struct wlr_box *box) {
|
struct wlr_input_device *dev, struct wlr_box *box) {
|
||||||
if (box && wlr_box_empty(box)) {
|
if (box && wlr_box_empty(box)) {
|
||||||
wlr_log(L_ERROR, "cannot map device \"%s\" input to an empty region",
|
wlr_log(WLR_ERROR, "cannot map device \"%s\" input to an empty region",
|
||||||
dev->name);
|
dev->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_cursor_device *c_device = get_cursor_device(cur, dev);
|
struct wlr_cursor_device *c_device = get_cursor_device(cur, dev);
|
||||||
if (!c_device) {
|
if (!c_device) {
|
||||||
wlr_log(L_ERROR, "Cannot map device \"%s\" to geometry (not found in"
|
wlr_log(WLR_ERROR, "Cannot map device \"%s\" to geometry (not found in"
|
||||||
"this cursor)", dev->name);
|
"this cursor)", dev->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ static void gamma_control_manager_get_gamma_control(struct wl_client *client,
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "new gamma_control %p (res %p)", gamma_control,
|
wlr_log(WLR_DEBUG, "new gamma_control %p (res %p)", gamma_control,
|
||||||
gamma_control->resource);
|
gamma_control->resource);
|
||||||
wl_resource_set_implementation(gamma_control->resource,
|
wl_resource_set_implementation(gamma_control->resource,
|
||||||
&gamma_control_impl, gamma_control, gamma_control_destroy_resource);
|
&gamma_control_impl, gamma_control, gamma_control_destroy_resource);
|
||||||
|
|
|
@ -154,7 +154,7 @@ void wlr_idle_set_enabled(struct wlr_idle *idle, struct wlr_seat *seat,
|
||||||
if (idle->enabled == enabled) {
|
if (idle->enabled == enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "%s idle timers for %s",
|
wlr_log(WLR_DEBUG, "%s idle timers for %s",
|
||||||
enabled ? "Enabling" : "Disabling",
|
enabled ? "Enabling" : "Disabling",
|
||||||
seat ? seat->name : "all seats");
|
seat ? seat->name : "all seats");
|
||||||
idle->enabled = enabled;
|
idle->enabled = enabled;
|
||||||
|
@ -226,7 +226,7 @@ struct wlr_idle *wlr_idle_create(struct wl_display *display) {
|
||||||
free(idle);
|
free(idle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "idle manager created");
|
wlr_log(WLR_DEBUG, "idle manager created");
|
||||||
return idle;
|
return idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ static void idle_inhibit_bind(struct wl_client *wl_client, void *data,
|
||||||
|
|
||||||
wl_resource_set_implementation(wl_resource, &idle_inhibit_impl,
|
wl_resource_set_implementation(wl_resource, &idle_inhibit_impl,
|
||||||
idle_inhibit, idle_inhibit_manager_v1_handle_resource_destroy);
|
idle_inhibit, idle_inhibit_manager_v1_handle_resource_destroy);
|
||||||
wlr_log(L_DEBUG, "idle_inhibit bound");
|
wlr_log(WLR_DEBUG, "idle_inhibit bound");
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_idle_inhibit_v1_destroy(struct wlr_idle_inhibit_manager_v1 *idle_inhibit) {
|
void wlr_idle_inhibit_v1_destroy(struct wlr_idle_inhibit_manager_v1 *idle_inhibit) {
|
||||||
|
@ -186,7 +186,7 @@ struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "idle_inhibit manager created");
|
wlr_log(WLR_DEBUG, "idle_inhibit manager created");
|
||||||
|
|
||||||
return idle_inhibit;
|
return idle_inhibit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) {
|
||||||
wlr_tablet_pad_destroy(dev->tablet_pad);
|
wlr_tablet_pad_destroy(dev->tablet_pad);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wlr_log(L_DEBUG, "Warning: leaking memory %p %p %d",
|
wlr_log(WLR_DEBUG, "Warning: leaking memory %p %p %d",
|
||||||
dev->_device, dev, dev->type);
|
dev->_device, dev, dev->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
|
||||||
xkb_state_unref(kb->xkb_state);
|
xkb_state_unref(kb->xkb_state);
|
||||||
kb->xkb_state = xkb_state_new(kb->keymap);
|
kb->xkb_state = xkb_state_new(kb->keymap);
|
||||||
if (kb->xkb_state == NULL) {
|
if (kb->xkb_state == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB state");
|
wlr_log(WLR_ERROR, "Failed to create XKB state");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,13 +220,13 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
|
||||||
}
|
}
|
||||||
kb->keymap_fd = os_create_anonymous_file(kb->keymap_size);
|
kb->keymap_fd = os_create_anonymous_file(kb->keymap_size);
|
||||||
if (kb->keymap_fd < 0) {
|
if (kb->keymap_fd < 0) {
|
||||||
wlr_log(L_ERROR, "creating a keymap file for %zu bytes failed", kb->keymap_size);
|
wlr_log(WLR_ERROR, "creating a keymap file for %zu bytes failed", kb->keymap_size);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
void *ptr = mmap(NULL, kb->keymap_size,
|
void *ptr = mmap(NULL, kb->keymap_size,
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED, kb->keymap_fd, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED, kb->keymap_fd, 0);
|
||||||
if (ptr == (void*)-1) {
|
if (ptr == (void*)-1) {
|
||||||
wlr_log(L_ERROR, "failed to mmap() %zu bytes", kb->keymap_size);
|
wlr_log(WLR_ERROR, "failed to mmap() %zu bytes", kb->keymap_size);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
strcpy(ptr, keymap_str);
|
strcpy(ptr, keymap_str);
|
||||||
|
|
|
@ -378,7 +378,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
|
||||||
wlr_surface_set_role_committed(surface->surface,
|
wlr_surface_set_role_committed(surface->surface,
|
||||||
handle_surface_committed, surface);
|
handle_surface_committed, surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new layer_surface %p (res %p)",
|
wlr_log(WLR_DEBUG, "new layer_surface %p (res %p)",
|
||||||
surface, surface->resource);
|
surface, surface->resource);
|
||||||
wl_resource_set_implementation(surface->resource,
|
wl_resource_set_implementation(surface->resource,
|
||||||
&layer_surface_implementation, surface, layer_surface_resource_destroy);
|
&layer_surface_implementation, surface, layer_surface_resource_destroy);
|
||||||
|
|
|
@ -481,7 +481,7 @@ struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display,
|
||||||
struct wlr_linux_dmabuf *linux_dmabuf =
|
struct wlr_linux_dmabuf *linux_dmabuf =
|
||||||
calloc(1, sizeof(struct wlr_linux_dmabuf));
|
calloc(1, sizeof(struct wlr_linux_dmabuf));
|
||||||
if (linux_dmabuf == NULL) {
|
if (linux_dmabuf == NULL) {
|
||||||
wlr_log(L_ERROR, "could not create simple dmabuf manager");
|
wlr_log(WLR_ERROR, "could not create simple dmabuf manager");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
linux_dmabuf->renderer = renderer;
|
linux_dmabuf->renderer = renderer;
|
||||||
|
@ -493,7 +493,7 @@ struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display,
|
||||||
wl_global_create(display, &zwp_linux_dmabuf_v1_interface,
|
wl_global_create(display, &zwp_linux_dmabuf_v1_interface,
|
||||||
LINUX_DMABUF_VERSION, linux_dmabuf, linux_dmabuf_bind);
|
LINUX_DMABUF_VERSION, linux_dmabuf, linux_dmabuf_bind);
|
||||||
if (!linux_dmabuf->global) {
|
if (!linux_dmabuf->global) {
|
||||||
wlr_log(L_ERROR, "could not create linux dmabuf v1 wl global");
|
wlr_log(WLR_ERROR, "could not create linux dmabuf v1 wl global");
|
||||||
free(linux_dmabuf);
|
free(linux_dmabuf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ void wlr_output_create_global(struct wlr_output *output) {
|
||||||
output->global = wl_global_create(output->display,
|
output->global = wl_global_create(output->display,
|
||||||
&wl_output_interface, OUTPUT_VERSION, output, output_bind);
|
&wl_output_interface, OUTPUT_VERSION, output, output_bind);
|
||||||
if (output->global == NULL) {
|
if (output->global == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wl_output global");
|
wlr_log(WLR_ERROR, "Failed to allocate wl_output global");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ surface_damage_finish:
|
||||||
bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
|
bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
|
||||||
pixman_region32_t *damage) {
|
pixman_region32_t *damage) {
|
||||||
if (output->frame_pending) {
|
if (output->frame_pending) {
|
||||||
wlr_log(L_ERROR, "Tried to swap buffers when a frame is pending");
|
wlr_log(WLR_ERROR, "Tried to swap buffers when a frame is pending");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (output->idle_frame != NULL) {
|
if (output->idle_frame != NULL) {
|
||||||
|
@ -766,7 +766,7 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Falling back to software cursor");
|
wlr_log(WLR_DEBUG, "Falling back to software cursor");
|
||||||
output_cursor_damage_whole(cursor);
|
output_cursor_damage_whole(cursor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
l_output = output_layout_output_create(layout, output);
|
l_output = output_layout_output_create(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
|
wlr_log(WLR_ERROR, "Failed to create wlr_output_layout_output");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ void wlr_output_layout_move(struct wlr_output_layout *layout,
|
||||||
l_output->state->auto_configured = false;
|
l_output->state->auto_configured = false;
|
||||||
output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "output not found in this layout: %s", output->name);
|
wlr_log(WLR_ERROR, "output not found in this layout: %s", output->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
l_output = output_layout_output_create(layout, output);
|
l_output = output_layout_output_create(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
|
wlr_log(WLR_ERROR, "Failed to create wlr_output_layout_output");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ static void output_handle_frame(struct wl_listener *listener, void *_data) {
|
||||||
wl_shm_buffer_end_access(shm_buffer);
|
wl_shm_buffer_end_access(shm_buffer);
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
wlr_log(L_ERROR, "Cannot read pixels");
|
wlr_log(WLR_ERROR, "Cannot read pixels");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,26 +85,26 @@ static void screenshooter_shoot(struct wl_client *client,
|
||||||
|
|
||||||
struct wlr_renderer *renderer = wlr_backend_get_renderer(output->backend);
|
struct wlr_renderer *renderer = wlr_backend_get_renderer(output->backend);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
wlr_log(L_ERROR, "Backend doesn't have a renderer");
|
wlr_log(WLR_ERROR, "Backend doesn't have a renderer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get(buffer_resource);
|
struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get(buffer_resource);
|
||||||
if (shm_buffer == NULL) {
|
if (shm_buffer == NULL) {
|
||||||
wlr_log(L_ERROR, "Invalid buffer: not a shared memory buffer");
|
wlr_log(WLR_ERROR, "Invalid buffer: not a shared memory buffer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t width = wl_shm_buffer_get_width(shm_buffer);
|
int32_t width = wl_shm_buffer_get_width(shm_buffer);
|
||||||
int32_t height = wl_shm_buffer_get_height(shm_buffer);
|
int32_t height = wl_shm_buffer_get_height(shm_buffer);
|
||||||
if (width < output->width || height < output->height) {
|
if (width < output->width || height < output->height) {
|
||||||
wlr_log(L_ERROR, "Invalid buffer: too small");
|
wlr_log(WLR_ERROR, "Invalid buffer: too small");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t format = wl_shm_buffer_get_format(shm_buffer);
|
uint32_t format = wl_shm_buffer_get_format(shm_buffer);
|
||||||
if (!wlr_renderer_format_supported(renderer, format)) {
|
if (!wlr_renderer_format_supported(renderer, format)) {
|
||||||
wlr_log(L_ERROR, "Invalid buffer: unsupported format");
|
wlr_log(WLR_ERROR, "Invalid buffer: unsupported format");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ static void screenshooter_shoot(struct wl_client *client,
|
||||||
handle_screenshot_resource_destroy);
|
handle_screenshot_resource_destroy);
|
||||||
wl_list_insert(&screenshooter->screenshots, &screenshot->link);
|
wl_list_insert(&screenshooter->screenshots, &screenshot->link);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new screenshot %p (res %p)", screenshot,
|
wlr_log(WLR_DEBUG, "new screenshot %p (res %p)", screenshot,
|
||||||
screenshot->resource);
|
screenshot->resource);
|
||||||
|
|
||||||
struct screenshot_state *state = calloc(1, sizeof(struct screenshot_state));
|
struct screenshot_state *state = calloc(1, sizeof(struct screenshot_state));
|
||||||
|
|
|
@ -103,7 +103,7 @@ static void server_decoration_manager_handle_create(struct wl_client *client,
|
||||||
&server_decoration_impl, decoration,
|
&server_decoration_impl, decoration,
|
||||||
server_decoration_destroy_resource);
|
server_decoration_destroy_resource);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new server_decoration %p (res %p)", decoration,
|
wlr_log(WLR_DEBUG, "new server_decoration %p (res %p)", decoration,
|
||||||
decoration->resource);
|
decoration->resource);
|
||||||
|
|
||||||
wl_signal_init(&decoration->events.destroy);
|
wl_signal_init(&decoration->events.destroy);
|
||||||
|
|
|
@ -333,7 +333,7 @@ static void surface_apply_damage(struct wlr_surface *surface) {
|
||||||
|
|
||||||
struct wlr_buffer *buffer = wlr_buffer_create(surface->renderer, resource);
|
struct wlr_buffer *buffer = wlr_buffer_create(surface->renderer, resource);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to upload buffer");
|
wlr_log(WLR_ERROR, "Failed to upload buffer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ struct wlr_surface *wlr_surface_create(struct wl_client *client,
|
||||||
wl_resource_set_implementation(surface->resource, &surface_interface,
|
wl_resource_set_implementation(surface->resource, &surface_interface,
|
||||||
surface, surface_handle_resource_destroy);
|
surface, surface_handle_resource_destroy);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "New wlr_surface %p (res %p)", surface, surface->resource);
|
wlr_log(WLR_DEBUG, "New wlr_surface %p (res %p)", surface, surface->resource);
|
||||||
|
|
||||||
surface->renderer = renderer;
|
surface->renderer = renderer;
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ static void virtual_keyboard_manager_create_virtual_keyboard(
|
||||||
|
|
||||||
struct wlr_keyboard* keyboard = calloc(1, sizeof(struct wlr_keyboard));
|
struct wlr_keyboard* keyboard = calloc(1, sizeof(struct wlr_keyboard));
|
||||||
if (!keyboard) {
|
if (!keyboard) {
|
||||||
wlr_log(L_ERROR, "Cannot allocate wlr_keyboard");
|
wlr_log(WLR_ERROR, "Cannot allocate wlr_keyboard");
|
||||||
free(virtual_keyboard);
|
free(virtual_keyboard);
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -118,7 +118,7 @@ static struct wlr_wl_shell_surface *shell_surface_from_resource(
|
||||||
|
|
||||||
static void shell_surface_protocol_pong(struct wl_client *client,
|
static void shell_surface_protocol_pong(struct wl_client *client,
|
||||||
struct wl_resource *resource, uint32_t serial) {
|
struct wl_resource *resource, uint32_t serial) {
|
||||||
wlr_log(L_DEBUG, "got shell surface pong");
|
wlr_log(WLR_DEBUG, "got shell surface pong");
|
||||||
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
||||||
if (surface->ping_serial != serial) {
|
if (surface->ping_serial != serial) {
|
||||||
return;
|
return;
|
||||||
|
@ -135,7 +135,7 @@ static void shell_surface_protocol_move(struct wl_client *client,
|
||||||
struct wlr_seat_client *seat = wlr_seat_client_from_resource(seat_resource);
|
struct wlr_seat_client *seat = wlr_seat_client_from_resource(seat_resource);
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ static void shell_surface_protocol_resize(struct wl_client *client,
|
||||||
struct wlr_seat_client *seat = wlr_seat_client_from_resource(seat_resource);
|
struct wlr_seat_client *seat = wlr_seat_client_from_resource(seat_resource);
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ static void shell_surface_set_state(struct wlr_wl_shell_surface *surface,
|
||||||
|
|
||||||
static void shell_surface_protocol_set_toplevel(struct wl_client *client,
|
static void shell_surface_protocol_set_toplevel(struct wl_client *client,
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
wlr_log(L_DEBUG, "got shell surface toplevel");
|
wlr_log(WLR_DEBUG, "got shell surface toplevel");
|
||||||
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
||||||
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL, NULL,
|
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -262,7 +262,7 @@ static struct wlr_wl_shell_surface *shell_find_shell_surface(
|
||||||
static void shell_surface_protocol_set_transient(struct wl_client *client,
|
static void shell_surface_protocol_set_transient(struct wl_client *client,
|
||||||
struct wl_resource *resource, struct wl_resource *parent_resource,
|
struct wl_resource *resource, struct wl_resource *parent_resource,
|
||||||
int32_t x, int32_t y, enum wl_shell_surface_transient flags) {
|
int32_t x, int32_t y, enum wl_shell_surface_transient flags) {
|
||||||
wlr_log(L_DEBUG, "got shell surface transient");
|
wlr_log(WLR_DEBUG, "got shell surface transient");
|
||||||
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
||||||
struct wlr_surface *parent = wlr_surface_from_resource(parent_resource);
|
struct wlr_surface *parent = wlr_surface_from_resource(parent_resource);
|
||||||
// TODO: check if parent_resource == NULL?
|
// TODO: check if parent_resource == NULL?
|
||||||
|
@ -392,7 +392,7 @@ static void shell_surface_protocol_set_maximized(struct wl_client *client,
|
||||||
|
|
||||||
static void shell_surface_protocol_set_title(struct wl_client *client,
|
static void shell_surface_protocol_set_title(struct wl_client *client,
|
||||||
struct wl_resource *resource, const char *title) {
|
struct wl_resource *resource, const char *title) {
|
||||||
wlr_log(L_DEBUG, "new shell surface title: %s", title);
|
wlr_log(WLR_DEBUG, "new shell surface title: %s", title);
|
||||||
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
||||||
|
|
||||||
char *tmp = strdup(title);
|
char *tmp = strdup(title);
|
||||||
|
@ -408,7 +408,7 @@ static void shell_surface_protocol_set_title(struct wl_client *client,
|
||||||
|
|
||||||
static void shell_surface_protocol_set_class(struct wl_client *client,
|
static void shell_surface_protocol_set_class(struct wl_client *client,
|
||||||
struct wl_resource *resource, const char *class) {
|
struct wl_resource *resource, const char *class) {
|
||||||
wlr_log(L_DEBUG, "new shell surface class: %s", class);
|
wlr_log(WLR_DEBUG, "new shell surface class: %s", class);
|
||||||
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
struct wlr_wl_shell_surface *surface = shell_surface_from_resource(resource);
|
||||||
|
|
||||||
char *tmp = strdup(class);
|
char *tmp = strdup(class);
|
||||||
|
@ -542,7 +542,7 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
|
||||||
&shell_surface_impl, wl_surface,
|
&shell_surface_impl, wl_surface,
|
||||||
shell_surface_resource_destroy);
|
shell_surface_resource_destroy);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new wl_shell %p (res %p)", wl_surface,
|
wlr_log(WLR_DEBUG, "new wl_shell %p (res %p)", wl_surface,
|
||||||
wl_surface->resource);
|
wl_surface->resource);
|
||||||
|
|
||||||
wl_signal_init(&wl_surface->events.destroy);
|
wl_signal_init(&wl_surface->events.destroy);
|
||||||
|
|
|
@ -252,7 +252,7 @@ static void xdg_surface_handle_set_window_geometry(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width <= 0 || height <= 0) {
|
if (width <= 0 || height <= 0) {
|
||||||
wlr_log(L_ERROR, "Client tried to set invalid geometry");
|
wlr_log(WLR_ERROR, "Client tried to set invalid geometry");
|
||||||
//XXX: Switch to the proper error value once available
|
//XXX: Switch to the proper error value once available
|
||||||
wl_resource_post_error(resource, -1, "Tried to set invalid xdg-surface geometry");
|
wl_resource_post_error(resource, -1, "Tried to set invalid xdg-surface geometry");
|
||||||
return;
|
return;
|
||||||
|
@ -270,7 +270,7 @@ static void xdg_surface_handle_destroy(struct wl_client *client,
|
||||||
struct wlr_xdg_surface *surface = wlr_xdg_surface_from_resource(resource);
|
struct wlr_xdg_surface *surface = wlr_xdg_surface_from_resource(resource);
|
||||||
|
|
||||||
if (surface->role != WLR_XDG_SURFACE_ROLE_NONE) {
|
if (surface->role != WLR_XDG_SURFACE_ROLE_NONE) {
|
||||||
wlr_log(L_ERROR, "Tried to destroy an xdg_surface before its role "
|
wlr_log(WLR_ERROR, "Tried to destroy an xdg_surface before its role "
|
||||||
"object");
|
"object");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ struct wlr_xdg_surface *create_xdg_surface(
|
||||||
wlr_surface_set_role_committed(xdg_surface->surface,
|
wlr_surface_set_role_committed(xdg_surface->surface,
|
||||||
handle_surface_committed, xdg_surface);
|
handle_surface_committed, xdg_surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", xdg_surface,
|
wlr_log(WLR_DEBUG, "new xdg_surface %p (res %p)", xdg_surface,
|
||||||
xdg_surface->resource);
|
xdg_surface->resource);
|
||||||
wl_resource_set_implementation(xdg_surface->resource,
|
wl_resource_set_implementation(xdg_surface->resource,
|
||||||
&xdg_surface_implementation, xdg_surface,
|
&xdg_surface_implementation, xdg_surface,
|
||||||
|
|
|
@ -83,7 +83,7 @@ void send_xdg_toplevel_configure(struct wlr_xdg_surface *surface,
|
||||||
|
|
||||||
configure->toplevel_state = malloc(sizeof(*configure->toplevel_state));
|
configure->toplevel_state = malloc(sizeof(*configure->toplevel_state));
|
||||||
if (configure->toplevel_state == NULL) {
|
if (configure->toplevel_state == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
wl_resource_post_no_memory(surface->toplevel->resource);
|
wl_resource_post_no_memory(surface->toplevel->resource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ void send_xdg_toplevel_configure(struct wlr_xdg_surface *surface,
|
||||||
if (surface->toplevel->server_pending.maximized) {
|
if (surface->toplevel->server_pending.maximized) {
|
||||||
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR, "Could not allocate state for maximized xdg_toplevel");
|
wlr_log(WLR_ERROR, "Could not allocate state for maximized xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
*s = XDG_TOPLEVEL_STATE_MAXIMIZED;
|
*s = XDG_TOPLEVEL_STATE_MAXIMIZED;
|
||||||
|
@ -102,7 +102,7 @@ void send_xdg_toplevel_configure(struct wlr_xdg_surface *surface,
|
||||||
if (surface->toplevel->server_pending.fullscreen) {
|
if (surface->toplevel->server_pending.fullscreen) {
|
||||||
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR, "Could not allocate state for fullscreen xdg_toplevel");
|
wlr_log(WLR_ERROR, "Could not allocate state for fullscreen xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
*s = XDG_TOPLEVEL_STATE_FULLSCREEN;
|
*s = XDG_TOPLEVEL_STATE_FULLSCREEN;
|
||||||
|
@ -110,7 +110,7 @@ void send_xdg_toplevel_configure(struct wlr_xdg_surface *surface,
|
||||||
if (surface->toplevel->server_pending.resizing) {
|
if (surface->toplevel->server_pending.resizing) {
|
||||||
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR, "Could not allocate state for resizing xdg_toplevel");
|
wlr_log(WLR_ERROR, "Could not allocate state for resizing xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
*s = XDG_TOPLEVEL_STATE_RESIZING;
|
*s = XDG_TOPLEVEL_STATE_RESIZING;
|
||||||
|
@ -118,7 +118,7 @@ void send_xdg_toplevel_configure(struct wlr_xdg_surface *surface,
|
||||||
if (surface->toplevel->server_pending.activated) {
|
if (surface->toplevel->server_pending.activated) {
|
||||||
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR, "Could not allocate state for activated xdg_toplevel");
|
wlr_log(WLR_ERROR, "Could not allocate state for activated xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
*s = XDG_TOPLEVEL_STATE_ACTIVATED;
|
*s = XDG_TOPLEVEL_STATE_ACTIVATED;
|
||||||
|
@ -144,7 +144,7 @@ void send_xdg_toplevel_configure(struct wlr_xdg_surface *surface,
|
||||||
|
|
||||||
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"Could not allocate state for tiled xdg_toplevel");
|
"Could not allocate state for tiled xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ void send_xdg_toplevel_configure(struct wlr_xdg_surface *surface,
|
||||||
// toplevel maximized
|
// toplevel maximized
|
||||||
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
uint32_t *s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"Could not allocate state for maximized xdg_toplevel");
|
"Could not allocate state for maximized xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ static void xdg_toplevel_handle_show_window_menu(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ static void xdg_toplevel_handle_move(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ static void xdg_toplevel_handle_resize(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ static void xdg_surface_handle_set_window_geometry(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width <= 0 || height <= 0) {
|
if (width <= 0 || height <= 0) {
|
||||||
wlr_log(L_ERROR, "Client tried to set invalid geometry");
|
wlr_log(WLR_ERROR, "Client tried to set invalid geometry");
|
||||||
wl_resource_post_error(resource, -1, "Tried to set invalid xdg-surface geometry");
|
wl_resource_post_error(resource, -1, "Tried to set invalid xdg-surface geometry");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ static void xdg_surface_handle_destroy(struct wl_client *client,
|
||||||
struct wlr_xdg_surface_v6 *surface = xdg_surface_from_resource(resource);
|
struct wlr_xdg_surface_v6 *surface = xdg_surface_from_resource(resource);
|
||||||
|
|
||||||
if (surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE) {
|
if (surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE) {
|
||||||
wlr_log(L_ERROR, "Tried to destroy an xdg_surface before its role "
|
wlr_log(WLR_ERROR, "Tried to destroy an xdg_surface before its role "
|
||||||
"object");
|
"object");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ struct wlr_xdg_surface_v6 *create_xdg_surface_v6(
|
||||||
wlr_surface_set_role_committed(xdg_surface->surface,
|
wlr_surface_set_role_committed(xdg_surface->surface,
|
||||||
handle_surface_committed, xdg_surface);
|
handle_surface_committed, xdg_surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", xdg_surface,
|
wlr_log(WLR_DEBUG, "new xdg_surface %p (res %p)", xdg_surface,
|
||||||
xdg_surface->resource);
|
xdg_surface->resource);
|
||||||
wl_list_insert(&client->surfaces, &xdg_surface->link);
|
wl_list_insert(&client->surfaces, &xdg_surface->link);
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ static void xdg_toplevel_handle_show_window_menu(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ static void xdg_toplevel_handle_move(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ static void xdg_toplevel_handle_resize(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
wlr_log(L_DEBUG, "invalid serial for grab");
|
wlr_log(WLR_DEBUG, "invalid serial for grab");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ void send_xdg_toplevel_v6_configure(struct wlr_xdg_surface_v6 *surface,
|
||||||
|
|
||||||
configure->toplevel_state = malloc(sizeof(*configure->toplevel_state));
|
configure->toplevel_state = malloc(sizeof(*configure->toplevel_state));
|
||||||
if (configure->toplevel_state == NULL) {
|
if (configure->toplevel_state == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
wl_resource_post_no_memory(surface->toplevel->resource);
|
wl_resource_post_no_memory(surface->toplevel->resource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ void send_xdg_toplevel_v6_configure(struct wlr_xdg_surface_v6 *surface,
|
||||||
if (surface->toplevel->server_pending.maximized) {
|
if (surface->toplevel->server_pending.maximized) {
|
||||||
s = wl_array_add(&states, sizeof(uint32_t));
|
s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"Could not allocate state for maximized xdg_toplevel");
|
"Could not allocate state for maximized xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ void send_xdg_toplevel_v6_configure(struct wlr_xdg_surface_v6 *surface,
|
||||||
if (surface->toplevel->server_pending.fullscreen) {
|
if (surface->toplevel->server_pending.fullscreen) {
|
||||||
s = wl_array_add(&states, sizeof(uint32_t));
|
s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"Could not allocate state for fullscreen xdg_toplevel");
|
"Could not allocate state for fullscreen xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ void send_xdg_toplevel_v6_configure(struct wlr_xdg_surface_v6 *surface,
|
||||||
if (surface->toplevel->server_pending.resizing) {
|
if (surface->toplevel->server_pending.resizing) {
|
||||||
s = wl_array_add(&states, sizeof(uint32_t));
|
s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"Could not allocate state for resizing xdg_toplevel");
|
"Could not allocate state for resizing xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ void send_xdg_toplevel_v6_configure(struct wlr_xdg_surface_v6 *surface,
|
||||||
if (surface->toplevel->server_pending.activated) {
|
if (surface->toplevel->server_pending.activated) {
|
||||||
s = wl_array_add(&states, sizeof(uint32_t));
|
s = wl_array_add(&states, sizeof(uint32_t));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"Could not allocate state for activated xdg_toplevel");
|
"Could not allocate state for activated xdg_toplevel");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
26
util/log.c
26
util/log.c
|
@ -9,16 +9,16 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
static bool colored = true;
|
static bool colored = true;
|
||||||
static log_importance_t log_importance = L_ERROR;
|
static enum wlr_log_importance log_importance = WLR_ERROR;
|
||||||
|
|
||||||
static const char *verbosity_colors[] = {
|
static const char *verbosity_colors[] = {
|
||||||
[L_SILENT] = "",
|
[WLR_SILENT] = "",
|
||||||
[L_ERROR ] = "\x1B[1;31m",
|
[WLR_ERROR ] = "\x1B[1;31m",
|
||||||
[L_INFO ] = "\x1B[1;34m",
|
[WLR_INFO ] = "\x1B[1;34m",
|
||||||
[L_DEBUG ] = "\x1B[1;30m",
|
[WLR_DEBUG ] = "\x1B[1;30m",
|
||||||
};
|
};
|
||||||
|
|
||||||
static void log_stderr(log_importance_t verbosity, const char *fmt,
|
static void log_stderr(enum wlr_log_importance verbosity, const char *fmt,
|
||||||
va_list args) {
|
va_list args) {
|
||||||
if (verbosity > log_importance) {
|
if (verbosity > log_importance) {
|
||||||
return;
|
return;
|
||||||
|
@ -33,7 +33,7 @@ static void log_stderr(log_importance_t verbosity, const char *fmt,
|
||||||
strftime(buffer, sizeof(buffer), "%F %T - ", tm_info);
|
strftime(buffer, sizeof(buffer), "%F %T - ", tm_info);
|
||||||
fprintf(stderr, "%s", buffer);
|
fprintf(stderr, "%s", buffer);
|
||||||
|
|
||||||
unsigned c = (verbosity < L_LAST) ? verbosity : L_LAST - 1;
|
unsigned c = (verbosity < WLR_LOG_IMPORTANCE_LAST) ? verbosity : WLR_LOG_IMPORTANCE_LAST - 1;
|
||||||
|
|
||||||
if (colored && isatty(STDERR_FILENO)) {
|
if (colored && isatty(STDERR_FILENO)) {
|
||||||
fprintf(stderr, "%s", verbosity_colors[c]);
|
fprintf(stderr, "%s", verbosity_colors[c]);
|
||||||
|
@ -47,10 +47,10 @@ static void log_stderr(log_importance_t verbosity, const char *fmt,
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static log_callback_t log_callback = log_stderr;
|
static wlr_log_func_t log_callback = log_stderr;
|
||||||
|
|
||||||
void wlr_log_init(log_importance_t verbosity, log_callback_t callback) {
|
void wlr_log_init(enum wlr_log_importance verbosity, wlr_log_func_t callback) {
|
||||||
if (verbosity < L_LAST) {
|
if (verbosity < WLR_LOG_IMPORTANCE_LAST) {
|
||||||
log_importance = verbosity;
|
log_importance = verbosity;
|
||||||
}
|
}
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
@ -58,11 +58,11 @@ void wlr_log_init(log_importance_t verbosity, log_callback_t callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _wlr_vlog(log_importance_t verbosity, const char *fmt, va_list args) {
|
void _wlr_vlog(enum wlr_log_importance verbosity, const char *fmt, va_list args) {
|
||||||
log_callback(verbosity, fmt, args);
|
log_callback(verbosity, fmt, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _wlr_log(log_importance_t verbosity, const char *fmt, ...) {
|
void _wlr_log(enum wlr_log_importance verbosity, const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
log_callback(verbosity, fmt, args);
|
log_callback(verbosity, fmt, args);
|
||||||
|
@ -74,7 +74,7 @@ void _wlr_log(log_importance_t verbosity, const char *fmt, ...) {
|
||||||
// e.g. '/src/build/wlroots/backend/wayland/backend.c' and
|
// e.g. '/src/build/wlroots/backend/wayland/backend.c' and
|
||||||
// '../backend/wayland/backend.c' will both be stripped to
|
// '../backend/wayland/backend.c' will both be stripped to
|
||||||
// 'backend/wayland/backend.c'
|
// 'backend/wayland/backend.c'
|
||||||
const char *wlr_strip_path(const char *filepath) {
|
const char *_wlr_strip_path(const char *filepath) {
|
||||||
static int srclen = sizeof(WLR_SRC_DIR);
|
static int srclen = sizeof(WLR_SRC_DIR);
|
||||||
if (strstr(filepath, WLR_SRC_DIR) == filepath) {
|
if (strstr(filepath, WLR_SRC_DIR) == filepath) {
|
||||||
filepath += srclen;
|
filepath += srclen;
|
||||||
|
|
|
@ -3,6 +3,7 @@ WLROOTS_0_0_0 {
|
||||||
wlr_*;
|
wlr_*;
|
||||||
_wlr_log;
|
_wlr_log;
|
||||||
_wlr_vlog;
|
_wlr_vlog;
|
||||||
|
_wlr_strip_path;
|
||||||
local:
|
local:
|
||||||
wlr_signal_emit_safe;
|
wlr_signal_emit_safe;
|
||||||
*;
|
*;
|
||||||
|
|
|
@ -238,12 +238,12 @@ struct wlr_xcursor_theme *wlr_xcursor_theme_load(const char *name, int size) {
|
||||||
load_default_theme(theme);
|
load_default_theme(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Loaded cursor theme '%s', available cursors:",
|
wlr_log(WLR_DEBUG, "Loaded cursor theme '%s', available cursors:",
|
||||||
theme->name);
|
theme->name);
|
||||||
for (size_t i = 0; i < theme->cursor_count; ++i) {
|
for (size_t i = 0; i < theme->cursor_count; ++i) {
|
||||||
struct wlr_xcursor *c = theme->cursors[i];
|
struct wlr_xcursor *c = theme->cursors[i];
|
||||||
struct wlr_xcursor_image *i = c->images[0];
|
struct wlr_xcursor_image *i = c->images[0];
|
||||||
wlr_log(L_DEBUG, "%s (%u images) %dx%d+%d,%d",
|
wlr_log(WLR_DEBUG, "%s (%u images) %dx%d+%d,%d",
|
||||||
c->name, c->image_count,
|
c->name, c->image_count,
|
||||||
i->width, i->height, i->hotspot_x, i->hotspot_y);
|
i->width, i->height, i->hotspot_x, i->hotspot_y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
|
||||||
xcb_client_message_event_t *ev) {
|
xcb_client_message_event_t *ev) {
|
||||||
if (ev->type == xwm->atoms[DND_STATUS]) {
|
if (ev->type == xwm->atoms[DND_STATUS]) {
|
||||||
if (xwm->drag == NULL) {
|
if (xwm->drag == NULL) {
|
||||||
wlr_log(L_DEBUG, "ignoring XdndStatus client message because "
|
wlr_log(WLR_DEBUG, "ignoring XdndStatus client message because "
|
||||||
"there's no drag");
|
"there's no drag");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
if (xwm->drag_focus == NULL ||
|
if (xwm->drag_focus == NULL ||
|
||||||
target_window != xwm->drag_focus->window_id) {
|
target_window != xwm->drag_focus->window_id) {
|
||||||
wlr_log(L_DEBUG, "ignoring XdndStatus client message because "
|
wlr_log(WLR_DEBUG, "ignoring XdndStatus client message because "
|
||||||
"it doesn't match the current drag focus window ID");
|
"it doesn't match the current drag focus window ID");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
|
||||||
drag->source->accepted = accepted;
|
drag->source->accepted = accepted;
|
||||||
wlr_data_source_dnd_action(drag->source, action);
|
wlr_data_source_dnd_action(drag->source, action);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "DND_STATUS window=%d accepted=%d action=%d",
|
wlr_log(WLR_DEBUG, "DND_STATUS window=%d accepted=%d action=%d",
|
||||||
target_window, accepted, action);
|
target_window, accepted, action);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (ev->type == xwm->atoms[DND_FINISHED]) {
|
} else if (ev->type == xwm->atoms[DND_FINISHED]) {
|
||||||
|
@ -201,7 +201,7 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
|
||||||
// source is destroyed
|
// source is destroyed
|
||||||
if (xwm->seat == NULL || xwm->seat->drag_source == NULL ||
|
if (xwm->seat == NULL || xwm->seat->drag_source == NULL ||
|
||||||
xwm->drag != NULL) {
|
xwm->drag != NULL) {
|
||||||
wlr_log(L_DEBUG, "ignoring XdndFinished client message because "
|
wlr_log(WLR_DEBUG, "ignoring XdndFinished client message because "
|
||||||
"there's no finished drag");
|
"there's no finished drag");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
if (xwm->drag_focus == NULL ||
|
if (xwm->drag_focus == NULL ||
|
||||||
target_window != xwm->drag_focus->window_id) {
|
target_window != xwm->drag_focus->window_id) {
|
||||||
wlr_log(L_DEBUG, "ignoring XdndFinished client message because "
|
wlr_log(WLR_DEBUG, "ignoring XdndFinished client message because "
|
||||||
"it doesn't match the finished drag focus window ID");
|
"it doesn't match the finished drag focus window ID");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
|
||||||
wlr_data_source_dnd_finish(source);
|
wlr_data_source_dnd_finish(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "DND_FINISH window=%d performed=%d action=%d",
|
wlr_log(WLR_DEBUG, "DND_FINISH window=%d performed=%d action=%d",
|
||||||
target_window, performed, action);
|
target_window, performed, action);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -289,7 +289,7 @@ static void seat_handle_drag_drop(struct wl_listener *listener, void *data) {
|
||||||
return; // No xwayland surface focused
|
return; // No xwayland surface focused
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Wayland drag dropped over an Xwayland window");
|
wlr_log(WLR_DEBUG, "Wayland drag dropped over an Xwayland window");
|
||||||
xwm_dnd_send_drop(xwm, event->time);
|
xwm_dnd_send_drop(xwm, event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ static void seat_handle_drag_destroy(struct wl_listener *listener, void *data) {
|
||||||
// Don't reset drag focus yet because the target will read the drag source
|
// Don't reset drag focus yet because the target will read the drag source
|
||||||
// right after
|
// right after
|
||||||
if (xwm->drag_focus != NULL && !xwm->drag->source->accepted) {
|
if (xwm->drag_focus != NULL && !xwm->drag->source->accepted) {
|
||||||
wlr_log(L_DEBUG, "Wayland drag cancelled over an Xwayland window");
|
wlr_log(WLR_DEBUG, "Wayland drag cancelled over an Xwayland window");
|
||||||
xwm_dnd_send_leave(xwm);
|
xwm_dnd_send_leave(xwm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,11 @@ static int xwm_data_source_write(int fd, uint32_t mask, void *data) {
|
||||||
xwm_selection_transfer_destroy_property_reply(transfer);
|
xwm_selection_transfer_destroy_property_reply(transfer);
|
||||||
xwm_selection_transfer_remove_source(transfer);
|
xwm_selection_transfer_remove_source(transfer);
|
||||||
xwm_selection_transfer_close_source_fd(transfer);
|
xwm_selection_transfer_close_source_fd(transfer);
|
||||||
wlr_log(L_ERROR, "write error to target fd: %m");
|
wlr_log(WLR_ERROR, "write error to target fd: %m");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "wrote %zd (chunk size %zd) of %d bytes",
|
wlr_log(WLR_DEBUG, "wrote %zd (chunk size %zd) of %d bytes",
|
||||||
transfer->property_start + len,
|
transfer->property_start + len,
|
||||||
len, xcb_get_property_value_length(transfer->property_reply));
|
len, xcb_get_property_value_length(transfer->property_reply));
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ static int xwm_data_source_write(int fd, uint32_t mask, void *data) {
|
||||||
xwm_selection_transfer_remove_source(transfer);
|
xwm_selection_transfer_remove_source(transfer);
|
||||||
|
|
||||||
if (transfer->incr) {
|
if (transfer->incr) {
|
||||||
wlr_log(L_DEBUG, "deleting property");
|
wlr_log(WLR_DEBUG, "deleting property");
|
||||||
xcb_delete_property(xwm->xcb_conn, transfer->selection->window,
|
xcb_delete_property(xwm->xcb_conn, transfer->selection->window,
|
||||||
xwm->atoms[WL_SELECTION]);
|
xwm->atoms[WL_SELECTION]);
|
||||||
xcb_flush(xwm->xcb_conn);
|
xcb_flush(xwm->xcb_conn);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "transfer complete");
|
wlr_log(WLR_DEBUG, "transfer complete");
|
||||||
xwm_selection_transfer_close_source_fd(transfer);
|
xwm_selection_transfer_close_source_fd(transfer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ static void xwm_write_property(struct wlr_xwm_selection_transfer *transfer,
|
||||||
|
|
||||||
void xwm_get_incr_chunk(struct wlr_xwm_selection_transfer *transfer) {
|
void xwm_get_incr_chunk(struct wlr_xwm_selection_transfer *transfer) {
|
||||||
struct wlr_xwm *xwm = transfer->selection->xwm;
|
struct wlr_xwm *xwm = transfer->selection->xwm;
|
||||||
wlr_log(L_DEBUG, "xwm_get_incr_chunk");
|
wlr_log(WLR_DEBUG, "xwm_get_incr_chunk");
|
||||||
|
|
||||||
xcb_get_property_cookie_t cookie = xcb_get_property(xwm->xcb_conn,
|
xcb_get_property_cookie_t cookie = xcb_get_property(xwm->xcb_conn,
|
||||||
0, // delete
|
0, // delete
|
||||||
|
@ -88,7 +88,7 @@ void xwm_get_incr_chunk(struct wlr_xwm_selection_transfer *transfer) {
|
||||||
xcb_get_property_reply_t *reply =
|
xcb_get_property_reply_t *reply =
|
||||||
xcb_get_property_reply(xwm->xcb_conn, cookie, NULL);
|
xcb_get_property_reply(xwm->xcb_conn, cookie, NULL);
|
||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
wlr_log(L_ERROR, "cannot get selection property");
|
wlr_log(WLR_ERROR, "cannot get selection property");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//dump_property(xwm, xwm->atoms[WL_SELECTION], reply);
|
//dump_property(xwm, xwm->atoms[WL_SELECTION], reply);
|
||||||
|
@ -98,7 +98,7 @@ void xwm_get_incr_chunk(struct wlr_xwm_selection_transfer *transfer) {
|
||||||
* for freeing it */
|
* for freeing it */
|
||||||
xwm_write_property(transfer, reply);
|
xwm_write_property(transfer, reply);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "transfer complete");
|
wlr_log(WLR_DEBUG, "transfer complete");
|
||||||
xwm_selection_transfer_close_source_fd(transfer);
|
xwm_selection_transfer_close_source_fd(transfer);
|
||||||
free(reply);
|
free(reply);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ static void xwm_selection_get_data(struct wlr_xwm_selection *selection) {
|
||||||
xcb_get_property_reply_t *reply =
|
xcb_get_property_reply_t *reply =
|
||||||
xcb_get_property_reply(xwm->xcb_conn, cookie, NULL);
|
xcb_get_property_reply(xwm->xcb_conn, cookie, NULL);
|
||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
wlr_log(L_ERROR, "Cannot get selection property");
|
wlr_log(WLR_ERROR, "Cannot get selection property");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ static void source_send(struct wlr_xwm_selection *selection,
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
wlr_log(L_DEBUG, "Cannot send X11 selection to Wayland: "
|
wlr_log(WLR_DEBUG, "Cannot send X11 selection to Wayland: "
|
||||||
"unsupported MIME type");
|
"unsupported MIME type");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ static void xwm_selection_get_targets(struct wlr_xwm_selection *selection) {
|
||||||
|
|
||||||
void xwm_handle_selection_notify(struct wlr_xwm *xwm,
|
void xwm_handle_selection_notify(struct wlr_xwm *xwm,
|
||||||
xcb_selection_notify_event_t *event) {
|
xcb_selection_notify_event_t *event) {
|
||||||
wlr_log(L_DEBUG, "XCB_SELECTION_NOTIFY (selection=%u, property=%u, target=%u)",
|
wlr_log(WLR_DEBUG, "XCB_SELECTION_NOTIFY (selection=%u, property=%u, target=%u)",
|
||||||
event->selection, event->property,
|
event->selection, event->property,
|
||||||
event->target);
|
event->target);
|
||||||
|
|
||||||
|
@ -389,11 +389,11 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->property == XCB_ATOM_NONE) {
|
if (event->property == XCB_ATOM_NONE) {
|
||||||
wlr_log(L_ERROR, "convert selection failed");
|
wlr_log(WLR_ERROR, "convert selection failed");
|
||||||
} else if (event->target == xwm->atoms[TARGETS]) {
|
} else if (event->target == xwm->atoms[TARGETS]) {
|
||||||
// No xwayland surface focused, deny access to clipboard
|
// No xwayland surface focused, deny access to clipboard
|
||||||
if (xwm->focus_surface == NULL) {
|
if (xwm->focus_surface == NULL) {
|
||||||
wlr_log(L_DEBUG, "denying write access to clipboard: "
|
wlr_log(WLR_DEBUG, "denying write access to clipboard: "
|
||||||
"no xwayland surface focused");
|
"no xwayland surface focused");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
|
int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
|
||||||
xcb_xfixes_selection_notify_event_t *event) {
|
xcb_xfixes_selection_notify_event_t *event) {
|
||||||
wlr_log(L_DEBUG, "XCB_XFIXES_SELECTION_NOTIFY (selection=%u, owner=%u)",
|
wlr_log(WLR_DEBUG, "XCB_XFIXES_SELECTION_NOTIFY (selection=%u, owner=%u)",
|
||||||
event->selection, event->owner);
|
event->selection, event->owner);
|
||||||
|
|
||||||
struct wlr_xwm_selection *selection =
|
struct wlr_xwm_selection *selection =
|
||||||
|
@ -429,7 +429,7 @@ int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
|
||||||
} else if (selection == &xwm->dnd_selection) {
|
} else if (selection == &xwm->dnd_selection) {
|
||||||
// TODO: DND
|
// TODO: DND
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "X11 selection has been cleared, but cannot "
|
wlr_log(WLR_DEBUG, "X11 selection has been cleared, but cannot "
|
||||||
"clear Wayland selection");
|
"clear Wayland selection");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ static void xwm_selection_send_notify(struct wlr_xwm *xwm,
|
||||||
.property = success ? req->property : XCB_ATOM_NONE,
|
.property = success ? req->property : XCB_ATOM_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "SendEvent destination=%d SelectionNotify(31) time=%d "
|
wlr_log(WLR_DEBUG, "SendEvent destination=%d SelectionNotify(31) time=%d "
|
||||||
"requestor=%d selection=%d target=%d property=%d", req->requestor,
|
"requestor=%d selection=%d target=%d property=%d", req->requestor,
|
||||||
req->time, req->requestor, req->selection, req->target,
|
req->time, req->requestor, req->selection, req->target,
|
||||||
selection_notify.property);
|
selection_notify.property);
|
||||||
|
@ -82,7 +82,7 @@ static int xwm_data_source_read(int fd, uint32_t mask, void *data) {
|
||||||
if (transfer->source_data.size < INCR_CHUNK_SIZE) {
|
if (transfer->source_data.size < INCR_CHUNK_SIZE) {
|
||||||
p = wl_array_add(&transfer->source_data, INCR_CHUNK_SIZE);
|
p = wl_array_add(&transfer->source_data, INCR_CHUNK_SIZE);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
wlr_log(L_ERROR, "Could not allocate selection source_data");
|
wlr_log(WLR_ERROR, "Could not allocate selection source_data");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,17 +92,17 @@ static int xwm_data_source_read(int fd, uint32_t mask, void *data) {
|
||||||
size_t available = transfer->source_data.alloc - current;
|
size_t available = transfer->source_data.alloc - current;
|
||||||
ssize_t len = read(fd, p, available);
|
ssize_t len = read(fd, p, available);
|
||||||
if (len == -1) {
|
if (len == -1) {
|
||||||
wlr_log(L_ERROR, "read error from data source: %m");
|
wlr_log(WLR_ERROR, "read error from data source: %m");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "read %zd bytes (available %zu, mask 0x%x)", len,
|
wlr_log(WLR_DEBUG, "read %zd bytes (available %zu, mask 0x%x)", len,
|
||||||
available, mask);
|
available, mask);
|
||||||
|
|
||||||
transfer->source_data.size = current + len;
|
transfer->source_data.size = current + len;
|
||||||
if (transfer->source_data.size >= INCR_CHUNK_SIZE) {
|
if (transfer->source_data.size >= INCR_CHUNK_SIZE) {
|
||||||
if (!transfer->incr) {
|
if (!transfer->incr) {
|
||||||
wlr_log(L_DEBUG, "got %zu bytes, starting incr",
|
wlr_log(WLR_DEBUG, "got %zu bytes, starting incr",
|
||||||
transfer->source_data.size);
|
transfer->source_data.size);
|
||||||
|
|
||||||
size_t incr_chunk_size = INCR_CHUNK_SIZE;
|
size_t incr_chunk_size = INCR_CHUNK_SIZE;
|
||||||
|
@ -119,37 +119,37 @@ static int xwm_data_source_read(int fd, uint32_t mask, void *data) {
|
||||||
xwm_selection_transfer_remove_source(transfer);
|
xwm_selection_transfer_remove_source(transfer);
|
||||||
xwm_selection_send_notify(xwm, &transfer->request, true);
|
xwm_selection_send_notify(xwm, &transfer->request, true);
|
||||||
} else if (transfer->property_set) {
|
} else if (transfer->property_set) {
|
||||||
wlr_log(L_DEBUG, "got %zu bytes, waiting for property delete",
|
wlr_log(WLR_DEBUG, "got %zu bytes, waiting for property delete",
|
||||||
transfer->source_data.size);
|
transfer->source_data.size);
|
||||||
|
|
||||||
transfer->flush_property_on_delete = true;
|
transfer->flush_property_on_delete = true;
|
||||||
xwm_selection_transfer_remove_source(transfer);
|
xwm_selection_transfer_remove_source(transfer);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "got %zu bytes, property deleted, setting new "
|
wlr_log(WLR_DEBUG, "got %zu bytes, property deleted, setting new "
|
||||||
"property", transfer->source_data.size);
|
"property", transfer->source_data.size);
|
||||||
xwm_selection_flush_source_data(transfer);
|
xwm_selection_flush_source_data(transfer);
|
||||||
}
|
}
|
||||||
} else if (len == 0 && !transfer->incr) {
|
} else if (len == 0 && !transfer->incr) {
|
||||||
wlr_log(L_DEBUG, "non-incr transfer complete");
|
wlr_log(WLR_DEBUG, "non-incr transfer complete");
|
||||||
xwm_selection_flush_source_data(transfer);
|
xwm_selection_flush_source_data(transfer);
|
||||||
xwm_selection_send_notify(xwm, &transfer->request, true);
|
xwm_selection_send_notify(xwm, &transfer->request, true);
|
||||||
xwm_selection_transfer_destroy_outgoing(transfer);
|
xwm_selection_transfer_destroy_outgoing(transfer);
|
||||||
} else if (len == 0 && transfer->incr) {
|
} else if (len == 0 && transfer->incr) {
|
||||||
wlr_log(L_DEBUG, "incr transfer complete");
|
wlr_log(WLR_DEBUG, "incr transfer complete");
|
||||||
|
|
||||||
transfer->flush_property_on_delete = true;
|
transfer->flush_property_on_delete = true;
|
||||||
if (transfer->property_set) {
|
if (transfer->property_set) {
|
||||||
wlr_log(L_DEBUG, "got %zu bytes, waiting for property delete",
|
wlr_log(WLR_DEBUG, "got %zu bytes, waiting for property delete",
|
||||||
transfer->source_data.size);
|
transfer->source_data.size);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "got %zu bytes, property deleted, setting new "
|
wlr_log(WLR_DEBUG, "got %zu bytes, property deleted, setting new "
|
||||||
"property", transfer->source_data.size);
|
"property", transfer->source_data.size);
|
||||||
xwm_selection_flush_source_data(transfer);
|
xwm_selection_flush_source_data(transfer);
|
||||||
}
|
}
|
||||||
xwm_selection_transfer_remove_source(transfer);
|
xwm_selection_transfer_remove_source(transfer);
|
||||||
xwm_selection_transfer_close_source_fd(transfer);
|
xwm_selection_transfer_close_source_fd(transfer);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "nothing happened, buffered the bytes");
|
wlr_log(WLR_DEBUG, "nothing happened, buffered the bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -161,11 +161,11 @@ error_out:
|
||||||
}
|
}
|
||||||
|
|
||||||
void xwm_send_incr_chunk(struct wlr_xwm_selection_transfer *transfer) {
|
void xwm_send_incr_chunk(struct wlr_xwm_selection_transfer *transfer) {
|
||||||
wlr_log(L_DEBUG, "property deleted");
|
wlr_log(WLR_DEBUG, "property deleted");
|
||||||
|
|
||||||
transfer->property_set = false;
|
transfer->property_set = false;
|
||||||
if (transfer->flush_property_on_delete) {
|
if (transfer->flush_property_on_delete) {
|
||||||
wlr_log(L_DEBUG, "setting new property, %zu bytes",
|
wlr_log(WLR_DEBUG, "setting new property, %zu bytes",
|
||||||
transfer->source_data.size);
|
transfer->source_data.size);
|
||||||
transfer->flush_property_on_delete = false;
|
transfer->flush_property_on_delete = false;
|
||||||
int length = xwm_selection_flush_source_data(transfer);
|
int length = xwm_selection_flush_source_data(transfer);
|
||||||
|
@ -211,7 +211,7 @@ static void xwm_selection_source_send(struct wlr_xwm_selection *selection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "not sending selection: no selection source available");
|
wlr_log(WLR_DEBUG, "not sending selection: no selection source available");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwm_selection_transfer_start_outgoing(
|
static void xwm_selection_transfer_start_outgoing(
|
||||||
|
@ -256,7 +256,7 @@ static void xwm_selection_send_data(struct wlr_xwm_selection *selection,
|
||||||
struct wl_array *mime_types =
|
struct wl_array *mime_types =
|
||||||
xwm_selection_source_get_mime_types(selection);
|
xwm_selection_source_get_mime_types(selection);
|
||||||
if (mime_types == NULL) {
|
if (mime_types == NULL) {
|
||||||
wlr_log(L_ERROR, "not sending selection: no MIME type list available");
|
wlr_log(WLR_ERROR, "not sending selection: no MIME type list available");
|
||||||
xwm_selection_send_notify(selection->xwm, req, false);
|
xwm_selection_send_notify(selection->xwm, req, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ static void xwm_selection_send_data(struct wlr_xwm_selection *selection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
wlr_log(L_ERROR, "not sending selection: "
|
wlr_log(WLR_ERROR, "not sending selection: "
|
||||||
"requested an unsupported MIME type %s", mime_type);
|
"requested an unsupported MIME type %s", mime_type);
|
||||||
xwm_selection_send_notify(selection->xwm, req, false);
|
xwm_selection_send_notify(selection->xwm, req, false);
|
||||||
return;
|
return;
|
||||||
|
@ -280,7 +280,7 @@ static void xwm_selection_send_data(struct wlr_xwm_selection *selection,
|
||||||
struct wlr_xwm_selection_transfer *transfer =
|
struct wlr_xwm_selection_transfer *transfer =
|
||||||
calloc(1, sizeof(struct wlr_xwm_selection_transfer));
|
calloc(1, sizeof(struct wlr_xwm_selection_transfer));
|
||||||
if (transfer == NULL) {
|
if (transfer == NULL) {
|
||||||
wlr_log(L_ERROR, "Allocation failed");
|
wlr_log(WLR_ERROR, "Allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
transfer->selection = selection;
|
transfer->selection = selection;
|
||||||
|
@ -289,7 +289,7 @@ static void xwm_selection_send_data(struct wlr_xwm_selection *selection,
|
||||||
|
|
||||||
int p[2];
|
int p[2];
|
||||||
if (pipe(p) == -1) {
|
if (pipe(p) == -1) {
|
||||||
wlr_log(L_ERROR, "pipe() failed: %m");
|
wlr_log(WLR_ERROR, "pipe() failed: %m");
|
||||||
xwm_selection_send_notify(selection->xwm, req, false);
|
xwm_selection_send_notify(selection->xwm, req, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ static void xwm_selection_send_data(struct wlr_xwm_selection *selection,
|
||||||
|
|
||||||
transfer->source_fd = p[0];
|
transfer->source_fd = p[0];
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Sending Wayland selection %u to Xwayland window with "
|
wlr_log(WLR_DEBUG, "Sending Wayland selection %u to Xwayland window with "
|
||||||
"MIME type %s, target %u", req->target, mime_type, req->target);
|
"MIME type %s, target %u", req->target, mime_type, req->target);
|
||||||
xwm_selection_source_send(selection, mime_type, p[1]);
|
xwm_selection_source_send(selection, mime_type, p[1]);
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ static void xwm_selection_send_targets(struct wlr_xwm_selection *selection,
|
||||||
struct wl_array *mime_types =
|
struct wl_array *mime_types =
|
||||||
xwm_selection_source_get_mime_types(selection);
|
xwm_selection_source_get_mime_types(selection);
|
||||||
if (mime_types == NULL) {
|
if (mime_types == NULL) {
|
||||||
wlr_log(L_ERROR, "not sending selection targets: "
|
wlr_log(WLR_ERROR, "not sending selection targets: "
|
||||||
"no selection source available");
|
"no selection source available");
|
||||||
xwm_selection_send_notify(selection->xwm, req, false);
|
xwm_selection_send_notify(selection->xwm, req, false);
|
||||||
return;
|
return;
|
||||||
|
@ -364,7 +364,7 @@ static void xwm_selection_send_timestamp(struct wlr_xwm_selection *selection,
|
||||||
|
|
||||||
void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
||||||
xcb_selection_request_event_t *req) {
|
xcb_selection_request_event_t *req) {
|
||||||
wlr_log(L_DEBUG, "XCB_SELECTION_REQUEST (time=%u owner=%u, requestor=%u "
|
wlr_log(WLR_DEBUG, "XCB_SELECTION_REQUEST (time=%u owner=%u, requestor=%u "
|
||||||
"selection=%u, target=%u, property=%u)",
|
"selection=%u, target=%u, property=%u)",
|
||||||
req->time, req->owner, req->requestor, req->selection, req->target,
|
req->time, req->owner, req->requestor, req->selection, req->target,
|
||||||
req->property);
|
req->property);
|
||||||
|
@ -380,19 +380,19 @@ void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
||||||
struct wlr_xwm_selection *selection =
|
struct wlr_xwm_selection *selection =
|
||||||
xwm_get_selection(xwm, req->selection);
|
xwm_get_selection(xwm, req->selection);
|
||||||
if (selection == NULL) {
|
if (selection == NULL) {
|
||||||
wlr_log(L_DEBUG, "received selection request for unknown selection");
|
wlr_log(WLR_DEBUG, "received selection request for unknown selection");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection->window != req->owner) {
|
if (selection->window != req->owner) {
|
||||||
wlr_log(L_DEBUG, "received selection request with invalid owner");
|
wlr_log(WLR_DEBUG, "received selection request with invalid owner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No xwayland surface focused, deny access to clipboard
|
// No xwayland surface focused, deny access to clipboard
|
||||||
if (xwm->focus_surface == NULL && xwm->drag_focus == NULL) {
|
if (xwm->focus_surface == NULL && xwm->drag_focus == NULL) {
|
||||||
char *selection_name = xwm_get_atom_name(xwm, selection->atom);
|
char *selection_name = xwm_get_atom_name(xwm, selection->atom);
|
||||||
wlr_log(L_DEBUG, "denying read access to selection %u (%s): "
|
wlr_log(WLR_DEBUG, "denying read access to selection %u (%s): "
|
||||||
"no xwayland surface focused", selection->atom, selection_name);
|
"no xwayland surface focused", selection->atom, selection_name);
|
||||||
free(selection_name);
|
free(selection_name);
|
||||||
xwm_selection_send_notify(xwm, req, false);
|
xwm_selection_send_notify(xwm, req, false);
|
||||||
|
@ -409,7 +409,7 @@ void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
||||||
// Send data
|
// Send data
|
||||||
char *mime_type = xwm_mime_type_from_atom(xwm, req->target);
|
char *mime_type = xwm_mime_type_from_atom(xwm, req->target);
|
||||||
if (mime_type == NULL) {
|
if (mime_type == NULL) {
|
||||||
wlr_log(L_ERROR, "ignoring selection request: unknown atom %u",
|
wlr_log(WLR_ERROR, "ignoring selection request: unknown atom %u",
|
||||||
req->target);
|
req->target);
|
||||||
xwm_selection_send_notify(xwm, req, false);
|
xwm_selection_send_notify(xwm, req, false);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -114,7 +114,7 @@ static int xwm_handle_selection_property_notify(struct wlr_xwm *xwm,
|
||||||
int xwm_handle_selection_event(struct wlr_xwm *xwm,
|
int xwm_handle_selection_event(struct wlr_xwm *xwm,
|
||||||
xcb_generic_event_t *event) {
|
xcb_generic_event_t *event) {
|
||||||
if (xwm->seat == NULL) {
|
if (xwm->seat == NULL) {
|
||||||
wlr_log(L_DEBUG, "not handling selection events: "
|
wlr_log(WLR_DEBUG, "not handling selection events: "
|
||||||
"no seat assigned to xwayland");
|
"no seat assigned to xwayland");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ static int open_socket(struct sockaddr_un *addr, size_t path_size) {
|
||||||
|
|
||||||
fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
wlr_log_errno(L_DEBUG, "Failed to create socket %c%s",
|
wlr_log_errno(WLR_DEBUG, "Failed to create socket %c%s",
|
||||||
addr->sun_path[0] ? addr->sun_path[0] : '@',
|
addr->sun_path[0] ? addr->sun_path[0] : '@',
|
||||||
addr->sun_path + 1);
|
addr->sun_path + 1);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -42,14 +42,14 @@ static int open_socket(struct sockaddr_un *addr, size_t path_size) {
|
||||||
}
|
}
|
||||||
if (bind(fd, (struct sockaddr*)addr, size) < 0) {
|
if (bind(fd, (struct sockaddr*)addr, size) < 0) {
|
||||||
rc = errno;
|
rc = errno;
|
||||||
wlr_log_errno(L_DEBUG, "Failed to bind socket %c%s",
|
wlr_log_errno(WLR_DEBUG, "Failed to bind socket %c%s",
|
||||||
addr->sun_path[0] ? addr->sun_path[0] : '@',
|
addr->sun_path[0] ? addr->sun_path[0] : '@',
|
||||||
addr->sun_path + 1);
|
addr->sun_path + 1);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (listen(fd, 1) < 0) {
|
if (listen(fd, 1) < 0) {
|
||||||
rc = errno;
|
rc = errno;
|
||||||
wlr_log_errno(L_DEBUG, "Failed to listen to socket %c%s",
|
wlr_log_errno(WLR_DEBUG, "Failed to listen to socket %c%s",
|
||||||
addr->sun_path[0] ? addr->sun_path[0] : '@',
|
addr->sun_path[0] ? addr->sun_path[0] : '@',
|
||||||
addr->sun_path + 1);
|
addr->sun_path + 1);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -160,7 +160,7 @@ int open_display_sockets(int socks[2]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display > 32) {
|
if (display > 32) {
|
||||||
wlr_log(L_ERROR, "No display available in the first 33");
|
wlr_log(WLR_ERROR, "No display available in the first 33");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ static void safe_close(int fd) {
|
||||||
|
|
||||||
static int unset_cloexec(int fd) {
|
static int unset_cloexec(int fd) {
|
||||||
if (fcntl(fd, F_SETFD, 0) != 0) {
|
if (fcntl(fd, F_SETFD, 0) != 0) {
|
||||||
wlr_log_errno(L_ERROR, "fcntl() failed on fd %d", fd);
|
wlr_log_errno(WLR_ERROR, "fcntl() failed on fd %d", fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -98,19 +98,19 @@ static void exec_xwayland(struct wlr_xwayland *wlr_xwayland) {
|
||||||
fill_arg(&cur_arg, "%d", wlr_xwayland->x_fd[0]) < 0 ||
|
fill_arg(&cur_arg, "%d", wlr_xwayland->x_fd[0]) < 0 ||
|
||||||
fill_arg(&cur_arg, "%d", wlr_xwayland->x_fd[1]) < 0 ||
|
fill_arg(&cur_arg, "%d", wlr_xwayland->x_fd[1]) < 0 ||
|
||||||
fill_arg(&cur_arg, "%d", wlr_xwayland->wm_fd[1]) < 0) {
|
fill_arg(&cur_arg, "%d", wlr_xwayland->wm_fd[1]) < 0) {
|
||||||
wlr_log_errno(L_ERROR, "alloc/print failure");
|
wlr_log_errno(WLR_ERROR, "alloc/print failure");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
||||||
const char *path_var = getenv("PATH");
|
const char *path_var = getenv("PATH");
|
||||||
if (!xdg_runtime) {
|
if (!xdg_runtime) {
|
||||||
wlr_log(L_ERROR, "XDG_RUNTIME_DIR is not set");
|
wlr_log(WLR_ERROR, "XDG_RUNTIME_DIR is not set");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clearenv()) {
|
if (clearenv()) {
|
||||||
wlr_log_errno(L_ERROR, "clearenv failed");
|
wlr_log_errno(WLR_ERROR, "clearenv failed");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
setenv("XDG_RUNTIME_DIR", xdg_runtime, true);
|
setenv("XDG_RUNTIME_DIR", xdg_runtime, true);
|
||||||
|
@ -119,7 +119,7 @@ static void exec_xwayland(struct wlr_xwayland *wlr_xwayland) {
|
||||||
snprintf(wayland_socket_str, sizeof(wayland_socket_str), "%d", wlr_xwayland->wl_fd[1]);
|
snprintf(wayland_socket_str, sizeof(wayland_socket_str), "%d", wlr_xwayland->wl_fd[1]);
|
||||||
setenv("WAYLAND_SOCKET", wayland_socket_str, true);
|
setenv("WAYLAND_SOCKET", wayland_socket_str, true);
|
||||||
|
|
||||||
wlr_log(L_INFO, "WAYLAND_SOCKET=%d Xwayland :%d -rootless -terminate -listen %d -listen %d -wm %d",
|
wlr_log(WLR_INFO, "WAYLAND_SOCKET=%d Xwayland :%d -rootless -terminate -listen %d -listen %d -wm %d",
|
||||||
wlr_xwayland->wl_fd[1], wlr_xwayland->display, wlr_xwayland->x_fd[0],
|
wlr_xwayland->wl_fd[1], wlr_xwayland->display, wlr_xwayland->x_fd[0],
|
||||||
wlr_xwayland->x_fd[1], wlr_xwayland->wm_fd[1]);
|
wlr_xwayland->x_fd[1], wlr_xwayland->wm_fd[1]);
|
||||||
|
|
||||||
|
@ -207,10 +207,10 @@ static void handle_client_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
if (time(NULL) - wlr_xwayland->server_start > 5) {
|
if (time(NULL) - wlr_xwayland->server_start > 5) {
|
||||||
if (wlr_xwayland->lazy) {
|
if (wlr_xwayland->lazy) {
|
||||||
wlr_log(L_INFO, "Restarting Xwayland (lazy)");
|
wlr_log(WLR_INFO, "Restarting Xwayland (lazy)");
|
||||||
xwayland_start_server_lazy(wlr_xwayland);
|
xwayland_start_server_lazy(wlr_xwayland);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_INFO, "Restarting Xwayland");
|
wlr_log(WLR_INFO, "Restarting Xwayland");
|
||||||
xwayland_start_server(wlr_xwayland);
|
xwayland_start_server(wlr_xwayland);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,14 +237,14 @@ static int xserver_handle_ready(int signal_number, void *data) {
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wlr_log_errno(L_ERROR, "waitpid for Xwayland fork failed");
|
wlr_log_errno(WLR_ERROR, "waitpid for Xwayland fork failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (stat_val) {
|
if (stat_val) {
|
||||||
wlr_log(L_ERROR, "Xwayland startup failed, not setting up xwm");
|
wlr_log(WLR_ERROR, "Xwayland startup failed, not setting up xwm");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "Xserver is ready");
|
wlr_log(WLR_DEBUG, "Xserver is ready");
|
||||||
|
|
||||||
wlr_xwayland->xwm = xwm_create(wlr_xwayland);
|
wlr_xwayland->xwm = xwm_create(wlr_xwayland);
|
||||||
if (!wlr_xwayland->xwm) {
|
if (!wlr_xwayland->xwm) {
|
||||||
|
@ -311,14 +311,14 @@ static bool xwayland_start_server(struct wlr_xwayland *wlr_xwayland) {
|
||||||
|
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wl_fd) != 0 ||
|
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wl_fd) != 0 ||
|
||||||
socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wm_fd) != 0) {
|
socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wm_fd) != 0) {
|
||||||
wlr_log_errno(L_ERROR, "failed to create socketpair");
|
wlr_log_errno(WLR_ERROR, "failed to create socketpair");
|
||||||
xwayland_finish_server(wlr_xwayland);
|
xwayland_finish_server(wlr_xwayland);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
wlr_xwayland->server_start = time(NULL);
|
wlr_xwayland->server_start = time(NULL);
|
||||||
|
|
||||||
if (!(wlr_xwayland->client = wl_client_create(wlr_xwayland->wl_display, wlr_xwayland->wl_fd[0]))) {
|
if (!(wlr_xwayland->client = wl_client_create(wlr_xwayland->wl_display, wlr_xwayland->wl_fd[0]))) {
|
||||||
wlr_log_errno(L_ERROR, "wl_client_create failed");
|
wlr_log_errno(WLR_ERROR, "wl_client_create failed");
|
||||||
xwayland_finish_server(wlr_xwayland);
|
xwayland_finish_server(wlr_xwayland);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -346,16 +346,16 @@ static bool xwayland_start_server(struct wlr_xwayland *wlr_xwayland) {
|
||||||
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
sigprocmask(SIG_BLOCK, &sigset, NULL);
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
exec_xwayland(wlr_xwayland);
|
exec_xwayland(wlr_xwayland);
|
||||||
wlr_log_errno(L_ERROR, "failed to exec Xwayland");
|
wlr_log_errno(WLR_ERROR, "failed to exec Xwayland");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
wlr_log_errno(L_ERROR, "second fork failed");
|
wlr_log_errno(WLR_ERROR, "second fork failed");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
sigwait(&sigset, &sig);
|
sigwait(&sigset, &sig);
|
||||||
kill(ppid, SIGUSR1);
|
kill(ppid, SIGUSR1);
|
||||||
wlr_log(L_DEBUG, "sent SIGUSR1 to process %d", ppid);
|
wlr_log(WLR_DEBUG, "sent SIGUSR1 to process %d", ppid);
|
||||||
if (sig == SIGCHLD) {
|
if (sig == SIGCHLD) {
|
||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
|
@ -363,7 +363,7 @@ static bool xwayland_start_server(struct wlr_xwayland *wlr_xwayland) {
|
||||||
_exit(EXIT_SUCCESS);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
if (wlr_xwayland->pid < 0) {
|
if (wlr_xwayland->pid < 0) {
|
||||||
wlr_log_errno(L_ERROR, "fork failed");
|
wlr_log_errno(WLR_ERROR, "fork failed");
|
||||||
xwayland_finish_server(wlr_xwayland);
|
xwayland_finish_server(wlr_xwayland);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
|
||||||
struct wlr_xwayland_surface *surface =
|
struct wlr_xwayland_surface *surface =
|
||||||
calloc(1, sizeof(struct wlr_xwayland_surface));
|
calloc(1, sizeof(struct wlr_xwayland_surface));
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
wlr_log(L_ERROR, "Could not allocate wlr xwayland surface");
|
wlr_log(WLR_ERROR, "Could not allocate wlr xwayland surface");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
|
||||||
xwayland_surface_handle_ping_timeout, surface);
|
xwayland_surface_handle_ping_timeout, surface);
|
||||||
if (surface->ping_timer == NULL) {
|
if (surface->ping_timer == NULL) {
|
||||||
free(surface);
|
free(surface);
|
||||||
wlr_log(L_ERROR, "Could not add timer to event loop");
|
wlr_log(WLR_ERROR, "Could not add timer to event loop");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ static void read_surface_class(struct wlr_xwm *xwm,
|
||||||
surface->class = NULL;
|
surface->class = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "XCB_ATOM_WM_CLASS: %s %s", surface->instance,
|
wlr_log(WLR_DEBUG, "XCB_ATOM_WM_CLASS: %s %s", surface->instance,
|
||||||
surface->class);
|
surface->class);
|
||||||
wlr_signal_emit_safe(&surface->events.set_class, surface);
|
wlr_signal_emit_safe(&surface->events.set_class, surface);
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ static void read_surface_title(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
xsurface->has_utf8_title = is_utf8;
|
xsurface->has_utf8_title = is_utf8;
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "XCB_ATOM_WM_NAME: %s", xsurface->title);
|
wlr_log(WLR_DEBUG, "XCB_ATOM_WM_NAME: %s", xsurface->title);
|
||||||
wlr_signal_emit_safe(&xsurface->events.set_title, xsurface);
|
wlr_signal_emit_safe(&xsurface->events.set_title, xsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ static void read_surface_parent(struct wlr_xwm *xwm,
|
||||||
wl_list_init(&xsurface->parent_link);
|
wl_list_init(&xsurface->parent_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "XCB_ATOM_WM_TRANSIENT_FOR: %p", xsurface->parent);
|
wlr_log(WLR_DEBUG, "XCB_ATOM_WM_TRANSIENT_FOR: %p", xsurface->parent);
|
||||||
wlr_signal_emit_safe(&xsurface->events.set_parent, xsurface);
|
wlr_signal_emit_safe(&xsurface->events.set_parent, xsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ static void read_surface_pid(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
pid_t *pid = xcb_get_property_value(reply);
|
pid_t *pid = xcb_get_property_value(reply);
|
||||||
xsurface->pid = *pid;
|
xsurface->pid = *pid;
|
||||||
wlr_log(L_DEBUG, "NET_WM_PID %d", xsurface->pid);
|
wlr_log(WLR_DEBUG, "NET_WM_PID %d", xsurface->pid);
|
||||||
wlr_signal_emit_safe(&xsurface->events.set_pid, xsurface);
|
wlr_signal_emit_safe(&xsurface->events.set_pid, xsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ static void read_surface_window_type(struct wlr_xwm *xwm,
|
||||||
memcpy(xsurface->window_type, atoms, atoms_size);
|
memcpy(xsurface->window_type, atoms, atoms_size);
|
||||||
xsurface->window_type_len = atoms_len;
|
xsurface->window_type_len = atoms_len;
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "NET_WM_WINDOW_TYPE (%zu)", atoms_len);
|
wlr_log(WLR_DEBUG, "NET_WM_WINDOW_TYPE (%zu)", atoms_len);
|
||||||
wlr_signal_emit_safe(&xsurface->events.set_window_type, xsurface);
|
wlr_signal_emit_safe(&xsurface->events.set_window_type, xsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ static void read_surface_protocols(struct wlr_xwm *xwm,
|
||||||
memcpy(xsurface->protocols, atoms, atoms_size);
|
memcpy(xsurface->protocols, atoms, atoms_size);
|
||||||
xsurface->protocols_len = atoms_len;
|
xsurface->protocols_len = atoms_len;
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "WM_PROTOCOLS (%zu)", atoms_len);
|
wlr_log(WLR_DEBUG, "WM_PROTOCOLS (%zu)", atoms_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WLR_HAS_XCB_ICCCM
|
#ifdef WLR_HAS_XCB_ICCCM
|
||||||
|
@ -492,7 +492,7 @@ static void read_surface_hints(struct wlr_xwm *xwm,
|
||||||
memcpy(xsurface->hints, &hints, sizeof(struct wlr_xwayland_surface_hints));
|
memcpy(xsurface->hints, &hints, sizeof(struct wlr_xwayland_surface_hints));
|
||||||
xsurface->hints_urgency = xcb_icccm_wm_hints_get_urgency(&hints);
|
xsurface->hints_urgency = xcb_icccm_wm_hints_get_urgency(&hints);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "WM_HINTS (%d)", reply->value_len);
|
wlr_log(WLR_DEBUG, "WM_HINTS (%d)", reply->value_len);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void read_surface_hints(struct wlr_xwm *xwm,
|
static void read_surface_hints(struct wlr_xwm *xwm,
|
||||||
|
@ -522,7 +522,7 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm,
|
||||||
memcpy(xsurface->size_hints, &size_hints,
|
memcpy(xsurface->size_hints, &size_hints,
|
||||||
sizeof(struct wlr_xwayland_surface_size_hints));
|
sizeof(struct wlr_xwayland_surface_size_hints));
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "WM_NORMAL_HINTS (%d)", reply->value_len);
|
wlr_log(WLR_DEBUG, "WM_NORMAL_HINTS (%d)", reply->value_len);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void read_surface_normal_hints(struct wlr_xwm *xwm,
|
static void read_surface_normal_hints(struct wlr_xwm *xwm,
|
||||||
|
@ -565,7 +565,7 @@ static void read_surface_motif_hints(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "MOTIF_WM_HINTS (%d)", reply->value_len);
|
wlr_log(WLR_DEBUG, "MOTIF_WM_HINTS (%d)", reply->value_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_surface_net_wm_state(struct wlr_xwm *xwm,
|
static void read_surface_net_wm_state(struct wlr_xwm *xwm,
|
||||||
|
@ -632,7 +632,7 @@ static void read_surface_property(struct wlr_xwm *xwm,
|
||||||
read_surface_motif_hints(xwm, xsurface, reply);
|
read_surface_motif_hints(xwm, xsurface, reply);
|
||||||
} else {
|
} else {
|
||||||
char *prop_name = xwm_get_atom_name(xwm, property);
|
char *prop_name = xwm_get_atom_name(xwm, property);
|
||||||
wlr_log(L_DEBUG, "unhandled X11 property %u (%s) for window %u",
|
wlr_log(WLR_DEBUG, "unhandled X11 property %u (%s) for window %u",
|
||||||
property, prop_name, xsurface->window_id);
|
property, prop_name, xsurface->window_id);
|
||||||
free(prop_name);
|
free(prop_name);
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ static void xsurface_unmap(struct wlr_xwayland_surface *surface) {
|
||||||
|
|
||||||
static void xwm_handle_create_notify(struct wlr_xwm *xwm,
|
static void xwm_handle_create_notify(struct wlr_xwm *xwm,
|
||||||
xcb_create_notify_event_t *ev) {
|
xcb_create_notify_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_CREATE_NOTIFY (%u)", ev->window);
|
wlr_log(WLR_DEBUG, "XCB_CREATE_NOTIFY (%u)", ev->window);
|
||||||
|
|
||||||
if (ev->window == xwm->window ||
|
if (ev->window == xwm->window ||
|
||||||
ev->window == xwm->selection_window ||
|
ev->window == xwm->selection_window ||
|
||||||
|
@ -723,7 +723,7 @@ static void xwm_handle_create_notify(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
|
static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
|
||||||
xcb_destroy_notify_event_t *ev) {
|
xcb_destroy_notify_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_DESTROY_NOTIFY (%u)", ev->window);
|
wlr_log(WLR_DEBUG, "XCB_DESTROY_NOTIFY (%u)", ev->window);
|
||||||
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
if (xsurface == NULL) {
|
if (xsurface == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -733,7 +733,7 @@ static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
static void xwm_handle_configure_request(struct wlr_xwm *xwm,
|
static void xwm_handle_configure_request(struct wlr_xwm *xwm,
|
||||||
xcb_configure_request_event_t *ev) {
|
xcb_configure_request_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_CONFIGURE_REQUEST (%u) [%ux%u+%d,%d]", ev->window,
|
wlr_log(WLR_DEBUG, "XCB_CONFIGURE_REQUEST (%u) [%ux%u+%d,%d]", ev->window,
|
||||||
ev->width, ev->height, ev->x, ev->y);
|
ev->width, ev->height, ev->x, ev->y);
|
||||||
struct wlr_xwayland_surface *surface = lookup_surface(xwm, ev->window);
|
struct wlr_xwayland_surface *surface = lookup_surface(xwm, ev->window);
|
||||||
if (surface == NULL) {
|
if (surface == NULL) {
|
||||||
|
@ -791,7 +791,7 @@ static void xsurface_set_wm_state(struct wlr_xwayland_surface *xsurface,
|
||||||
|
|
||||||
static void xwm_handle_map_request(struct wlr_xwm *xwm,
|
static void xwm_handle_map_request(struct wlr_xwm *xwm,
|
||||||
xcb_map_request_event_t *ev) {
|
xcb_map_request_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_MAP_REQUEST (%u)", ev->window);
|
wlr_log(WLR_DEBUG, "XCB_MAP_REQUEST (%u)", ev->window);
|
||||||
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
if (!xsurface) {
|
if (!xsurface) {
|
||||||
return;
|
return;
|
||||||
|
@ -804,12 +804,12 @@ static void xwm_handle_map_request(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
static void xwm_handle_map_notify(struct wlr_xwm *xwm,
|
static void xwm_handle_map_notify(struct wlr_xwm *xwm,
|
||||||
xcb_map_notify_event_t *ev) {
|
xcb_map_notify_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_MAP_NOTIFY (%u)", ev->window);
|
wlr_log(WLR_DEBUG, "XCB_MAP_NOTIFY (%u)", ev->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwm_handle_unmap_notify(struct wlr_xwm *xwm,
|
static void xwm_handle_unmap_notify(struct wlr_xwm *xwm,
|
||||||
xcb_unmap_notify_event_t *ev) {
|
xcb_unmap_notify_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_UNMAP_NOTIFY (%u)", ev->window);
|
wlr_log(WLR_DEBUG, "XCB_UNMAP_NOTIFY (%u)", ev->window);
|
||||||
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
if (xsurface == NULL) {
|
if (xsurface == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -821,7 +821,7 @@ static void xwm_handle_unmap_notify(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
static void xwm_handle_property_notify(struct wlr_xwm *xwm,
|
static void xwm_handle_property_notify(struct wlr_xwm *xwm,
|
||||||
xcb_property_notify_event_t *ev) {
|
xcb_property_notify_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_PROPERTY_NOTIFY (%u)", ev->window);
|
wlr_log(WLR_DEBUG, "XCB_PROPERTY_NOTIFY (%u)", ev->window);
|
||||||
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
if (xsurface == NULL) {
|
if (xsurface == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -834,7 +834,7 @@ static void xwm_handle_surface_id_message(struct wlr_xwm *xwm,
|
||||||
xcb_client_message_event_t *ev) {
|
xcb_client_message_event_t *ev) {
|
||||||
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
if (xsurface == NULL) {
|
if (xsurface == NULL) {
|
||||||
wlr_log(L_DEBUG,
|
wlr_log(WLR_DEBUG,
|
||||||
"client message WL_SURFACE_ID but no new window %u ?",
|
"client message WL_SURFACE_ID but no new window %u ?",
|
||||||
ev->window);
|
ev->window);
|
||||||
return;
|
return;
|
||||||
|
@ -1040,7 +1040,7 @@ static void xwm_handle_wm_protocols_message(struct wlr_xwm *xwm,
|
||||||
surface->pinging = false;
|
surface->pinging = false;
|
||||||
} else {
|
} else {
|
||||||
char *type_name = xwm_get_atom_name(xwm, type);
|
char *type_name = xwm_get_atom_name(xwm, type);
|
||||||
wlr_log(L_DEBUG, "unhandled WM_PROTOCOLS client message %u (%s)",
|
wlr_log(WLR_DEBUG, "unhandled WM_PROTOCOLS client message %u (%s)",
|
||||||
type, type_name);
|
type, type_name);
|
||||||
free(type_name);
|
free(type_name);
|
||||||
}
|
}
|
||||||
|
@ -1048,7 +1048,7 @@ static void xwm_handle_wm_protocols_message(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
static void xwm_handle_client_message(struct wlr_xwm *xwm,
|
static void xwm_handle_client_message(struct wlr_xwm *xwm,
|
||||||
xcb_client_message_event_t *ev) {
|
xcb_client_message_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_CLIENT_MESSAGE (%u)", ev->window);
|
wlr_log(WLR_DEBUG, "XCB_CLIENT_MESSAGE (%u)", ev->window);
|
||||||
|
|
||||||
if (ev->type == xwm->atoms[WL_SURFACE_ID]) {
|
if (ev->type == xwm->atoms[WL_SURFACE_ID]) {
|
||||||
xwm_handle_surface_id_message(xwm, ev);
|
xwm_handle_surface_id_message(xwm, ev);
|
||||||
|
@ -1060,7 +1060,7 @@ static void xwm_handle_client_message(struct wlr_xwm *xwm,
|
||||||
xwm_handle_wm_protocols_message(xwm, ev);
|
xwm_handle_wm_protocols_message(xwm, ev);
|
||||||
} else if (!xwm_handle_selection_client_message(xwm, ev)) {
|
} else if (!xwm_handle_selection_client_message(xwm, ev)) {
|
||||||
char *type_name = xwm_get_atom_name(xwm, ev->type);
|
char *type_name = xwm_get_atom_name(xwm, ev->type);
|
||||||
wlr_log(L_DEBUG, "unhandled x11 client message %u (%s)", ev->type,
|
wlr_log(WLR_DEBUG, "unhandled x11 client message %u (%s)", ev->type,
|
||||||
type_name);
|
type_name);
|
||||||
free(type_name);
|
free(type_name);
|
||||||
}
|
}
|
||||||
|
@ -1087,7 +1087,7 @@ static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) {
|
||||||
xcb_errors_get_name_for_major_code(xwm->errors_context,
|
xcb_errors_get_name_for_major_code(xwm->errors_context,
|
||||||
ev->major_opcode);
|
ev->major_opcode);
|
||||||
if (!major_name) {
|
if (!major_name) {
|
||||||
wlr_log(L_DEBUG, "xcb error happened, but could not get major name");
|
wlr_log(WLR_DEBUG, "xcb error happened, but could not get major name");
|
||||||
goto log_raw;
|
goto log_raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,11 +1100,11 @@ static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) {
|
||||||
xcb_errors_get_name_for_error(xwm->errors_context,
|
xcb_errors_get_name_for_error(xwm->errors_context,
|
||||||
ev->error_code, &extension);
|
ev->error_code, &extension);
|
||||||
if (!error_name) {
|
if (!error_name) {
|
||||||
wlr_log(L_DEBUG, "xcb error happened, but could not get error name");
|
wlr_log(WLR_DEBUG, "xcb error happened, but could not get error name");
|
||||||
goto log_raw;
|
goto log_raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_ERROR, "xcb error: op %s (%s), code %s (%s), sequence %"PRIu16", value %"PRIu32,
|
wlr_log(WLR_ERROR, "xcb error: op %s (%s), code %s (%s), sequence %"PRIu16", value %"PRIu32,
|
||||||
major_name, minor_name ? minor_name : "no minor",
|
major_name, minor_name ? minor_name : "no minor",
|
||||||
error_name, extension ? extension : "no extension",
|
error_name, extension ? extension : "no extension",
|
||||||
ev->sequence, ev->bad_value);
|
ev->sequence, ev->bad_value);
|
||||||
|
@ -1112,7 +1112,7 @@ static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) {
|
||||||
return;
|
return;
|
||||||
log_raw:
|
log_raw:
|
||||||
#endif
|
#endif
|
||||||
wlr_log(L_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"xcb error: op %"PRIu8":%"PRIu16", code %"PRIu8", sequence %"PRIu16", value %"PRIu32,
|
"xcb error: op %"PRIu8":%"PRIu16", code %"PRIu8", sequence %"PRIu16", value %"PRIu32,
|
||||||
ev->major_opcode, ev->minor_opcode, ev->error_code,
|
ev->major_opcode, ev->minor_opcode, ev->error_code,
|
||||||
ev->sequence, ev->bad_value);
|
ev->sequence, ev->bad_value);
|
||||||
|
@ -1126,14 +1126,14 @@ static void xwm_handle_unhandled_event(struct wlr_xwm *xwm, xcb_generic_event_t
|
||||||
xcb_errors_get_name_for_xcb_event(xwm->errors_context,
|
xcb_errors_get_name_for_xcb_event(xwm->errors_context,
|
||||||
ev, &extension);
|
ev, &extension);
|
||||||
if (!event_name) {
|
if (!event_name) {
|
||||||
wlr_log(L_DEBUG, "no name for unhandled event: %u",
|
wlr_log(WLR_DEBUG, "no name for unhandled event: %u",
|
||||||
ev->response_type);
|
ev->response_type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "unhandled X11 event: %s (%u)", event_name, ev->response_type);
|
wlr_log(WLR_DEBUG, "unhandled X11 event: %s (%u)", event_name, ev->response_type);
|
||||||
#else
|
#else
|
||||||
wlr_log(L_DEBUG, "unhandled X11 event: %u", ev->response_type);
|
wlr_log(WLR_DEBUG, "unhandled X11 event: %u", ev->response_type);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ static void handle_compositor_new_surface(struct wl_listener *listener,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "New xwayland surface: %p", surface);
|
wlr_log(WLR_DEBUG, "New xwayland surface: %p", surface);
|
||||||
|
|
||||||
uint32_t surface_id = wl_resource_get_id(surface->resource);
|
uint32_t surface_id = wl_resource_get_id(surface->resource);
|
||||||
struct wlr_xwayland_surface *xsurface;
|
struct wlr_xwayland_surface *xsurface;
|
||||||
|
@ -1345,7 +1345,7 @@ static void xwm_get_resources(struct wlr_xwm *xwm) {
|
||||||
free(reply);
|
free(reply);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
wlr_log(L_ERROR, "could not resolve atom %s, x11 error code %d",
|
wlr_log(WLR_ERROR, "could not resolve atom %s, x11 error code %d",
|
||||||
atom_map[i], error->error_code);
|
atom_map[i], error->error_code);
|
||||||
free(error);
|
free(error);
|
||||||
return;
|
return;
|
||||||
|
@ -1355,7 +1355,7 @@ static void xwm_get_resources(struct wlr_xwm *xwm) {
|
||||||
xwm->xfixes = xcb_get_extension_data(xwm->xcb_conn, &xcb_xfixes_id);
|
xwm->xfixes = xcb_get_extension_data(xwm->xcb_conn, &xcb_xfixes_id);
|
||||||
|
|
||||||
if (!xwm->xfixes || !xwm->xfixes->present) {
|
if (!xwm->xfixes || !xwm->xfixes->present) {
|
||||||
wlr_log(L_DEBUG, "xfixes not available");
|
wlr_log(WLR_DEBUG, "xfixes not available");
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_xfixes_query_version_cookie_t xfixes_cookie;
|
xcb_xfixes_query_version_cookie_t xfixes_cookie;
|
||||||
|
@ -1366,7 +1366,7 @@ static void xwm_get_resources(struct wlr_xwm *xwm) {
|
||||||
xfixes_reply =
|
xfixes_reply =
|
||||||
xcb_xfixes_query_version_reply(xwm->xcb_conn, xfixes_cookie, NULL);
|
xcb_xfixes_query_version_reply(xwm->xcb_conn, xfixes_cookie, NULL);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "xfixes version: %d.%d",
|
wlr_log(WLR_DEBUG, "xfixes version: %d.%d",
|
||||||
xfixes_reply->major_version, xfixes_reply->minor_version);
|
xfixes_reply->major_version, xfixes_reply->minor_version);
|
||||||
|
|
||||||
free(xfixes_reply);
|
free(xfixes_reply);
|
||||||
|
@ -1442,7 +1442,7 @@ static void xwm_get_visual_and_colormap(struct wlr_xwm *xwm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visualtype == NULL) {
|
if (visualtype == NULL) {
|
||||||
wlr_log(L_DEBUG, "No 32 bit visualtype\n");
|
wlr_log(WLR_DEBUG, "No 32 bit visualtype\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1461,7 +1461,7 @@ static void xwm_get_render_format(struct wlr_xwm *xwm) {
|
||||||
xcb_render_query_pict_formats_reply_t *reply =
|
xcb_render_query_pict_formats_reply_t *reply =
|
||||||
xcb_render_query_pict_formats_reply(xwm->xcb_conn, cookie, NULL);
|
xcb_render_query_pict_formats_reply(xwm->xcb_conn, cookie, NULL);
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
wlr_log(L_ERROR, "Did not get any reply from xcb_render_query_pict_formats");
|
wlr_log(WLR_ERROR, "Did not get any reply from xcb_render_query_pict_formats");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xcb_render_pictforminfo_iterator_t iter =
|
xcb_render_pictforminfo_iterator_t iter =
|
||||||
|
@ -1477,7 +1477,7 @@ static void xwm_get_render_format(struct wlr_xwm *xwm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == NULL) {
|
if (format == NULL) {
|
||||||
wlr_log(L_DEBUG, "No 32 bit render format");
|
wlr_log(WLR_DEBUG, "No 32 bit render format");
|
||||||
free(reply);
|
free(reply);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1489,7 +1489,7 @@ static void xwm_get_render_format(struct wlr_xwm *xwm) {
|
||||||
void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
|
void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
|
||||||
uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y) {
|
uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y) {
|
||||||
if (!xwm->render_format_id) {
|
if (!xwm->render_format_id) {
|
||||||
wlr_log(L_ERROR, "Cannot set xwm cursor: no render format available");
|
wlr_log(WLR_ERROR, "Cannot set xwm cursor: no render format available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (xwm->cursor) {
|
if (xwm->cursor) {
|
||||||
|
@ -1540,7 +1540,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
|
||||||
|
|
||||||
int rc = xcb_connection_has_error(xwm->xcb_conn);
|
int rc = xcb_connection_has_error(xwm->xcb_conn);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
wlr_log(L_ERROR, "xcb connect failed: %d", rc);
|
wlr_log(WLR_ERROR, "xcb connect failed: %d", rc);
|
||||||
close(wlr_xwayland->wm_fd[0]);
|
close(wlr_xwayland->wm_fd[0]);
|
||||||
free(xwm);
|
free(xwm);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1548,7 +1548,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
|
||||||
|
|
||||||
#ifdef WLR_HAS_XCB_ERRORS
|
#ifdef WLR_HAS_XCB_ERRORS
|
||||||
if (xcb_errors_context_new(xwm->xcb_conn, &xwm->errors_context)) {
|
if (xcb_errors_context_new(xwm->xcb_conn, &xwm->errors_context)) {
|
||||||
wlr_log(L_ERROR, "Could not allocate error context");
|
wlr_log(WLR_ERROR, "Could not allocate error context");
|
||||||
xwm_destroy(xwm);
|
xwm_destroy(xwm);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue