apprt/gtk: remove usingnamespace

This commit is contained in:
Mitchell Hashimoto
2024-08-16 14:57:43 -07:00
parent c3e37b7e15
commit 9409e3072f
17 changed files with 41 additions and 26 deletions

View File

@ -1042,6 +1042,9 @@ fn addDeps(
step.linkLibC(); step.linkLibC();
step.addIncludePath(b.path("src/stb")); step.addIncludePath(b.path("src/stb"));
step.addCSourceFiles(.{ .files = &.{"src/stb/stb.c"} }); step.addCSourceFiles(.{ .files = &.{"src/stb/stb.c"} });
if (step.rootModuleTarget().os.tag == .linux) {
step.addIncludePath(b.path("src/apprt/gtk"));
}
// C++ files // C++ files
step.linkLibCpp(); step.linkLibCpp();

View File

@ -28,7 +28,7 @@ const Surface = @import("Surface.zig");
const Window = @import("Window.zig"); const Window = @import("Window.zig");
const ConfigErrorsWindow = @import("ConfigErrorsWindow.zig"); const ConfigErrorsWindow = @import("ConfigErrorsWindow.zig");
const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig"); const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const inspector = @import("inspector.zig"); const inspector = @import("inspector.zig");
const key = @import("key.zig"); const key = @import("key.zig");
const x11 = @import("x11.zig"); const x11 = @import("x11.zig");

View File

@ -8,7 +8,7 @@ const apprt = @import("../../apprt.zig");
const CoreSurface = @import("../../Surface.zig"); const CoreSurface = @import("../../Surface.zig");
const App = @import("App.zig"); const App = @import("App.zig");
const View = @import("View.zig"); const View = @import("View.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const log = std.log.scoped(.gtk); const log = std.log.scoped(.gtk);

View File

@ -8,7 +8,7 @@ const Config = configpkg.Config;
const App = @import("App.zig"); const App = @import("App.zig");
const View = @import("View.zig"); const View = @import("View.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const log = std.log.scoped(.gtk); const log = std.log.scoped(.gtk);

View File

@ -4,7 +4,7 @@ const std = @import("std");
const assert = std.debug.assert; const assert = std.debug.assert;
const cimgui = @import("cimgui"); const cimgui = @import("cimgui");
const c = @import("c.zig"); const c = @import("c.zig").c;
const key = @import("key.zig"); const key = @import("key.zig");
const gl = @import("opengl"); const gl = @import("opengl");
const input = @import("../../input.zig"); const input = @import("../../input.zig");

View File

@ -1,7 +1,7 @@
const ResizeOverlay = @This(); const ResizeOverlay = @This();
const std = @import("std"); const std = @import("std");
const c = @import("c.zig"); const c = @import("c.zig").c;
const configpkg = @import("../../config.zig"); const configpkg = @import("../../config.zig");
const Surface = @import("Surface.zig"); const Surface = @import("Surface.zig");

View File

@ -12,7 +12,7 @@ const CoreSurface = @import("../../Surface.zig");
const Surface = @import("Surface.zig"); const Surface = @import("Surface.zig");
const Tab = @import("Tab.zig"); const Tab = @import("Tab.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const log = std.log.scoped(.gtk); const log = std.log.scoped(.gtk);

View File

@ -21,7 +21,7 @@ const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig");
const ResizeOverlay = @import("ResizeOverlay.zig"); const ResizeOverlay = @import("ResizeOverlay.zig");
const inspector = @import("inspector.zig"); const inspector = @import("inspector.zig");
const gtk_key = @import("key.zig"); const gtk_key = @import("key.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const x11 = @import("x11.zig"); const x11 = @import("x11.zig");
const log = std.log.scoped(.gtk_surface); const log = std.log.scoped(.gtk_surface);

View File

@ -12,7 +12,7 @@ const CoreSurface = @import("../../Surface.zig");
const Surface = @import("Surface.zig"); const Surface = @import("Surface.zig");
const Window = @import("Window.zig"); const Window = @import("Window.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const log = std.log.scoped(.gtk); const log = std.log.scoped(.gtk);

View File

@ -5,7 +5,7 @@
const View = @This(); const View = @This();
const std = @import("std"); const std = @import("std");
const c = @import("c.zig"); const c = @import("c.zig").c;
const log = std.log.scoped(.gtk); const log = std.log.scoped(.gtk);

View File

@ -19,7 +19,7 @@ const App = @import("App.zig");
const Color = configpkg.Config.Color; const Color = configpkg.Config.Color;
const Surface = @import("Surface.zig"); const Surface = @import("Surface.zig");
const Tab = @import("Tab.zig"); const Tab = @import("Tab.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const log = std.log.scoped(.gtk); const log = std.log.scoped(.gtk);

View File

@ -1,21 +1,19 @@
const c = @cImport({ /// Imported C API directly from header files
pub const c = @cImport({
@cInclude("gtk/gtk.h"); @cInclude("gtk/gtk.h");
if (@import("build_options").libadwaita) @cInclude("libadwaita-1/adwaita.h"); if (@import("build_options").libadwaita) {
@cInclude("libadwaita-1/adwaita.h");
}
// Add in X11-specific GDK backend which we use for specific things (e.g. // Add in X11-specific GDK backend which we use for specific things
// X11 window class). // (e.g. X11 window class).
@cInclude("gdk/x11/gdkx.h"); @cInclude("gdk/x11/gdkx.h");
// Xkb for X11 state handling // Xkb for X11 state handling
@cInclude("X11/XKBlib.h"); @cInclude("X11/XKBlib.h");
// generated header files // generated header files
@cInclude("ghostty_resources.h"); @cInclude("ghostty_resources.h");
// compatibility
@cInclude("ghostty_gtk_compat.h");
}); });
pub usingnamespace c;
/// Compatibility with gobject < 2.74
pub usingnamespace if (@hasDecl(c, "G_CONNECT_DEFAULT")) struct {} else struct {
pub const G_CONNECT_DEFAULT = 0;
pub const G_APPLICATION_DEFAULT_FLAGS = c.G_APPLICATION_FLAGS_NONE;
};

View File

@ -3,7 +3,7 @@
const std = @import("std"); const std = @import("std");
const assert = std.debug.assert; const assert = std.debug.assert;
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const c = @import("c.zig"); const c = @import("c.zig").c;
const App = @import("App.zig"); const App = @import("App.zig");
const internal_os = @import("../../os/main.zig"); const internal_os = @import("../../os/main.zig");

View File

@ -0,0 +1,14 @@
// This file is used to provide compatibility if necessary with
// older versions of GTK and GLib.
#include <gtk/gtk.h>
// Compatibility with gobject < 2.74
#ifndef G_CONNECT_DEFAULT
#define G_CONNECT_DEFAULT 0
#endif
// Compatibility with gobject < 2.74
#ifndef G_APPLICATION_DEFAULT_FLAGS
#define G_APPLICATION_DEFAULT_FLAGS G_APPLICATION_FLAGS_NONE
#endif

View File

@ -6,7 +6,7 @@ const App = @import("App.zig");
const Surface = @import("Surface.zig"); const Surface = @import("Surface.zig");
const TerminalWindow = @import("Window.zig"); const TerminalWindow = @import("Window.zig");
const ImguiWidget = @import("ImguiWidget.zig"); const ImguiWidget = @import("ImguiWidget.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
const CoreInspector = @import("../../inspector/main.zig").Inspector; const CoreInspector = @import("../../inspector/main.zig").Inspector;
const log = std.log.scoped(.inspector); const log = std.log.scoped(.inspector);

View File

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const input = @import("../../input.zig"); const input = @import("../../input.zig");
const c = @import("c.zig"); const c = @import("c.zig").c;
/// Returns a GTK accelerator string from a trigger. /// Returns a GTK accelerator string from a trigger.
pub fn accelFromTrigger(buf: []u8, trigger: input.Binding.Trigger) !?[:0]const u8 { pub fn accelFromTrigger(buf: []u8, trigger: input.Binding.Trigger) !?[:0]const u8 {

View File

@ -1,6 +1,6 @@
/// Utility functions for X11 handling. /// Utility functions for X11 handling.
const std = @import("std"); const std = @import("std");
const c = @import("c.zig"); const c = @import("c.zig").c;
const input = @import("../../input.zig"); const input = @import("../../input.zig");
const log = std.log.scoped(.gtk_x11); const log = std.log.scoped(.gtk_x11);