Set an drop drm master on enter and leave vt

This way we can vt switch between wayland and X.
dev
Kristian Høgsberg 15 years ago
parent beed22b9a3
commit d2311cfba7
  1. 16
      wayland-system-compositor.c

@ -1355,10 +1355,16 @@ static void on_enter_vt(int signal_number, void *data)
struct wlsc_output *output; struct wlsc_output *output;
int ret, fd; int ret, fd;
fd = eglGetDisplayFD(ec->display);
ret = drmSetMaster(fd);
if (ret) {
fprintf(stderr, "failed to set drm master\n");
return;
}
ioctl(ec->tty_fd, VT_RELDISP, VT_ACKACQ); ioctl(ec->tty_fd, VT_RELDISP, VT_ACKACQ);
ec->vt_active = TRUE; ec->vt_active = TRUE;
fd = eglGetDisplayFD(ec->display);
output = container_of(ec->output_list.next, struct wlsc_output, link); output = container_of(ec->output_list.next, struct wlsc_output, link);
while (&output->link != &ec->output_list) { while (&output->link != &ec->output_list) {
ret = drmModeSetCrtc(fd, output->crtc_id, ret = drmModeSetCrtc(fd, output->crtc_id,
@ -1376,6 +1382,14 @@ static void on_enter_vt(int signal_number, void *data)
static void on_leave_vt(int signal_number, void *data) static void on_leave_vt(int signal_number, void *data)
{ {
struct wlsc_compositor *ec = data; struct wlsc_compositor *ec = data;
int ret, fd;
fd = eglGetDisplayFD(ec->display);
ret = drmDropMaster(fd);
if (ret) {
fprintf(stderr, "failed to drop drm master\n");
return;
}
ioctl (ec->tty_fd, VT_RELDISP, 1); ioctl (ec->tty_fd, VT_RELDISP, 1);
ec->vt_active = FALSE; ec->vt_active = FALSE;

Loading…
Cancel
Save