diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 52225c74..f1ce07f5 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -1104,6 +1104,11 @@ extern "C" { * [window hint](@ref GLFW_X11_CLASS_NAME_hint). */ #define GLFW_X11_INSTANCE_NAME 0x00024002 + +#define GLFW_WAYLAND_APP_ID 0x00026001 +/*! @brief Wayland specific + * [window hint](@ref GLDW_WAYLAND_CLASS_NAME_hint). + */ #define GLFW_WIN32_KEYBOARD_MENU 0x00025001 /*! @} */ diff --git a/src/internal.h b/src/internal.h index 7babe7e8..a830521b 100644 --- a/src/internal.h +++ b/src/internal.h @@ -421,6 +421,9 @@ struct _GLFWwndconfig struct { GLFWbool keymenu; } win32; + struct { + char appId[256]; + } wl; }; // Context configuration diff --git a/src/window.c b/src/window.c index 621e2e64..06205eaa 100644 --- a/src/window.c +++ b/src/window.c @@ -417,6 +417,10 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value) strncpy(_glfw.hints.window.x11.instanceName, value, sizeof(_glfw.hints.window.x11.instanceName) - 1); return; + case GLFW_WAYLAND_APP_ID: + strncpy(_glfw.hints.window.wl.appId, value, + sizeof(_glfw.hints.window.wl.appId) - 1); + return; } _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint); diff --git a/src/wl_platform.h b/src/wl_platform.h index d6c8c4da..0f87fe3c 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -249,6 +249,7 @@ typedef struct _GLFWwindowWayland double cursorPosX, cursorPosY; char* title; + char* appId; // We need to track the monitors the window spans on to calculate the // optimal scaling factor. diff --git a/src/wl_window.c b/src/wl_window.c index a1f93185..ff12c774 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -579,6 +579,9 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) &xdgToplevelListener, window); + if (strlen(window->wl.appId)) + xdg_toplevel_set_app_id(window->wl.xdg.toplevel, window->wl.appId); + if (window->wl.title) xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title); @@ -637,6 +640,8 @@ static GLFWbool createSurface(_GLFWwindow* window, window->wl.height = wndconfig->height; window->wl.scale = 1; window->wl.title = _glfw_strdup(wndconfig->title); + if (strlen(wndconfig->wl.appId)) + window->wl.appId = _glfw_strdup(wndconfig->wl.appId); window->wl.transparent = fbconfig->transparent; if (!window->wl.transparent)