diff --git a/src/wl_init.c b/src/wl_init.c index cceef16b..90dc507b 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -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)); + _glfw.wl.wl_compositor_version); } else if (strcmp(interface, "wl_shm") == 0) { diff --git a/src/wl_platform.h b/src/wl_platform.h index a734ec1e..2bfdbb4c 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -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; diff --git a/src/wl_window.c b/src/wl_window.c index 00ce7135..3a75daa4 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -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 < + WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION) + return; + // Get the scale factor from the highest scale monitor. for (i = 0; i < window->wl.monitorsCount; ++i) {