gtk: address review comments

1. Remove usage of C header imports for gtk x11/wayland.
2. Move X11 C header imports to winproto_x11.zig
3. Clean up long line by breaking it up into multiple steps.
pull/6775/head
Jeffrey C. Ollie 2025-03-17 12:35:31 -05:00
parent 29322535a5
commit daa79c3598
No known key found for this signature in database
GPG Key ID: 6F86035A6D97044E
3 changed files with 10 additions and 21 deletions

View File

@ -510,7 +510,11 @@ pub fn syncAppearance(self: *Window) !void {
// Update toolbar view style
toolbar_view: {
const toolbar_view = gobject.ext.cast(adw.ToolbarView, tab_overview.getChild() orelse break :toolbar_view) orelse break :toolbar_view;
const tab_overview_child = tab_overview.getChild() orelse break :toolbar_view;
const toolbar_view = gobject.ext.cast(
adw.ToolbarView,
tab_overview_child,
) orelse break :toolbar_view;
const toolbar_style: adw.ToolbarStyle = switch (self.config.gtk_toolbar_style) {
.flat => .flat,
.raised => .raised,

View File

@ -1,26 +1,8 @@
const build_options = @import("build_options");
/// Imported C API directly from header files
pub const c = @cImport({
@cInclude("gtk/gtk.h");
@cInclude("adwaita.h");
if (build_options.x11) {
// Add in X11-specific GDK backend which we use for specific things
// (e.g. X11 window class).
@cInclude("gdk/x11/gdkx.h");
// The following includes can't be removed until X11 support is dropped.
@cInclude("X11/Xlib.h");
@cInclude("X11/Xatom.h");
// Xkb for X11 state handling
@cInclude("X11/XKBlib.h");
}
if (build_options.wayland) {
@cInclude("gdk/wayland/gdkwayland.h");
}
// generated header files
@cInclude("ghostty_resources.h");

View File

@ -12,8 +12,11 @@ const gobject = @import("gobject");
const gtk = @import("gtk");
const xlib = @import("xlib");
// This needs to remain because of the legacy X11 API calls
const c = @import("../c.zig").c;
pub const c = @cImport({
@cInclude("X11/Xlib.h");
@cInclude("X11/Xatom.h");
@cInclude("X11/XKBlib.h");
});
const input = @import("../../../input.zig");
const Config = @import("../../../config.zig").Config;