From 1be7bc546b41efcab84210f15ddb7cdf25171cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 8 Feb 2024 19:36:27 +0100 Subject: [PATCH] Wayland: Clean up data types related to scales --- src/wl_monitor.c | 2 +- src/wl_platform.h | 10 +++++----- src/wl_window.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/wl_monitor.c b/src/wl_monitor.c index 56ea56d7..66639301 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -116,7 +116,7 @@ static void outputHandleScale(void* userData, for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next) { - for (int i = 0; i < window->wl.outputScaleCount; i++) + for (size_t i = 0; i < window->wl.outputScaleCount; i++) { if (window->wl.outputScales[i].output == monitor->wl.output) { diff --git a/src/wl_platform.h b/src/wl_platform.h index 23fd8c14..d54d394a 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -340,7 +340,7 @@ typedef struct _GLFWofferWayland typedef struct _GLFWscaleWayland { struct wl_output* output; - int factor; + int32_t factor; } _GLFWscaleWayland; // Wayland-specific per-window data @@ -389,10 +389,10 @@ typedef struct _GLFWwindowWayland // We need to track the monitors the window spans on to calculate the // optimal scaling factor. - int bufferScale; + int32_t bufferScale; _GLFWscaleWayland* outputScales; - int outputScaleCount; - int outputScaleSize; + size_t outputScaleCount; + size_t outputScaleSize; struct zwp_relative_pointer_v1* relativePointer; struct zwp_locked_pointer_v1* lockedPointer; @@ -586,7 +586,7 @@ typedef struct _GLFWmonitorWayland int x; int y; - int scale; + int32_t scale; } _GLFWmonitorWayland; // Wayland-specific per-cursor data diff --git a/src/wl_window.c b/src/wl_window.c index e5699ab3..71be06b7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -312,7 +312,7 @@ static void setContentAreaOpaque(_GLFWwindow* window) static void resizeFramebuffer(_GLFWwindow* window) { - int scale = window->wl.bufferScale; + int32_t scale = window->wl.bufferScale; int scaledWidth = window->wl.width * scale; int scaledHeight = window->wl.height * scale; @@ -366,9 +366,9 @@ void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window) } // Get the scale factor from the highest scale monitor. - int maxScale = 1; + int32_t maxScale = 1; - for (int i = 0; i < window->wl.outputScaleCount; i++) + for (size_t i = 0; i < window->wl.outputScaleCount; i++) maxScale = _glfw_max(window->wl.outputScales[i].factor, maxScale); // Only change the framebuffer size if the scale changed. @@ -420,7 +420,7 @@ static void surfaceHandleLeave(void* userData, _GLFWwindow* window = userData; - for (int i = 0; i < window->wl.outputScaleCount; i++) + for (size_t i = 0; i < window->wl.outputScaleCount; i++) { if (window->wl.outputScales[i].output == output) {