mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/gtk: remove usingnamespace
This commit is contained in:
@ -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();
|
||||||
|
@ -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");
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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");
|
||||||
|
@ -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");
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
};
|
|
||||||
|
@ -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");
|
||||||
|
|
||||||
|
14
src/apprt/gtk/ghostty_gtk_compat.h
Normal file
14
src/apprt/gtk/ghostty_gtk_compat.h
Normal 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
|
@ -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);
|
||||||
|
@ -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 {
|
||||||
|
@ -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);
|
||||||
|
Reference in New Issue
Block a user