|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <dev/evdev/input.h>
|
|
|
|
#include <dev/evdev/input.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <fcntl.h>
|
|
|
@ -32,8 +33,14 @@ struct direct_session {
|
|
|
|
struct wl_event_source *vt_source;
|
|
|
|
struct wl_event_source *vt_source;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct direct_session *direct_session_from_session(
|
|
|
|
|
|
|
|
struct wlr_session *base) {
|
|
|
|
|
|
|
|
assert(base->impl == &session_direct);
|
|
|
|
|
|
|
|
return (struct direct_session *)base;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int direct_session_open(struct wlr_session *base, const char *path) {
|
|
|
|
static int direct_session_open(struct wlr_session *base, const char *path) {
|
|
|
|
struct direct_session *session = wl_container_of(base, session, base);
|
|
|
|
struct direct_session *session = direct_session_from_session(base);
|
|
|
|
|
|
|
|
|
|
|
|
int fd = direct_ipc_open(session->sock, path);
|
|
|
|
int fd = direct_ipc_open(session->sock, path);
|
|
|
|
if (fd < 0) {
|
|
|
|
if (fd < 0) {
|
|
|
@ -46,7 +53,7 @@ static int direct_session_open(struct wlr_session *base, const char *path) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void direct_session_close(struct wlr_session *base, int fd) {
|
|
|
|
static void direct_session_close(struct wlr_session *base, int fd) {
|
|
|
|
struct direct_session *session = wl_container_of(base, session, base);
|
|
|
|
struct direct_session *session = direct_session_from_session(base);
|
|
|
|
|
|
|
|
|
|
|
|
int ev;
|
|
|
|
int ev;
|
|
|
|
struct drm_version dv = {0};
|
|
|
|
struct drm_version dv = {0};
|
|
|
@ -60,12 +67,12 @@ static void direct_session_close(struct wlr_session *base, int fd) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool direct_change_vt(struct wlr_session *base, unsigned vt) {
|
|
|
|
static bool direct_change_vt(struct wlr_session *base, unsigned vt) {
|
|
|
|
struct direct_session *session = wl_container_of(base, session, base);
|
|
|
|
struct direct_session *session = direct_session_from_session(base);
|
|
|
|
return ioctl(session->tty_fd, VT_ACTIVATE, (int)vt) == 0;
|
|
|
|
return ioctl(session->tty_fd, VT_ACTIVATE, (int)vt) == 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void direct_session_destroy(struct wlr_session *base) {
|
|
|
|
static void direct_session_destroy(struct wlr_session *base) {
|
|
|
|
struct direct_session *session = wl_container_of(base, session, base);
|
|
|
|
struct direct_session *session = direct_session_from_session(base);
|
|
|
|
struct vt_mode mode = {
|
|
|
|
struct vt_mode mode = {
|
|
|
|
.mode = VT_AUTO,
|
|
|
|
.mode = VT_AUTO,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -157,7 +164,8 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ioctl(fd, KDSKBMODE, K_CODE)) {
|
|
|
|
if (ioctl(fd, KDSKBMODE, K_CODE)) {
|
|
|
|
wlr_log_errno(WLR_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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|