mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 03:52:01 +00:00
Wayland: Add support for wl_output::name
We now use wl_output::name as the GLFW monitor name, on compositors that
provide this event.
(cherry picked from commit 209f6cf093
)
This commit is contained in:
parent
2529e663d7
commit
50ea41cb04
@ -139,6 +139,7 @@ information on what to include when reporting a bug.
|
|||||||
- [X11] Bugfix: A malformed response during selection transfer could cause a segfault
|
- [X11] Bugfix: A malformed response during selection transfer could cause a segfault
|
||||||
- [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
|
- [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
|
||||||
- [Wayland] Added support for file path drop events (#2040)
|
- [Wayland] Added support for file path drop events (#2040)
|
||||||
|
- [Wayland] Added support for more human-readable monitor names where available
|
||||||
- [Wayland] Removed support for the deprecated wl\_shell protocol
|
- [Wayland] Removed support for the deprecated wl\_shell protocol
|
||||||
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
|
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
|
||||||
`glfwGetClipboardString`
|
`glfwGetClipboardString`
|
||||||
|
@ -53,7 +53,8 @@ static void outputHandleGeometry(void* userData,
|
|||||||
monitor->widthMM = physicalWidth;
|
monitor->widthMM = physicalWidth;
|
||||||
monitor->heightMM = physicalHeight;
|
monitor->heightMM = physicalHeight;
|
||||||
|
|
||||||
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
if (strlen(monitor->name) == 0)
|
||||||
|
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void outputHandleMode(void* userData,
|
static void outputHandleMode(void* userData,
|
||||||
@ -106,12 +107,33 @@ static void outputHandleScale(void* userData,
|
|||||||
monitor->wl.scale = factor;
|
monitor->wl.scale = factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||||
|
|
||||||
|
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
|
||||||
|
{
|
||||||
|
struct _GLFWmonitor* monitor = userData;
|
||||||
|
|
||||||
|
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void outputHandleDescription(void* userData,
|
||||||
|
struct wl_output* wl_output,
|
||||||
|
const char* description)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // WL_OUTPUT_NAME_SINCE_VERSION
|
||||||
|
|
||||||
static const struct wl_output_listener outputListener =
|
static const struct wl_output_listener outputListener =
|
||||||
{
|
{
|
||||||
outputHandleGeometry,
|
outputHandleGeometry,
|
||||||
outputHandleMode,
|
outputHandleMode,
|
||||||
outputHandleDone,
|
outputHandleDone,
|
||||||
outputHandleScale,
|
outputHandleScale,
|
||||||
|
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||||
|
outputHandleName,
|
||||||
|
outputHandleDescription,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -128,10 +150,16 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||||
|
version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
|
||||||
|
#else
|
||||||
|
version = 2;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
|
struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
|
||||||
name,
|
name,
|
||||||
&wl_output_interface,
|
&wl_output_interface,
|
||||||
2);
|
version);
|
||||||
if (!output)
|
if (!output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user