Debug output: Show name and version of Wayland compositor

This commit is contained in:
Kovid Goyal
2024-03-26 09:54:38 +05:30
parent 006a047276
commit 83fcd472bb
7 changed files with 53 additions and 2 deletions

View File

@@ -315,6 +315,7 @@ def generate_wrappers(glfw_header: str) -> None:
bool glfwWaylandSetTitlebarColor(GLFWwindow *handle, uint32_t color, bool use_system_color)
void glfwWaylandRedrawCSDWindowTitle(GLFWwindow *handle)
void glfwWaylandSetupLayerShellForNextWindow(GLFWLayerShellConfig c)
pid_t glfwWaylandCompositorPID(void)
unsigned long long glfwDBusUserNotify(const char *app_name, const char* icon, const char *summary, const char *body, \
const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callback, void *data)
void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler)

14
glfw/wl_init.c vendored
View File

@@ -41,6 +41,7 @@
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <wayland-client.h>
// Needed for the BTN_* defines
#ifdef __has_include
@@ -815,6 +816,19 @@ GLFWAPI int glfwGetCurrentSystemColorTheme(void) {
return glfw_current_system_color_theme();
}
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;
struct ucred ucred;
socklen_t len = sizeof(struct ucred);
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1) {
perror("getsockopt failed");
return -1;
}
return ucred.pid;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////