Merge pull request #444 from myfreeweb/master
Xwayland signal confusion fix & non-Linux socket path fix
This commit is contained in:
commit
b083b1708b
|
@ -148,8 +148,8 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
|
|
||||||
struct vt_mode mode = {
|
struct vt_mode mode = {
|
||||||
.mode = VT_PROCESS,
|
.mode = VT_PROCESS,
|
||||||
.relsig = SIGUSR1,
|
.relsig = SIGUSR2,
|
||||||
.acqsig = SIGUSR1,
|
.acqsig = SIGUSR2,
|
||||||
.frsig = SIGIO, // has to be set
|
.frsig = SIGIO, // has to be set
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
||||||
session->vt_source = wl_event_loop_add_signal(loop, SIGUSR1,
|
session->vt_source = wl_event_loop_add_signal(loop, SIGUSR2,
|
||||||
vt_handler, session);
|
vt_handler, session);
|
||||||
if (!session->vt_source) {
|
if (!session->vt_source) {
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -184,8 +184,8 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
|
|
||||||
struct vt_mode mode = {
|
struct vt_mode mode = {
|
||||||
.mode = VT_PROCESS,
|
.mode = VT_PROCESS,
|
||||||
.relsig = SIGUSR1,
|
.relsig = SIGUSR2,
|
||||||
.acqsig = SIGUSR1,
|
.acqsig = SIGUSR2,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ioctl(fd, VT_SETMODE, &mode) < 0) {
|
if (ioctl(fd, VT_SETMODE, &mode) < 0) {
|
||||||
|
@ -194,7 +194,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
||||||
session->vt_source = wl_event_loop_add_signal(loop, SIGUSR1,
|
session->vt_source = wl_event_loop_add_signal(loop, SIGUSR2,
|
||||||
vt_handler, session);
|
vt_handler, session);
|
||||||
if (!session->vt_source) {
|
if (!session->vt_source) {
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
static const char *lock_fmt = "/tmp/.X%d-lock";
|
static const char *lock_fmt = "/tmp/.X%d-lock";
|
||||||
static const char *socket_dir = "/tmp/.X11-unix";
|
static const char *socket_dir = "/tmp/.X11-unix";
|
||||||
static const char *socket_fmt = "/tmp/.X11-unix/X%d";
|
static const char *socket_fmt = "/tmp/.X11-unix/X%d";
|
||||||
|
#ifndef __linux__
|
||||||
|
static const char *socket_fmt2 = "/tmp/.X11-unix/X%d_";
|
||||||
|
#endif
|
||||||
|
|
||||||
static int open_socket(struct sockaddr_un *addr, size_t path_size) {
|
static int open_socket(struct sockaddr_un *addr, size_t path_size) {
|
||||||
int fd, rc;
|
int fd, rc;
|
||||||
|
@ -73,7 +76,7 @@ static bool open_sockets(int socks[2], int display) {
|
||||||
addr.sun_path[0] = 0;
|
addr.sun_path[0] = 0;
|
||||||
path_size = snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1, socket_fmt, display);
|
path_size = snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1, socket_fmt, display);
|
||||||
#else
|
#else
|
||||||
path_size = snprintf(addr.sun_path, sizeof(addr.sun_path), socket_fmt, display);
|
path_size = snprintf(addr.sun_path, sizeof(addr.sun_path), socket_fmt2, display);
|
||||||
#endif
|
#endif
|
||||||
socks[0] = open_socket(&addr, path_size);
|
socks[0] = open_socket(&addr, path_size);
|
||||||
if (socks[0] < 0) {
|
if (socks[0] < 0) {
|
||||||
|
@ -97,6 +100,11 @@ void unlink_display_sockets(int display) {
|
||||||
snprintf(sun_path, sizeof(sun_path), socket_fmt, display);
|
snprintf(sun_path, sizeof(sun_path), socket_fmt, display);
|
||||||
unlink(sun_path);
|
unlink(sun_path);
|
||||||
|
|
||||||
|
#ifndef __linux__
|
||||||
|
snprintf(sun_path, sizeof(sun_path), socket_fmt2, display);
|
||||||
|
unlink(sun_path);
|
||||||
|
#endif
|
||||||
|
|
||||||
snprintf(sun_path, sizeof(sun_path), lock_fmt, display);
|
snprintf(sun_path, sizeof(sun_path), lock_fmt, display);
|
||||||
unlink(sun_path);
|
unlink(sun_path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue