mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-27 11:06:31 +00:00
Fix up API calls for initialization
This commit is contained in:
@@ -1070,8 +1070,11 @@ pub const Inspector = struct {
|
||||
// Cache our scale because we use it for cursor position calculations.
|
||||
self.content_scale = x;
|
||||
|
||||
// Setup a new style and scale it appropriately.
|
||||
var style: cimgui.c.ImGuiStyle = .{};
|
||||
// Setup a new style and scale it appropriately. We must use the
|
||||
// ImGuiStyle constructor to get proper default values (e.g.,
|
||||
// CurveTessellationTol) rather than zero-initialized values.
|
||||
var style: cimgui.c.ImGuiStyle = undefined;
|
||||
cimgui.ext.ImGuiStyle_ImGuiStyle(&style);
|
||||
cimgui.c.ImGuiStyle_ScaleAllSizes(&style, @floatCast(x));
|
||||
const active_style = cimgui.c.ImGui_GetStyle();
|
||||
active_style.* = style;
|
||||
|
||||
@@ -255,8 +255,11 @@ pub const ImguiWidget = extern struct {
|
||||
io.DisplaySize = .{ .x = @floatFromInt(width), .y = @floatFromInt(height) };
|
||||
io.DisplayFramebufferScale = .{ .x = 1, .y = 1 };
|
||||
|
||||
// Setup a new style and scale it appropriately.
|
||||
var style: cimgui.c.ImGuiStyle = .{};
|
||||
// Setup a new style and scale it appropriately. We must use the
|
||||
// ImGuiStyle constructor to get proper default values (e.g.,
|
||||
// CurveTessellationTol) rather than zero-initialized values.
|
||||
var style: cimgui.c.ImGuiStyle = undefined;
|
||||
cimgui.ext.ImGuiStyle_ImGuiStyle(&style);
|
||||
cimgui.c.ImGuiStyle_ScaleAllSizes(&style, @floatFromInt(scale_factor));
|
||||
const active_style = cimgui.c.ImGui_GetStyle();
|
||||
active_style.* = style;
|
||||
|
||||
@@ -138,23 +138,24 @@ pub fn setup() void {
|
||||
io.IniFilename = null;
|
||||
io.LogFilename = null;
|
||||
|
||||
// Use our own embedded font
|
||||
{
|
||||
// TODO: This will have to be recalculated for different screen DPIs.
|
||||
// This is currently hardcoded to a 2x content scale.
|
||||
const font_size = 16 * 2;
|
||||
|
||||
var font_config: cimgui.c.ImFontConfig = .{};
|
||||
font_config.FontDataOwnedByAtlas = false;
|
||||
_ = cimgui.c.ImFontAtlas_AddFontFromMemoryTTF(
|
||||
io.Fonts,
|
||||
@ptrCast(@constCast(font.embedded.regular)),
|
||||
font.embedded.regular.len,
|
||||
font_size,
|
||||
&font_config,
|
||||
null,
|
||||
);
|
||||
}
|
||||
// // Use our own embedded font
|
||||
// {
|
||||
// // TODO: This will have to be recalculated for different screen DPIs.
|
||||
// // This is currently hardcoded to a 2x content scale.
|
||||
// const font_size = 16 * 2;
|
||||
//
|
||||
// var font_config: cimgui.c.ImFontConfig = .{};
|
||||
// cimgui.ext.ImFontConfig_ImFontConfig(&font_config);
|
||||
// font_config.FontDataOwnedByAtlas = false;
|
||||
// _ = cimgui.c.ImFontAtlas_AddFontFromMemoryTTF(
|
||||
// io.Fonts,
|
||||
// @ptrCast(@constCast(font.embedded.regular.ptr)),
|
||||
// @intCast(font.embedded.regular.len),
|
||||
// font_size,
|
||||
// &font_config,
|
||||
// null,
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
pub fn init(surface: *Surface) !Inspector {
|
||||
|
||||
Reference in New Issue
Block a user