Add glfwGetWindowTitle

This adds a function for querying the current title of a window.  This
currently returns a copy of the last title set via GLFW.

Fixes #1448
Closes #1909
Closes #2482
This commit is contained in:
Doug Binks
2024-02-07 19:26:52 +00:00
committed by Camilla Löwy
parent bafece4cf7
commit 95d464bb4b
8 changed files with 81 additions and 2 deletions

View File

@@ -41,6 +41,12 @@ to whatever window is behind it. This can also be changed after window
creation with the matching [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
#### Ability to get a window's title {#features_34_get_window_title}
GLFW now supports retrieving a window's title with the @ref glfwGetWindowTitle
function.
#### Wayland libdecor decorations {#wayland_libdecor_34}
GLFW now supports improved fallback window decorations via
@@ -253,6 +259,7 @@ then GLFW will fail to initialize.
- @ref glfwGetPlatform
- @ref glfwPlatformSupported
- @ref glfwInitVulkanLoader
- @ref glfwGetWindowTitle
#### New types in version 3.4 {#types_34}

View File

@@ -919,6 +919,15 @@ If you are using C++11 or C11, you can use a UTF-8 string literal.
glfwSetWindowTitle(window, u8"This is always a UTF-8 string");
```
The window title can be retrieved with @ref glfwGetWindowTitle.
```c
const char* title = glfwGetWindowTitle(window);
```
The title returned is an internally managed copy of the title set
by @ref glfwCreateWindow or @ref glfwSetWindowTitle. It does not
include any additional text which may be appended by the platform.
### Window icon {#window_icon}