Commit cf6c11cf authored by Jonas Ådahl's avatar Jonas Ådahl
Browse files

wayland: Only set surface buffer scale when supported

Although very unlikely, the wl_compositor version might not support
wl_surface.set_buffer_scale while the wl_output emits a wl_output.scale
that is larger than 1. So for correctness, bail on changing the buffer
scale if we won't be able to set it later.
parent 06479ba5
......@@ -385,9 +385,10 @@ static void registryHandleGlobal(void* data,
if (strcmp(interface, "wl_compositor") == 0)
_glfw.wl.wl_compositor_version = min(3, version);
_glfw.wl.compositor =
wl_registry_bind(registry, name, &wl_compositor_interface,
min(3, version));
else if (strcmp(interface, "wl_shm") == 0)
......@@ -91,6 +91,8 @@ typedef struct _GLFWlibraryWayland
struct wl_pointer* pointer;
struct wl_keyboard* keyboard;
int wl_compositor_version;
struct wl_cursor_theme* cursorTheme;
struct wl_surface* cursorSurface;
uint32_t pointerSerial;
......@@ -79,6 +79,11 @@ static void checkScaleChange(_GLFWwindow* window)
int i;
int monitorScale;
// Check if we will be able to set the buffer scale or not.
if (_glfw.wl.wl_compositor_version <
// Get the scale factor from the highest scale monitor.
for (i = 0; i < window->wl.monitorsCount; ++i)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment