From 25e3b21eae91a474b3801594b2674263d9fbd556 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 27 Oct 2023 15:09:52 -0700 Subject: [PATCH] apprt/gtk: comment about future API --- src/apprt/gtk/Surface.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 64151ff89..054c736e5 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -350,6 +350,8 @@ pub fn shouldClose(self: *const Surface) bool { } pub fn getContentScale(self: *const Surface) !apprt.ContentScale { + // Future: detect GTK version 4.12+ and use gdk_surface_get_scale so we + // can support fractional scaling. const scale = c.gtk_widget_get_scale_factor(@ptrCast(self.gl_area)); return .{ .x = @floatFromInt(scale), .y = @floatFromInt(scale) }; } @@ -619,6 +621,8 @@ fn gtkResize(area: *c.GtkGLArea, width: c.gint, height: c.gint, ud: ?*anyopaque) .height = @intCast(height), }; + // We also update the content scale because there is no signal for + // content scale change and it seems to trigger a resize event. if (self.getContentScale()) |scale| { self.core_surface.contentScaleCallback(scale) catch |err| { log.err("error in content scale callback err={}", .{err});