mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
apprt/gtk: comment about future API
This commit is contained in:
@ -350,6 +350,8 @@ pub fn shouldClose(self: *const Surface) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn getContentScale(self: *const Surface) !apprt.ContentScale {
|
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));
|
const scale = c.gtk_widget_get_scale_factor(@ptrCast(self.gl_area));
|
||||||
return .{ .x = @floatFromInt(scale), .y = @floatFromInt(scale) };
|
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),
|
.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| {
|
if (self.getContentScale()) |scale| {
|
||||||
self.core_surface.contentScaleCallback(scale) catch |err| {
|
self.core_surface.contentScaleCallback(scale) catch |err| {
|
||||||
log.err("error in content scale callback err={}", .{err});
|
log.err("error in content scale callback err={}", .{err});
|
||||||
|
Reference in New Issue
Block a user