From 2b6edbccbc001ec962039ed939febe2bf925dc4b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 Mar 2024 11:47:48 +0530 Subject: [PATCH] Start work on fractional scale support for Wayland Register the interface on startup --- glfw/source-info.json | 3 ++- glfw/wl_init.c | 5 +++++ glfw/wl_platform.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/glfw/source-info.json b/glfw/source-info.json index cd5e88548..90f4d393a 100644 --- a/glfw/source-info.json +++ b/glfw/source-info.json @@ -79,7 +79,8 @@ "unstable/text-input/text-input-unstable-v3.xml", "staging/xdg-activation/xdg-activation-v1.xml", "unstable/tablet/tablet-unstable-v2.xml", - "staging/cursor-shape/cursor-shape-v1.xml" + "staging/cursor-shape/cursor-shape-v1.xml", + "staging/fractional-scale/fractional-scale-v1.xml" ], "sources": [ "wl_init.c", diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 69d77c54f..9e21d5a71 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -726,6 +726,9 @@ static void registryHandleGlobal(void* data UNUSED, else if (is(wp_cursor_shape_manager_v1)) { _glfw.wl.wp_cursor_shape_manager_v1 = wl_registry_bind(registry, name, &wp_cursor_shape_manager_v1_interface, 1); } + else if (is(wp_fractional_scale_manager_v1)) { + _glfw.wl.wp_fractional_scale_manager_v1 = wl_registry_bind(registry, name, &wp_fractional_scale_manager_v1_interface, 1); + } #undef is } @@ -962,6 +965,8 @@ void _glfwPlatformTerminate(void) xdg_activation_v1_destroy(_glfw.wl.xdg_activation_v1); if (_glfw.wl.wp_cursor_shape_manager_v1) wp_cursor_shape_manager_v1_destroy(_glfw.wl.wp_cursor_shape_manager_v1); + if (_glfw.wl.wp_fractional_scale_manager_v1) + wp_fractional_scale_manager_v1_destroy(_glfw.wl.wp_fractional_scale_manager_v1); if (_glfw.wl.registry) wl_registry_destroy(_glfw.wl.registry); diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 2dfa9eb72..a5bafe2e8 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -60,6 +60,7 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR #include "wayland-primary-selection-unstable-v1-client-protocol.h" #include "wayland-xdg-activation-v1-client-protocol.h" #include "wayland-cursor-shape-v1-client-protocol.h" +#include "wayland-fractional-scale-v1-client-protocol.h" #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define _glfw_dlclose(handle) dlclose(handle) @@ -288,6 +289,7 @@ typedef struct _GLFWlibraryWayland struct xdg_activation_v1* xdg_activation_v1; struct wp_cursor_shape_manager_v1* wp_cursor_shape_manager_v1; struct wp_cursor_shape_device_v1* wp_cursor_shape_device_v1; + struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1; int compositorVersion; int seatVersion;