mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
Fix #7346
This commit is contained in:
18
glfw/wl_init.c
vendored
18
glfw/wl_init.c
vendored
@@ -633,10 +633,9 @@ GLFWAPI GLFWColorScheme glfwGetCurrentSystemColorTheme(void) {
|
|||||||
return glfw_current_system_color_theme();
|
return glfw_current_system_color_theme();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI pid_t glfwWaylandCompositorPID(void) {
|
#ifdef __linux__
|
||||||
if (!_glfw.wl.display) return -1;
|
static pid_t
|
||||||
int fd = wl_display_get_fd(_glfw.wl.display);
|
get_socket_peer_pid(int fd) {
|
||||||
if (fd < 0) return -1;
|
|
||||||
struct ucred ucred;
|
struct ucred ucred;
|
||||||
socklen_t len = sizeof(struct ucred);
|
socklen_t len = sizeof(struct ucred);
|
||||||
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1) {
|
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1) {
|
||||||
@@ -645,6 +644,17 @@ GLFWAPI pid_t glfwWaylandCompositorPID(void) {
|
|||||||
}
|
}
|
||||||
return ucred.pid;
|
return ucred.pid;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static pid_t
|
||||||
|
get_socket_peer_pid(int fd) { return -1; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GLFWAPI pid_t glfwWaylandCompositorPID(void) {
|
||||||
|
if (!_glfw.wl.display) return -1;
|
||||||
|
int fd = wl_display_get_fd(_glfw.wl.display);
|
||||||
|
if (fd < 0) return -1;
|
||||||
|
return get_socket_peer_pid(fd);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
|
|||||||
Reference in New Issue
Block a user