Got it working.
This commit is contained in:
parent
058b8bdf27
commit
ce8786721b
|
@ -47,12 +47,13 @@ static void device_paused(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void device_resumed(struct wl_listener *listener, void *data) {
|
static void device_resumed(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_backend_state *drm = wl_container_of(listener, drm, device_paused);
|
struct wlr_backend_state *drm = wl_container_of(listener, drm, device_resumed);
|
||||||
int *new_fd = data;
|
int *new_fd = data;
|
||||||
|
|
||||||
close(drm->fd);
|
if (dup2(*new_fd, drm->fd) < 0) {
|
||||||
drm->fd = *new_fd;
|
wlr_log(L_ERROR, "dup2 failed: %s", strerror(errno));
|
||||||
drm->renderer.fd = *new_fd;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < drm->outputs->length; ++i) {
|
for (size_t i = 0; i < drm->outputs->length; ++i) {
|
||||||
struct wlr_output_state *output = drm->outputs->items[i];
|
struct wlr_output_state *output = drm->outputs->items[i];
|
||||||
|
|
|
@ -226,15 +226,6 @@ static int resume_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original fd seem to be closed when the message is freed
|
|
||||||
// so we just clone it.
|
|
||||||
fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
|
||||||
if (fd == -1) {
|
|
||||||
wlr_log(L_ERROR, "Failed to clone file descriptor for ResumeDevice: %s",
|
|
||||||
strerror(errno));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Use major/minor to make sure the right devices are getting signals
|
// TODO: Use major/minor to make sure the right devices are getting signals
|
||||||
|
|
||||||
wl_signal_emit(&session->base.device_resumed, &fd);
|
wl_signal_emit(&session->base.device_resumed, &fd);
|
||||||
|
|
Loading…
Reference in New Issue