1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

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.
This commit is contained in:
Jonas Ådahl 2015-12-27 10:42:45 +08:00
parent 06479ba535
commit cf6c11cfaa
3 changed files with 9 additions and 1 deletions

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{