mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 08:39:45 +00:00
Wayland: Implement HiDPI support
Windows now keep track of the monitors they are on, so we can calculate the best scaling factor for them, by using the maximum of each of the monitors. The compositor scales down the buffer automatically when it is on a lower density monitor, instead of the previous way where it was scaling up the buffer on higher density monitors, which makes the application look much better on those ones.
This commit is contained in:
committed by
Jonas Ådahl
parent
ecd04539ec
commit
06479ba535
@@ -97,6 +97,9 @@ static void scale(void* data,
|
||||
struct wl_output* output,
|
||||
int32_t factor)
|
||||
{
|
||||
struct _GLFWmonitor *monitor = data;
|
||||
|
||||
monitor->wl.scale = factor;
|
||||
}
|
||||
|
||||
static const struct wl_output_listener output_listener = {
|
||||
@@ -142,6 +145,8 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
||||
monitor->wl.modes = calloc(4, sizeof(_GLFWvidmodeWayland));
|
||||
monitor->wl.modesSize = 4;
|
||||
|
||||
monitor->wl.scale = 1;
|
||||
|
||||
monitor->wl.output = output;
|
||||
wl_output_add_listener(output, &output_listener, monitor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user