mirror of
https://github.com/glfw/glfw.git
synced 2025-06-14 19:52:14 +00:00
Add ability to set wayland app_id through a window hint
This commit is contained in:
parent
62e175ef9f
commit
7ac7e9bab9
@ -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
|
||||
/*! @} */
|
||||
|
||||
|
@ -421,6 +421,9 @@ struct _GLFWwndconfig
|
||||
struct {
|
||||
GLFWbool keymenu;
|
||||
} win32;
|
||||
struct {
|
||||
char appId[256];
|
||||
} wl;
|
||||
};
|
||||
|
||||
// Context configuration
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user