From 88b94c0631b18d6297f4cc948a354ae4b0dc2dac Mon Sep 17 00:00:00 2001 From: foxnne Date: Mon, 19 Oct 2026 22:28:58 -0500 Subject: [PATCH] zig: std.builtin becomes std.lang, ready for 0.18 --- app/automation/overlay.zig | 2 +- app/layout/Chooser.zig | 4 +-- app/layout/Layout.zig | 10 +++---- app/layout/Picker.zig | 2 +- app/layout/Region.zig | 10 +++---- app/layout/ViewDrag.zig | 4 +-- app/store/PluginStore.zig | 6 ++--- backend/build.zig | 8 +++--- backend/src/glass/BlurBackdrop.zig | 2 +- build.zig | 2 +- build/app.zig | 4 +-- build/exe.zig | 10 +++---- build/package.zig | 2 +- build/plugins.zig | 2 +- build/sdk.zig | 10 +++---- build/velopack.zig | 4 +-- build/web.zig | 2 +- core/Sprite.zig | 2 +- core/dialogs.zig | 10 +++---- core/draw.zig | 2 +- core/gfx/icon.zig | 2 +- core/keycaps.zig | 2 +- core/viz/Pie.zig | 2 +- core/viz/Table.zig | 2 +- core/viz/viz.zig | 6 ++--- core/widgets.zig | 28 ++++++++++---------- core/widgets/CanvasWidget.zig | 2 +- core/widgets/ContextWidget.zig | 2 +- core/widgets/DockingWidget.zig | 4 +-- core/widgets/Dropdown.zig | 2 +- core/widgets/FloatingTooltipWidget.zig | 2 +- core/widgets/FloatingWindowWidget.zig | 2 +- core/widgets/Popover.zig | 4 +-- core/widgets/ReorderWidget.zig | 8 +++--- core/widgets/Split.zig | 4 +-- core/widgets/Tabs.zig | 6 ++--- core/widgets/TreeWidget.zig | 10 +++---- core/widgets/glass_button.zig | 2 +- core/widgets/menu/FloatingMenu.zig | 2 +- core/widgets/menu/Menu.zig | 2 +- core/widgets/menu/MenuItem.zig | 2 +- core/widgets/menu/Popup.zig | 2 +- plugins/archive/static/integration.zig | 4 +-- plugins/devtools/src/Dashboard.zig | 2 +- plugins/devtools/static/integration.zig | 4 +-- plugins/guides/static/integration.zig | 4 +-- plugins/image/static/integration.zig | 4 +-- plugins/markdown/build.zig | 2 +- plugins/markdown/src/md/render_ast.zig | 4 +-- plugins/markdown/static/integration.zig | 6 ++--- plugins/shared/build/helpers.zig | 6 ++--- plugins/text/src/widgets/TextEntryWidget.zig | 4 +-- plugins/text/src/widgets/TooltipWidget.zig | 2 +- plugins/text/static/integration.zig | 4 +-- plugins/workbench/static/integration.zig | 4 +-- sdk/core_module.zig | 4 +-- sdk/plugin_sdk.zig | 12 ++++----- sdk/replay/overlay.zig | 2 +- sdk/replay_module.zig | 2 +- sdk/src/fingerprint.zig | 6 ++--- sdk/src/menu.zig | 6 ++--- src/editor/Menu.zig | 4 +-- src/editor/OutputPanel.zig | 2 +- src/editor/dialogs/SaveQuestion.zig | 2 +- src/editor/explorer/settings.zig | 4 +-- 65 files changed, 145 insertions(+), 145 deletions(-) diff --git a/app/automation/overlay.zig b/app/automation/overlay.zig index 8c34dac3a..a12e36dbe 100644 --- a/app/automation/overlay.zig +++ b/app/automation/overlay.zig @@ -70,7 +70,7 @@ const plain_fade_ms = (plain.Options{}).fade_ms; /// (`core.screens.markMain`): the captions, keys and bar are the stage's, and stay on it while a /// dialog or a menu is open in a window of its own over it. Only the pointer, and a callout beside /// what it acts on (`drawCallout`), go into those windows. Every part goes through this. -fn layer(src: std.builtin.SourceLocation, opts: dvui.Options, init: dvui.FloatingWidget.InitOptions) *dvui.FloatingWidget { +fn layer(src: std.lang.SourceLocation, opts: dvui.Options, init: dvui.FloatingWidget.InitOptions) *dvui.FloatingWidget { const fw = plain.layer(src, opts, init); core.screens.markMain(fw.data().id); return fw; diff --git a/app/layout/Chooser.zig b/app/layout/Chooser.zig index 2026b99a7..8fefc28a0 100644 --- a/app/layout/Chooser.zig +++ b/app/layout/Chooser.zig @@ -111,7 +111,7 @@ const Kept = struct { /// A chooser for `place`: a declared region, or `.{ .keywords = … }` for the place with those /// keywords. Draw items with `item`, then `deinit`. -pub fn init(src: std.builtin.SourceLocation, f: *Layout, place: Region, opts: Options) Chooser { +pub fn init(src: std.lang.SourceLocation, f: *Layout, place: Region, opts: Options) Chooser { const key = place.selectionKey(); const id_extra = opts.id_extra ^ @as(usize, @truncate(key)); const kept = dvui.dataGetPtrDefault(null, dvui.parentGet().extendId(src, id_extra), "_chooser", Kept, .{}); @@ -161,7 +161,7 @@ pub fn views(self: *const Chooser) []const *Layout.Surface { } /// One item. Draw what it looks like between this and `Item.deinit`. -pub fn item(self: *Chooser, src: std.builtin.SourceLocation, view: *const Layout.Surface, opts: ItemOptions) Item { +pub fn item(self: *Chooser, src: std.lang.SourceLocation, view: *const Layout.Surface, opts: ItemOptions) Item { const index = self.drawn.items.len; if (self.kept.slot_at) |at| if (at == index) self.openSlot(); self.drawn.append(self.layout.arena, view.id) catch {}; diff --git a/app/layout/Layout.zig b/app/layout/Layout.zig index 7eb18fca2..fd543e265 100644 --- a/app/layout/Layout.zig +++ b/app/layout/Layout.zig @@ -178,7 +178,7 @@ depth: usize = 0, plugin_regions: [max_nesting]Region = undefined, plugin_depth: usize = 0, -pub const PendingSplit = struct { src: std.builtin.SourceLocation, opts: Split.Options }; +pub const PendingSplit = struct { src: std.lang.SourceLocation, opts: Split.Options }; pub const Container = struct { dir: dvui.enums.Direction, @@ -1090,7 +1090,7 @@ pub const placeVisible = ViewDrag.place; /// seed into a live `DockLayout`; after that the persisted tree is what is walked. pub fn tree( self: *Layout, - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, seed: *const Seed, opts: dvui.Options, ) !Tree { @@ -1298,7 +1298,7 @@ pub const State = @import("State.zig"); /// so a plugin can draw one without a `Layout` at all, and everything this adds — finding the /// neighbour to resize, and the container constraint to resolve against — is layout state that /// `core` cannot see. -pub fn split(self: *Layout, src: std.builtin.SourceLocation, opts: Split.Options) void { +pub fn split(self: *Layout, src: std.lang.SourceLocation, opts: Split.Options) void { const c = self.innermost() orelse { dvui.log.err("split() outside a region does nothing", .{}); return; @@ -1337,7 +1337,7 @@ pub fn drawPendingSplit(self: *Layout, after: ?dvui.Id) void { /// region's Options.margin is never a sash, and a card cannot paint over it. pub fn packSplit( self: *Layout, - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, id_extra: usize, target: dvui.Id, sign: f32, @@ -1349,7 +1349,7 @@ pub fn packSplit( /// `packSplit` with the gap given a width, for a sash closing along with the place beside it. pub fn packSplitSized( self: *Layout, - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, id_extra: usize, target: dvui.Id, sign: f32, diff --git a/app/layout/Picker.zig b/app/layout/Picker.zig index 4f742c050..de013aefe 100644 --- a/app/layout/Picker.zig +++ b/app/layout/Picker.zig @@ -752,7 +752,7 @@ fn drawLifted(self: *Picker, f: *Layout) void { /// Published as `region.menu.:` while it can be pressed — a dimmed one swallows the /// click, and a driver waiting for the name should wait for the action, not for the button. /// Delete wears the theme's error colour. Disabled, it keeps its place (dimmed, no hover). -fn controlButton(src: std.builtin.SourceLocation, c: place_commands.Command, place: []const u8, enabled: bool, id_extra: usize) bool { +fn controlButton(src: std.lang.SourceLocation, c: place_commands.Command, place: []const u8, enabled: bool, id_extra: usize) bool { const theme = dvui.themeGet(); const tint = if (c.action == .delete) theme.color(.err, .text) else theme.color(.control, .text); var bw: dvui.ButtonWidget = undefined; diff --git a/app/layout/Region.zig b/app/layout/Region.zig index 098e3ccdf..0230b5a90 100644 --- a/app/layout/Region.zig +++ b/app/layout/Region.zig @@ -327,7 +327,7 @@ pub const InitOptions = struct { /// } /// f.split(@src(), .{}); /// ``` -pub fn init(self: *Layout, src: std.builtin.SourceLocation, init_opts: InitOptions, opts_given: dvui.Options) anyerror!Region { +pub fn init(self: *Layout, src: std.lang.SourceLocation, init_opts: InitOptions, opts_given: dvui.Options) anyerror!Region { const opts = withCard(self, init_opts, opts_given); if (self.depth >= Layout.max_nesting) { dvui.log.err("layout nests deeper than {d} regions; \"{s}\" ignored", .{ Layout.max_nesting, init_opts.name }); @@ -1284,7 +1284,7 @@ fn idOf(state: *Layout.State, name: []const u8) ?dvui.Id { fn initTree( self: *Layout, - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, init_opts: InitOptions, opts: dvui.Options, node: *SplitTree.Node, @@ -1394,7 +1394,7 @@ fn initTree( fn drawTreeChildren( self: *Layout, - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, shape: InitOptions, shape_opts: dvui.Options, branch: SplitTree.Branch, @@ -1415,7 +1415,7 @@ fn drawTreeChildren( try drawTreeNode(self, src, shape, shape_opts, branch.b, omit_b, leftover_b); } -fn packTreeSplit(self: *Layout, src: std.builtin.SourceLocation, branch: SplitTree.Branch) void { +fn packTreeSplit(self: *Layout, src: std.lang.SourceLocation, branch: SplitTree.Branch) void { const new_name = SplitTree.newNameOf(branch); const leading = SplitTree.newIsLeading(branch.side); const sign: f32 = if (leading) 1 else -1; @@ -1505,7 +1505,7 @@ fn placeVisual(opts: dvui.Options) dvui.Options { fn drawTreeNode( self: *Layout, - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, shape: InitOptions, shape_opts: dvui.Options, node: *SplitTree.Node, diff --git a/app/layout/ViewDrag.zig b/app/layout/ViewDrag.zig index f6fa44422..f5f195ea1 100644 --- a/app/layout/ViewDrag.zig +++ b/app/layout/ViewDrag.zig @@ -1452,7 +1452,7 @@ pub fn drawOverlay(l: *Layout) void { /// its glass — and is re-added as a window of its own and raised, as the demo overlay's layers are /// (`automation/overlay.zig`). It takes no pointer events: what is under it still takes them, the /// drag's hold on the pointer included. -fn layerOver(layer: *dvui.FloatingWidget, src: std.builtin.SourceLocation) void { +fn layerOver(layer: *dvui.FloatingWidget, src: std.lang.SourceLocation) void { layer.init(src, .{ .mouse_events = false }, .{ .rect = .cast(dvui.windowRect()), .background = false }); const wd = layer.data(); dvui.subwindowAdd(wd.id, wd.rect, wd.rectScale().r, false, null, false); @@ -1466,7 +1466,7 @@ fn layerOver(layer: *dvui.FloatingWidget, src: std.builtin.SourceLocation) void /// glass, and nothing in the app's own windows follows it. A copy there — its glass, a drop's tail, /// the drop it ran into — was drawn at another moment than the window server moved the window, and /// trailed behind it. Whether it is; the layer is the caller's to `deinit` then. -fn ownWindowLayer(layer: *dvui.FloatingWidget, src: std.builtin.SourceLocation) bool { +fn ownWindowLayer(layer: *dvui.FloatingWidget, src: std.lang.SourceLocation) bool { if (!core.dialogs.carry_windows) return false; layerOver(layer, src); core.screens.markCarried(layer.data().id); diff --git a/app/store/PluginStore.zig b/app/store/PluginStore.zig index cbe3c7c19..2355b839a 100644 --- a/app/store/PluginStore.zig +++ b/app/store/PluginStore.zig @@ -668,7 +668,7 @@ fn drawAuthorLine(entry: StoreEntry, muted: dvui.Color) void { /// `Font.withUnderline` + `color(.highlight, .fill)`, so every clickable bit of prose in the app /// reads the same way. A name with nowhere to go stays deliberately unstyled — underlining /// something unclickable is worse than leaving it plain. -fn drawCreditLink(src: std.builtin.SourceLocation, text: []const u8, url: ?[]const u8, muted: dvui.Color) void { +fn drawCreditLink(src: std.lang.SourceLocation, text: []const u8, url: ?[]const u8, muted: dvui.Color) void { const body = dvui.Font.theme(.body); const target = url orelse { dvui.labelNoFmt(src, text, .{}, .{ @@ -696,7 +696,7 @@ fn drawCreditLink(src: std.builtin.SourceLocation, text: []const u8, url: ?[]con /// separate bar), regular body text, and the selected tab marked by a `window`-text-colored /// underline rather than a filled pill. No drag/drop and no scroll area — there are only ever /// two tabs here. -fn tabButton(src: std.builtin.SourceLocation, label: []const u8, id_extra: usize, selected: bool) bool { +fn tabButton(src: std.lang.SourceLocation, label: []const u8, id_extra: usize, selected: bool) bool { const theme = dvui.themeGet(); // Sized to the label's own width (no expand), so the underline drawn below — which does @@ -2231,7 +2231,7 @@ const card_stagger_cap: usize = 10; /// re-triggers whenever `dvui.firstFrame` sees a new widget id, so indexing by position would /// replay the whole cascade every time re-ranking moved a card (i.e. on every filter keystroke). /// Keyed by id, each plugin animates exactly once, no matter how the list is later sorted. -fn cardAnimator(src: std.builtin.SourceLocation, entry: StoreEntry, index: usize) *dvui.AnimateWidget { +fn cardAnimator(src: std.lang.SourceLocation, entry: StoreEntry, index: usize) *dvui.AnimateWidget { const stagger = @min(index, card_stagger_cap); return dvui.animate(src, .{ .kind = .horizontal, diff --git a/backend/build.zig b/backend/build.zig index 0b7ba8d55..866c8f394 100644 --- a/backend/build.zig +++ b/backend/build.zig @@ -23,7 +23,7 @@ pub fn build(b: *std.Build) void { // harness, against the patched library. Arguments after `--` reach the runner: // `--filter `, `--require-gpu `. const test_sdl_step = b.step("test-sdl", "Build and run the suites for fizzy's SDL patches"); - const sdl_optimize: std.builtin.OptimizeMode = if (optimize == .debug) .fast else optimize; + const sdl_optimize: std.lang.OptimizeMode = if (optimize == .debug) .fast else optimize; if (sdlDependency(b, target, sdl_optimize, null)) |sdl| { const source = patchedSdl(b).?; const sdl_test = b.addLibrary(.{ @@ -86,7 +86,7 @@ pub const MacosSdk = struct { pub const Options = struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, /// Null on a native build. macos_sdk: ?MacosSdk = null, }; @@ -139,7 +139,7 @@ pub fn backendModule(dep: *std.Build.Dependency, dvui_mod: *std.Build.Module, op // device, every window's present. A Debug frame spent much of itself there (`sample`), and a // window's way into full screen ran at half the display's rate in Debug alone. The app's own // code stays Debug; stepping into SDL's C is what a Debug app gives up. - const sdl_optimize: std.builtin.OptimizeMode = if (opts.optimize == .debug) .fast else opts.optimize; + const sdl_optimize: std.lang.OptimizeMode = if (opts.optimize == .debug) .fast else opts.optimize; const sdl_dep = sdlDependency(b, opts.target, sdl_optimize, opts.macos_sdk); const sdl_translate_c = b.addTranslateC(.{ @@ -209,7 +209,7 @@ fn patchedSdl(b: *std.Build) ?std.Build.LazyPath { fn sdlDependency( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, macos_sdk: ?MacosSdk, ) ?*std.Build.Dependency { const source = patchedSdl(b) orelse return null; diff --git a/backend/src/glass/BlurBackdrop.zig b/backend/src/glass/BlurBackdrop.zig index 1c8aed9cd..0d84b3e9d 100644 --- a/backend/src/glass/BlurBackdrop.zig +++ b/backend/src/glass/BlurBackdrop.zig @@ -108,7 +108,7 @@ const max_levels = 24; /// Safe to call every frame, any time before `init`/`deinit` - in /// particular, before other same-frame code needs to mutate fields on the /// returned pointer (e.g. a slider bound to `&backdrop.radius_px`). -pub fn get(src: std.builtin.SourceLocation) *BlurBackdrop { +pub fn get(src: std.lang.SourceLocation) *BlurBackdrop { const id = dvui.parentGet().extendId(src, 0); const self = dvui.dataGetPtrDefault(null, id, "blur_backdrop", BlurBackdrop, .{}); dvui.dataSetDeinitFunction(null, id, "blur_backdrop", &releaseTexture); diff --git a/build.zig b/build.zig index e9666ca7d..991bc988b 100644 --- a/build.zig +++ b/build.zig @@ -83,7 +83,7 @@ pub fn build(b: *std.Build) !void { /// standard options on the same builder. var deferred: ?struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, base: @import("build/app.zig").Options, cfg: @import("build/app.zig").Config, /// `buildApp` has run (`addPackageSteps` needs its steps). diff --git a/build/app.zig b/build/app.zig index f7b8acf65..28624bc07 100644 --- a/build/app.zig +++ b/build/app.zig @@ -52,7 +52,7 @@ pub const Options = struct { macos_sdk: ?[]const u8 = null, }; -pub fn build(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, opts: Options) !void { +pub fn build(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang.OptimizeMode, opts: Options) !void { const cfg = try readConfig(b, target, opts); try construct(b, target, optimize, opts, cfg); } @@ -490,7 +490,7 @@ pub fn readConfig(b: *std.Build, target: std.Build.ResolvedTarget, opts: Options } /// Phase two of `build`: the executables, the web build, tests, packaging. -pub fn construct(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, opts: Options, cfg: Config) !void { +pub fn construct(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang.OptimizeMode, opts: Options, cfg: Config) !void { const common = @import("common.zig"); const plugins = @import("plugins.zig"); const sdk = @import("sdk.zig"); diff --git a/build/exe.zig b/build/exe.zig index d64f5d813..7da0cdcbb 100644 --- a/build/exe.zig +++ b/build/exe.zig @@ -103,7 +103,7 @@ pub fn nativeDvui( b: *std.Build, native_backend: NativeBackend, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, accesskit: dvui.AccesskitOptions, macos_sdl_paths: ?MacosSdlPaths, ) NativeDvui { @@ -133,7 +133,7 @@ pub fn nativeDvui( fn fizzyNativeDvui( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, accesskit: dvui.AccesskitOptions, macos_sdl_paths: ?MacosSdlPaths, ) NativeDvui { @@ -158,7 +158,7 @@ pub fn backendDependency(b: *std.Build) *std.Build.Dependency { return b.dependency("fizzy_backend", .{}); } -pub fn backendOptions(target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, macos_sdl_paths: ?MacosSdlPaths) fizzy_backend.Options { +pub fn backendOptions(target: std.Build.ResolvedTarget, optimize: std.lang.OptimizeMode, macos_sdl_paths: ?MacosSdlPaths) fizzy_backend.Options { return .{ .target = target, .optimize = optimize, @@ -172,7 +172,7 @@ pub fn platformModule( b: *std.Build, native: NativeDvui, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, macos_sdl_paths: ?MacosSdlPaths, ) *std.Build.Module { return fizzy_backend.platformModule(backendDependency(b), native.dvui, native.backend, backendOptions(target, optimize, macos_sdl_paths)); @@ -183,7 +183,7 @@ pub fn addFizzyExecutableForTarget( /// Null on the configure pass that fetches Velopack (`app.readConfig`). vz: ?velopack.Dep, resolved_target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, accesskit: dvui.AccesskitOptions, native_backend: NativeBackend, build_opts: *std.Build.Step.Options, diff --git a/build/package.zig b/build/package.zig index a6711c82a..a1bc09f6d 100644 --- a/build/package.zig +++ b/build/package.zig @@ -8,7 +8,7 @@ pub const Options = struct { b: *std.Build, vz: velopack.Dep, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, app_version: []const u8, /// `--packId`, and the executable's name (`--mainExe`). app_name: []const u8, diff --git a/build/plugins.zig b/build/plugins.zig index f7d1b8469..31a21c697 100644 --- a/build/plugins.zig +++ b/build/plugins.zig @@ -41,7 +41,7 @@ pub fn linksFizzys(plugins: []const BundledPlugin, name: []const u8) bool { /// What one executable gives the plugins it links. pub const Wiring = struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, dvui: *std.Build.Module, core: *std.Build.Module, sdk: *std.Build.Module, diff --git a/build/sdk.zig b/build/sdk.zig index 05c6aa212..0eed56a13 100644 --- a/build/sdk.zig +++ b/build/sdk.zig @@ -27,7 +27,7 @@ pub fn dvuiDependency(b: *std.Build, args: anytype) *std.Build.Dependency { pub fn addProxyBridgeModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, dvui_dep: *std.Build.Dependency, dvui_module: *std.Build.Module, ) *std.Build.Module { @@ -43,7 +43,7 @@ pub fn addProxyBridgeModule( pub fn wireSdkModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, dvui_module: *std.Build.Module, proxy_bridge_module: *std.Build.Module, core_module: *std.Build.Module, @@ -80,7 +80,7 @@ pub fn wireSdkModule( pub fn wireAppModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, dvui_module: *std.Build.Module, core_module: *std.Build.Module, sdk_module: *std.Build.Module, @@ -126,7 +126,7 @@ pub fn wireAppModule( /// Crash reports (`app/crash/`): std-only, a module of its own so the plugin loader reaches it /// from a test rooted at the loader as well as from the app. -pub fn crashModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Module { +pub fn crashModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang.OptimizeMode) *std.Build.Module { return b.createModule(.{ .target = target, .optimize = optimize, @@ -164,7 +164,7 @@ pub const BundledPlugin = struct { pub fn bundledPluginsModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, plugins: []const BundledPlugin, ) *std.Build.Module { var src = std.ArrayList(u8).empty; diff --git a/build/velopack.zig b/build/velopack.zig index 4fbe629dc..e806d1675 100644 --- a/build/velopack.zig +++ b/build/velopack.zig @@ -78,7 +78,7 @@ pub fn addVpkRun(b: *std.Build, vz: Dep, target: std.Build.ResolvedTarget) !*std /// `Velopack.h` as a Zig module, through translate-c: Zig 0.17 removed `@cImport`. Imported as /// `velopack_c` by the modules `linkVelopack` is given. -fn velopackCModule(b: *std.Build, vz: Dep, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Module { +fn velopackCModule(b: *std.Build, vz: Dep, target: std.Build.ResolvedTarget, optimize: std.lang.OptimizeMode) *std.Build.Module { const tc = b.addTranslateC(.{ .root_source_file = vz.builder.dependency("velopack", .{}).path("include/Velopack.h"), .target = target, @@ -89,7 +89,7 @@ fn velopackCModule(b: *std.Build, vz: Dep, target: std.Build.ResolvedTarget, opt pub const LinkVelopackOptions = struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, /// Modules that call Velopack's C API (the `app` module's updater does): each gets /// `Velopack.h` as the `velopack_c` import. c_modules: []const *std.Build.Module = &.{}, diff --git a/build/web.zig b/build/web.zig index 8e5acac0e..0e485be87 100644 --- a/build/web.zig +++ b/build/web.zig @@ -7,7 +7,7 @@ const sdk = @import("sdk.zig"); pub fn addSteps( b: *std.Build, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, build_opts: *std.Build.Step.Options, workbench_opts: *std.Build.Step.Options, assets_module: *std.Build.Module, diff --git a/core/Sprite.zig b/core/Sprite.zig index 8bc5419b0..5d49eee04 100644 --- a/core/Sprite.zig +++ b/core/Sprite.zig @@ -13,7 +13,7 @@ source: [4]u32, /// Draw this sprite from `atlas_source` as a dvui widget (static textured quad). pub fn draw( self: Sprite, - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, atlas_source: dvui.ImageSource, scale: f32, opts: dvui.Options, diff --git a/core/dialogs.zig b/core/dialogs.zig index 6523d3adb..da8416fc8 100644 --- a/core/dialogs.zig +++ b/core/dialogs.zig @@ -843,7 +843,7 @@ pub fn dialogCanvasPointerInputSuppressed() bool { /// Creates a new file dialog with necessary data set and returns the id mutex. /// Caller must unlock the mutex after setting any additional data on the id. -pub fn dialog(src: std.builtin.SourceLocation, opts: DialogOptions) dvui.IdMutex { +pub fn dialog(src: std.lang.SourceLocation, opts: DialogOptions) dvui.IdMutex { // The default frame is the host's where there is one (see `HostChrome`); a caller that // brought its own `windowFn` keeps it. const window_fn: dvui.Dialog.DisplayFn = if (opts.windowFn == &dialogWindow) @@ -1130,7 +1130,7 @@ pub fn dialogTitle(id: dvui.Id) ?[]const u8 { /// A button in a dialog's body, as its footer's are: what a dialog with buttons of its own /// (`hide_footer`) draws them with. Named `fizzy.dialog::<label>` for a tape, a test or an /// agent to click (docs/AUTOMATION.md, "Anchors"); `dialog_id` is the id its `displayFn` was given. -pub fn bodyButton(src: std.builtin.SourceLocation, dialog_id: dvui.Id, label: []const u8, look: dvui.Theme.Style.Name, tab_index: u16, id_extra: usize) bool { +pub fn bodyButton(src: std.lang.SourceLocation, dialog_id: dvui.Id, label: []const u8, look: dvui.Theme.Style.Name, tab_index: u16, id_extra: usize) bool { const opts: dvui.Options = .{ .tab_index = tab_index, .style = look, @@ -1350,7 +1350,7 @@ pub const SpinnerOptions = struct { end_time: i32 = 1_000_000, }; -pub fn spinner(src: std.builtin.SourceLocation, spinner_opts: SpinnerOptions, opts: dvui.Options) void { +pub fn spinner(src: std.lang.SourceLocation, spinner_opts: SpinnerOptions, opts: dvui.Options) void { var defaults: dvui.Options = .{ .name = "Spinner", .min_size_content = .{ .w = 50, .h = 50 }, @@ -1402,7 +1402,7 @@ pub fn spinner(src: std.builtin.SourceLocation, spinner_opts: SpinnerOptions, op /// A toast: `dvui.toast` with fizzy's look (`toastDisplay`) in place of dvui's, which paints a /// plain theme-coloured label whatever the window's material. Every toast the app raises goes /// through here; a toast that names its own `displayFn` keeps it. -pub fn toast(src: std.builtin.SourceLocation, opts: dvui.ToastOptions) void { +pub fn toast(src: std.lang.SourceLocation, opts: dvui.ToastOptions) void { var o = opts; if (o.displayFn == @as(dvui.Dialog.DisplayFn, dvui.toastDisplay)) o.displayFn = toastDisplay; dvui.toast(src, o); @@ -1519,7 +1519,7 @@ pub fn bubbleSpinnerSaveInCheckPhase(complete_elapsed_ns: i128) bool { /// `options.color(.text)` is the bubbles' colour. Runs at the motion speed; with motion off it /// stands still, and the finish is the check. pub fn bubbleSpinner( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, opts: dvui.Options, init: BubbleSpinnerInit, ) void { diff --git a/core/draw.zig b/core/draw.zig index 5ea6b37b2..254cedef5 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -22,7 +22,7 @@ const widgets = @import("widgets.zig"); /// Falls back to a plain `dvui.label` when the query is empty or nothing matched. `plain` /// should match how the row was scored (`false` for paths, `true` for bare names/titles). pub fn labelHighlighted( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, text: []const u8, query: *const fuzzy.Query, plain: bool, diff --git a/core/gfx/icon.zig b/core/gfx/icon.zig index e3df27083..ea0984c9c 100644 --- a/core/gfx/icon.zig +++ b/core/gfx/icon.zig @@ -20,7 +20,7 @@ const builtin = @import("builtin"); const dvui = @import("dvui"); /// `dvui.icon`, drawn through the texture cache. Same layout, same options. -pub fn icon(src: std.builtin.SourceLocation, name: []const u8, tvg_bytes: []const u8, icon_opts: dvui.IconRenderOptions, opts: dvui.Options) void { +pub fn icon(src: std.lang.SourceLocation, name: []const u8, tvg_bytes: []const u8, icon_opts: dvui.IconRenderOptions, opts: dvui.Options) void { var iw: dvui.IconWidget = undefined; iw.init(src, name, tvg_bytes, icon_opts, opts); defer iw.deinit(); diff --git a/core/keycaps.zig b/core/keycaps.zig index 523db6cb9..51353d19b 100644 --- a/core/keycaps.zig +++ b/core/keycaps.zig @@ -187,7 +187,7 @@ pub const DrawOptions = struct { }; /// Draw `stroke`. A two-part chord draws both halves with a gap between them. -pub fn draw(src: std.builtin.SourceLocation, stroke: Stroke, opts: DrawOptions) void { +pub fn draw(src: std.lang.SourceLocation, stroke: Stroke, opts: DrawOptions) void { const theme = dvui.themeGet(); const base = opts.color orelse theme.color(.control, .text).opacity(0.55); const color = if (opts.enabled) base else base.opacity(0.5); diff --git a/core/viz/Pie.zig b/core/viz/Pie.zig index dccae9220..a62f2dc26 100644 --- a/core/viz/Pie.zig +++ b/core/viz/Pie.zig @@ -70,7 +70,7 @@ pub const Options = struct { /// What a slice was last drawn as, kept between frames for the easing. const Shown = struct { key: u64, share: f32 }; -pub fn init(src: std.builtin.SourceLocation, slices: []const Slice, opts: Options, wopts: dvui.Options) Pie { +pub fn init(src: std.lang.SourceLocation, slices: []const Slice, opts: Options, wopts: dvui.Options) Pie { const defaults: dvui.Options = .{ .name = "viz.Pie", .min_size_content = .{ .w = 300, .h = 200 } }; const box = dvui.box(src, .{}, defaults.override(wopts)); const id = box.data().id; diff --git a/core/viz/Table.zig b/core/viz/Table.zig index 28808ba8e..a2bbbdf57 100644 --- a/core/viz/Table.zig +++ b/core/viz/Table.zig @@ -88,7 +88,7 @@ const pad: f32 = 8; /// Columns past this many are not drawn. pub const max_columns = 16; -pub fn init(src: std.builtin.SourceLocation, columns: []const Column, opts: Options, wopts: dvui.Options) Table { +pub fn init(src: std.lang.SourceLocation, columns: []const Column, opts: Options, wopts: dvui.Options) Table { const defaults: dvui.Options = .{ .name = "viz.Table", .expand = .both, .background = false }; const body_font = dvui.Font.theme(.body); const mono = dvui.Font.theme(.mono); diff --git a/core/viz/viz.zig b/core/viz/viz.zig index e78951833..23cfecd6b 100644 --- a/core/viz/viz.zig +++ b/core/viz/viz.zig @@ -79,7 +79,7 @@ pub fn keyColor(key: u64) dvui.Color { } /// `series` over time in a box of their own. The caller `deinit`s what it returns. -pub fn line(src: std.builtin.SourceLocation, series: []const Series, opts: LineOptions, wopts: dvui.Options) Line { +pub fn line(src: std.lang.SourceLocation, series: []const Series, opts: LineOptions, wopts: dvui.Options) Line { const defaults: dvui.Options = .{ .name = "viz.line", .expand = .horizontal, .min_size_content = .{ .w = 200, .h = 90 } }; const box = dvui.box(src, .{}, defaults.override(wopts)); const rs = box.data().contentRectScale(); @@ -235,7 +235,7 @@ pub const BarOptions = struct { /// `fraction` (0 to 1) of the box's width filled from its left edge, so bars side by side /// compare by their length. `scale.fraction` makes one from a value and its whole. -pub fn bar(src: std.builtin.SourceLocation, fraction: f32, opts: BarOptions, wopts: dvui.Options) void { +pub fn bar(src: std.lang.SourceLocation, fraction: f32, opts: BarOptions, wopts: dvui.Options) void { const defaults: dvui.Options = .{ .name = "viz.bar", .expand = .horizontal, .min_size_content = .{ .w = 48, .h = 10 }, .gravity_y = 0.5 }; var bb = dvui.box(src, .{}, defaults.override(wopts)); defer bb.deinit(); @@ -256,7 +256,7 @@ pub const StatOptions = struct { /// `label value unit`, the label and unit faint and the number in the monospace font: one /// reading of a dashboard's header, a status line's figure. -pub fn stat(src: std.builtin.SourceLocation, label: []const u8, value: f64, opts: StatOptions, wopts: dvui.Options) void { +pub fn stat(src: std.lang.SourceLocation, label: []const u8, value: f64, opts: StatOptions, wopts: dvui.Options) void { const defaults: dvui.Options = .{ .name = "viz.stat", .gravity_y = 0.5, .padding = .{ .w = 12 } }; var row = dvui.box(src, .{ .dir = .horizontal }, defaults.override(wopts)); defer row.deinit(); diff --git a/core/widgets.zig b/core/widgets.zig index 52b4f6430..e896ec918 100644 --- a/core/widgets.zig +++ b/core/widgets.zig @@ -62,13 +62,13 @@ pub const orb = @import("widgets/orb.zig"); pub const DropdownWidget = @import("widgets/Dropdown.zig"); /// `dvui.menu` / `dvui.menuItem` / `dvui.floatingMenu`, over the copies above. -pub fn menu(src: std.builtin.SourceLocation, dir: dvui.enums.Direction, opts: dvui.Options) *MenuWidget { +pub fn menu(src: std.lang.SourceLocation, dir: dvui.enums.Direction, opts: dvui.Options) *MenuWidget { var ret = dvui.widgetAlloc(MenuWidget); ret.init(src, .{ .dir = dir }, opts); return ret; } -pub fn menuItem(src: std.builtin.SourceLocation, init_opts: MenuItemWidget.InitOptions, opts: dvui.Options) *MenuItemWidget { +pub fn menuItem(src: std.lang.SourceLocation, init_opts: MenuItemWidget.InitOptions, opts: dvui.Options) *MenuItemWidget { var ret = dvui.widgetAlloc(MenuItemWidget); ret.init(src, init_opts, opts); ret.processEvents(); @@ -78,14 +78,14 @@ pub fn menuItem(src: std.builtin.SourceLocation, init_opts: MenuItemWidget.InitO /// A right-click / touch-hold area over `init_opts.rect` — use this, not `dvui.context`: see /// `ContextWidget`'s header for why a touch hold needs the copy. -pub fn context(src: std.builtin.SourceLocation, init_opts: ContextWidget.InitOptions, opts: dvui.Options) *ContextWidget { +pub fn context(src: std.lang.SourceLocation, init_opts: ContextWidget.InitOptions, opts: dvui.Options) *ContextWidget { var ret = dvui.widgetAlloc(ContextWidget); ret.init(src, init_opts, opts); ret.processEvents(); return ret; } -pub fn floatingMenu(src: std.builtin.SourceLocation, init_opts: FloatingMenuWidget.InitOptions, opts: dvui.Options) *FloatingMenuWidget { +pub fn floatingMenu(src: std.lang.SourceLocation, init_opts: FloatingMenuWidget.InitOptions, opts: dvui.Options) *FloatingMenuWidget { var ret = dvui.widgetAlloc(FloatingMenuWidget); ret.init(src, init_opts, opts); return ret; @@ -94,7 +94,7 @@ pub fn floatingMenu(src: std.builtin.SourceLocation, init_opts: FloatingMenuWidg /// `dvui.tooltip` drawn as fizzy's floating surface (`dialogs.tooltipSurface`): a line of text /// in a frosted, rounded, shadowed card like the dialogs and menus, rather than dvui's opaque box. /// Same arguments; `opts` styles the text. -pub fn tooltip(src: std.builtin.SourceLocation, init_opts: FloatingTooltipWidget.InitOptions, comptime fmt: []const u8, fmt_args: anytype, opts: dvui.Options) void { +pub fn tooltip(src: std.lang.SourceLocation, init_opts: FloatingTooltipWidget.InitOptions, comptime fmt: []const u8, fmt_args: anytype, opts: dvui.Options) void { var tt: FloatingTooltipWidget = undefined; const defaults: dvui.Options = .{ .role = .tooltip, .padding = dvui.Rect.all(6) }; tt.init(src, init_opts, defaults.override(dialogs.tooltipOptions(0)).override(opts)); @@ -108,7 +108,7 @@ pub fn tooltip(src: std.builtin.SourceLocation, init_opts: FloatingTooltipWidget } /// `dvui.popup` on this module's menu chain, so it can be frosted — see `PopupWidget`. -pub fn popup(src: std.builtin.SourceLocation, init_opts: PopupWidget.InitOptions, opts: dvui.Options) ?*PopupWidget { +pub fn popup(src: std.lang.SourceLocation, init_opts: PopupWidget.InitOptions, opts: dvui.Options) ?*PopupWidget { var ret = dvui.widgetAlloc(PopupWidget); return ret.active(src, init_opts, opts); } @@ -154,7 +154,7 @@ pub const MenuRowOptions = struct { /// two menus in the app can disagree about what a row is. /// /// Returns the rect a submenu would open from, or null when not activated. -pub fn menuRow(src: std.builtin.SourceLocation, label: []const u8, opts: MenuRowOptions) ?dvui.Rect.Natural { +pub fn menuRow(src: std.lang.SourceLocation, label: []const u8, opts: MenuRowOptions) ?dvui.Rect.Natural { var mi = menuItem(src, .{ .submenu = opts.submenu }, menuRowOptions(.{ .expand = .horizontal, .id_extra = opts.id_extra })); const ret: ?dvui.Rect.Natural = if (opts.enabled) mi.activeRect() else null; if (opts.command) |id| anchor.mark(mi.data(), "fizzy.command:{s}", .{id}); @@ -181,7 +181,7 @@ pub fn menuRow(src: std.builtin.SourceLocation, label: []const u8, opts: MenuRow /// A row with a label and nothing else — `menuRow` with no icon or shortcut. Kept for the callers /// that only name a verb; it is the same row, so it sits in the same column as its neighbours. pub fn menuItemLabel( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, label_str: []const u8, init_opts: MenuItemWidget.InitOptions, opts: dvui.Options, @@ -193,7 +193,7 @@ pub fn menuItemLabel( /// field's Copy/Paste menu. One control, so the file tree, the settings, the plugin store and the /// region picker read as the same thing and cannot drift apart. Returns the text, which borrows /// the field's buffer — read it this frame. -pub fn filterRow(src: std.builtin.SourceLocation, placeholder: []const u8, opts: dvui.Options) []const u8 { +pub fn filterRow(src: std.lang.SourceLocation, placeholder: []const u8, opts: dvui.Options) []const u8 { var row = dvui.box(src, .{ .dir = .horizontal }, (dvui.Options{ .expand = .horizontal }).override(opts)); defer row.deinit(); icon_tex.icon( @@ -253,7 +253,7 @@ pub fn textEntryMenu(te: *dvui.TextEntryWidget) bool { return false; } -pub fn contextMenu(src: std.builtin.SourceLocation, at: dvui.Point.Natural, opts: dvui.Options) *FloatingMenuWidget { +pub fn contextMenu(src: std.lang.SourceLocation, at: dvui.Point.Natural, opts: dvui.Options) *FloatingMenuWidget { // `.popup`, not the `.menu` default: a right-click menu is not part of a menubar chain, and // the difference that matters is that a popup closes when you click outside it. The default // left a context menu standing while the click that should have dismissed it went somewhere @@ -335,7 +335,7 @@ pub fn treeGlyphColor(theme: dvui.Theme) dvui.Color { /// itself to the slot by the proportions dvui remembers for its id. Drawn under one id, a /// just-collapsed caret was fitted by the down arrow's proportions and stayed stretched until /// something redrew the row, so each direction has an id of its own. -pub fn treeCaret(src: std.builtin.SourceLocation, expanded: bool, color: dvui.Color) void { +pub fn treeCaret(src: std.lang.SourceLocation, expanded: bool, color: dvui.Color) void { var slot = treeRowGlyph(src, .{}); defer slot.deinit(); _ = icon_tex.icon( @@ -373,7 +373,7 @@ pub fn treeRowIconOptions(over: dvui.Options) dvui.Options { /// a floor that any large icon can push open. /// /// Caller deinits, as with `dvui.box`. -pub fn treeRowGlyph(src: std.builtin.SourceLocation, opts: dvui.Options) *dvui.BoxWidget { +pub fn treeRowGlyph(src: std.lang.SourceLocation, opts: dvui.Options) *dvui.BoxWidget { const size = treeRowGlyphSize(); const defaults: dvui.Options = .{ .gravity_y = 0.5, @@ -397,7 +397,7 @@ pub fn scrollShadows(area: *dvui.ScrollAreaWidget) void { draw.drawScrollEdgeShadows(rs, rs, area.si, .{}); } -pub fn floatingWindow(src: std.builtin.SourceLocation, floating_opts: FloatingWindowWidget.InitOptions, opts: dvui.Options) *FloatingWindowWidget { +pub fn floatingWindow(src: std.lang.SourceLocation, floating_opts: FloatingWindowWidget.InitOptions, opts: dvui.Options) *FloatingWindowWidget { var ret = dvui.widgetAlloc(FloatingWindowWidget); ret.init(src, floating_opts, opts); ret.processEventsBefore(); @@ -431,7 +431,7 @@ pub fn hoverRestFill(hover: dvui.Color) dvui.Color { return hover.opacity(0); } -pub fn reorder(src: std.builtin.SourceLocation, init_opts: ReorderWidget.InitOptions, opts: dvui.Options) *ReorderWidget { +pub fn reorder(src: std.lang.SourceLocation, init_opts: ReorderWidget.InitOptions, opts: dvui.Options) *ReorderWidget { var ret = dvui.widgetAlloc(ReorderWidget); ret.init(src, init_opts, opts); ret.processEvents(); diff --git a/core/widgets/CanvasWidget.zig b/core/widgets/CanvasWidget.zig index e3be9f2c1..72aad4bbe 100644 --- a/core/widgets/CanvasWidget.zig +++ b/core/widgets/CanvasWidget.zig @@ -407,7 +407,7 @@ pub fn rescale(self: *CanvasWidget) void { self.scale = target_scale; } -pub fn install(self: *CanvasWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: dvui.Options) void { +pub fn install(self: *CanvasWidget, src: std.lang.SourceLocation, init_opts: InitOptions, opts: dvui.Options) void { self.id = init_opts.id; self.init_opts = init_opts; diff --git a/core/widgets/ContextWidget.zig b/core/widgets/ContextWidget.zig index da09c348c..6c3377046 100644 --- a/core/widgets/ContextWidget.zig +++ b/core/widgets/ContextWidget.zig @@ -54,7 +54,7 @@ activePt: Point.Natural = .{}, hold: HoldState = .{}, /// It's expected to call this when `self` is `undefined` -pub fn init(self: *ContextWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *ContextWidget, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { const defaults = Options{ .name = "Context" }; self.* = .{ .wd = WidgetData.init(src, .{}, defaults.override(opts).override(.{ .rect = dvui.parentGet().data().contentRectScale().rectFromPhysical(init_opts.rect) })), diff --git a/core/widgets/DockingWidget.zig b/core/widgets/DockingWidget.zig index 67006b298..3c20608b4 100644 --- a/core/widgets/DockingWidget.zig +++ b/core/widgets/DockingWidget.zig @@ -37,7 +37,7 @@ const Dockspace = @This(); /// Verb form, same as `dvui.dockspace` upstream — here so this copy (and its tests) never reach /// dvui's own `DockingWidget`, which would be a different type with the same name. -pub fn dockspace(src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) *Dockspace { +pub fn dockspace(src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) *Dockspace { var ret = dvui.widgetAlloc(Dockspace); ret.init(src, init_opts, opts); return ret; @@ -204,7 +204,7 @@ pub const Panel = struct { }; /// It's expected to call this when `self` is `undefined` -pub fn init(self: *Dockspace, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *Dockspace, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { const defaults = Options{ .name = "Dockspace" }; self.* = .{ .wd = WidgetData.init(src, .{}, defaults.override(opts)), .init_opts = init_opts }; dvui.parentSet(self.widget()); diff --git a/core/widgets/Dropdown.zig b/core/widgets/Dropdown.zig index d34224543..ab780f5af 100644 --- a/core/widgets/Dropdown.zig +++ b/core/widgets/Dropdown.zig @@ -75,7 +75,7 @@ pub fn wrapInner(opts: Options) Options { } /// It's expected to call this when `self` is `undefined` -pub fn init(self: *Dropdown, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *Dropdown, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { const options = defaults.override(opts); self.* = .{ .options = options, diff --git a/core/widgets/FloatingTooltipWidget.zig b/core/widgets/FloatingTooltipWidget.zig index dd248d37c..39da109cd 100644 --- a/core/widgets/FloatingTooltipWidget.zig +++ b/core/widgets/FloatingTooltipWidget.zig @@ -97,7 +97,7 @@ tt_child_shown: bool = false, /// /// Use FloatingWindowWidget for a floating window that the user can change /// size, move around, and adjust stacking. -pub fn init(self: *FloatingTooltipWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts_in: Options) void { +pub fn init(self: *FloatingTooltipWidget, src: std.lang.SourceLocation, init_opts: InitOptions, opts_in: Options) void { self.* = .{ .wd = WidgetData.init(src, .{ .subwindow = true }, (Options{ .name = "FloatingTooltip" }).override(.{ // passing options.rect will stop WidgetData.init from calling diff --git a/core/widgets/FloatingWindowWidget.zig b/core/widgets/FloatingWindowWidget.zig index dcd5a52b6..9231c5540 100644 --- a/core/widgets/FloatingWindowWidget.zig +++ b/core/widgets/FloatingWindowWidget.zig @@ -211,7 +211,7 @@ auto_size_refresh_prev_value: ?u8 = null, drag_part: ?DragPart = null, drag_area: Rect.Physical = undefined, -pub fn init(self: *FloatingWindowWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *FloatingWindowWidget, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { var options = defaults.override(opts); // The default corner at the user's corner roundness (`core.corners`); a caller's own stands. if (opts.corners == null) options.corners = @import("../corners.zig").all(5); diff --git a/core/widgets/Popover.zig b/core/widgets/Popover.zig index 251f75099..08279fa60 100644 --- a/core/widgets/Popover.zig +++ b/core/widgets/Popover.zig @@ -59,7 +59,7 @@ pub const InitOptions = struct { }; /// Open (or continue) the popover. Rows go between this and `deinit`. -pub fn init(src: std.builtin.SourceLocation, init_opts: InitOptions) Popover { +pub fn init(src: std.lang.SourceLocation, init_opts: InitOptions) Popover { // Only the position is ours each frame; the size is auto-size's, animated from whatever it // was — a fresh rect grows from the anchor with the overshoot. // @@ -181,7 +181,7 @@ pub const Row = struct { /// One row: the palette's shell, inside the open popover. The caller draws the row's /// content (horizontal box) after, then `deinit`s it. Text inside inherits the popover's text colour; nothing changes on hover /// but the fill. -pub fn row(src: std.builtin.SourceLocation, opts: RowOptions) Row { +pub fn row(src: std.lang.SourceLocation, opts: RowOptions) Row { const theme = dvui.themeGet(); const box = dvui.box(src, .{ .dir = .horizontal }, .{ // Clicked like one; named by the text the caller draws in it. diff --git a/core/widgets/ReorderWidget.zig b/core/widgets/ReorderWidget.zig index b8f2f3b04..a9d068ddd 100644 --- a/core/widgets/ReorderWidget.zig +++ b/core/widgets/ReorderWidget.zig @@ -24,7 +24,7 @@ drag_ending: bool = false, reorderable_size: Size = .{}, found_slot: bool = false, -pub fn init(self: *ReorderWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *ReorderWidget, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { const defaults = Options{ .name = "Reorder" }; const wd = WidgetData.init(src, .{}, defaults.override(opts)); self.* = .{ @@ -212,7 +212,7 @@ pub const draggableInitOptions = struct { color: ?dvui.Color = null, }; -pub fn draggable(src: std.builtin.SourceLocation, init_opts: draggableInitOptions, opts: dvui.Options) ?dvui.Point.Physical { +pub fn draggable(src: std.lang.SourceLocation, init_opts: draggableInitOptions, opts: dvui.Options) ?dvui.Point.Physical { var iw: dvui.IconWidget = undefined; iw.init(src, "reorder_drag_icon", init_opts.tvg_bytes orelse dvui.entypo.menu, .{ .fill_color = .{ .color = init_opts.color }, .stroke_color = .{ .color = init_opts.color } }, opts); var ret: ?dvui.Point.Physical = null; @@ -255,7 +255,7 @@ pub fn draggable(src: std.builtin.SourceLocation, init_opts: draggableInitOption return ret; } -pub fn reorderable(self: *ReorderWidget, src: std.builtin.SourceLocation, init_opts: Reorderable.InitOptions, opts: Options) *Reorderable { +pub fn reorderable(self: *ReorderWidget, src: std.lang.SourceLocation, init_opts: Reorderable.InitOptions, opts: Options) *Reorderable { const ret = dvui.widgetAlloc(Reorderable); ret.init(src, self, init_opts, opts); ret.install(); @@ -300,7 +300,7 @@ pub const Reorderable = struct { target_rs: ?dvui.RectScale = null, target_id: ?dvui.Id = null, - pub fn init(self: *Reorderable, src: std.builtin.SourceLocation, reorder: *ReorderWidget, init_opts: Reorderable.InitOptions, opts: Options) void { + pub fn init(self: *Reorderable, src: std.lang.SourceLocation, reorder: *ReorderWidget, init_opts: Reorderable.InitOptions, opts: Options) void { const defaults = Options{ .name = "Reorderable" }; const options = defaults.override(opts); self.* = .{ diff --git a/core/widgets/Split.zig b/core/widgets/Split.zig index 522f79ac5..8a9f00aea 100644 --- a/core/widgets/Split.zig +++ b/core/widgets/Split.zig @@ -171,7 +171,7 @@ pub const Options = struct { /// verb form lives in the namespace above the type — `core.widgets.split(...)` for a plugin, /// `Layout.split(...)` for a shape — exactly as `dvui.box()` sits above `BoxWidget.init`. pub fn init( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, axis: dvui.enums.Direction, id_extra: usize, at: ?dvui.Rect, @@ -185,7 +185,7 @@ pub fn init( /// loses it in one step the frame the place is dropped. Closing it alongside costs nothing to /// grab, because there will be nothing to grab. pub fn initSized( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, axis: dvui.enums.Direction, id_extra: usize, at: ?dvui.Rect, diff --git a/core/widgets/Tabs.zig b/core/widgets/Tabs.zig index 56dc86666..29493bde5 100644 --- a/core/widgets/Tabs.zig +++ b/core/widgets/Tabs.zig @@ -58,7 +58,7 @@ inner: *dvui.BoxWidget, gap_at: f32 = 0, gap_len: f32 = 0, -pub fn init(src: std.builtin.SourceLocation, opts: Options) Tabs { +pub fn init(src: std.lang.SourceLocation, opts: Options) Tabs { const vertical = opts.dir == .vertical; const outer = dvui.box(src, .{ .dir = opts.dir }, (dvui.Options{ .expand = .none, @@ -218,7 +218,7 @@ pub fn handCursor(wd: *dvui.WidgetData) void { /// One tab, keyed by `key`. `name` is what it is called — the view's title — for a screen reader /// or a script, which a rail of icons does not otherwise show; it must outlive the frame. -pub fn tab(self: *Tabs, src: std.builtin.SourceLocation, key: usize, selected: bool, name: []const u8) Tab { +pub fn tab(self: *Tabs, src: std.lang.SourceLocation, key: usize, selected: bool, name: []const u8) Tab { const box = dvui.widgetAlloc(dvui.BoxWidget); box.init(src, .{ .dir = .horizontal }, .{ .role = .tab, @@ -243,7 +243,7 @@ pub fn tab(self: *Tabs, src: std.builtin.SourceLocation, key: usize, selected: b /// (physical) — before whichever tab is drawn next, or past the last. The carried look's drop /// slot (`dialogs.dropSlot`), seen blurred through the glass of what is carried over it: the same /// slot every strip opens. `id_extra` tells two apart in one frame. -pub fn gap(self: *Tabs, src: std.builtin.SourceLocation, len: f32, id_extra: usize) void { +pub fn gap(self: *Tabs, src: std.lang.SourceLocation, len: f32, id_extra: usize) void { const s = dvui.currentWindow().natural_scale; const vertical = self.opts.dir == .vertical; var g = dvui.box(src, .{}, .{ diff --git a/core/widgets/TreeWidget.zig b/core/widgets/TreeWidget.zig index 7f329db0a..4826262ab 100644 --- a/core/widgets/TreeWidget.zig +++ b/core/widgets/TreeWidget.zig @@ -80,7 +80,7 @@ pub const InitOptions = struct { drag_name: ?[]const u8 = null, }; -pub fn init(self: *TreeWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *TreeWidget, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { self.* = .{}; const defaults = Options{ .name = "Tree", .role = .tree }; self.init_options = init_opts; @@ -116,7 +116,7 @@ pub fn init(self: *TreeWidget, src: std.builtin.SourceLocation, init_opts: InitO } } -pub fn tree(src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) *TreeWidget { +pub fn tree(src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) *TreeWidget { var ret = dvui.widgetAlloc(TreeWidget); ret.init(src, init_opts, opts); ret.processEvents(); @@ -375,7 +375,7 @@ pub fn reorderDragActive(self: *TreeWidget) bool { return self.drag_point != null or dvui.captured(self.data().id); } -pub fn branch(self: *TreeWidget, src: std.builtin.SourceLocation, init_opts: Branch.InitOptions, opts: Options) *Branch { +pub fn branch(self: *TreeWidget, src: std.lang.SourceLocation, init_opts: Branch.InitOptions, opts: Options) *Branch { const ret = dvui.widgetAlloc(Branch); ret.init(src, self, init_opts, opts); ret.install(); @@ -463,7 +463,7 @@ pub const Branch = struct { .padding = dvui.Rect.all(2), }; - pub fn init(self: *Branch, src: std.builtin.SourceLocation, tw: *TreeWidget, init_opts: Branch.InitOptions, opts: Options) void { + pub fn init(self: *Branch, src: std.lang.SourceLocation, tw: *TreeWidget, init_opts: Branch.InitOptions, opts: Options) void { self.* = .{}; self.tree = tw; self.init_options = init_opts; @@ -744,7 +744,7 @@ pub const Branch = struct { return false; } - pub fn expander(self: *Branch, src: std.builtin.SourceLocation, init_opts: ExpanderOptions, opts: Options) bool { + pub fn expander(self: *Branch, src: std.lang.SourceLocation, init_opts: ExpanderOptions, opts: Options) bool { var clicked: bool = false; if (self.button.clicked()) { const r = self.button.data().borderRectScale().r; diff --git a/core/widgets/glass_button.zig b/core/widgets/glass_button.zig index 69a2a656f..0e4df3727 100644 --- a/core/widgets/glass_button.zig +++ b/core/widgets/glass_button.zig @@ -107,7 +107,7 @@ pub const BubbleOptions = struct { /// while it grows in) with `icon` (tvg) in it and a tooltip. Floats over whatever is drawn there, /// clipped to the screen it is on (the main window, or a float popped out of it). True on the /// frame it is clicked. -pub fn bubble(src: std.builtin.SourceLocation, rect: dvui.Rect, icon: []const u8, opts: BubbleOptions) bool { +pub fn bubble(src: std.lang.SourceLocation, rect: dvui.Rect, icon: []const u8, opts: BubbleOptions) bool { var fw: dvui.FloatingWidget = undefined; fw.init(src, .{}, .{ .rect = rect, diff --git a/core/widgets/menu/FloatingMenu.zig b/core/widgets/menu/FloatingMenu.zig index d2627a8d4..5b0de43a9 100644 --- a/core/widgets/menu/FloatingMenu.zig +++ b/core/widgets/menu/FloatingMenu.zig @@ -123,7 +123,7 @@ scaler: dvui.ScaleWidget, scroll: ScrollAreaWidget, /// It's expected to call this when `self` is `undefined` -pub fn init(self: *FloatingMenu, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *FloatingMenu, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { self.* = .{ // the widget itself doesn't have any styling, it comes from the // embedded Menu diff --git a/core/widgets/menu/Menu.zig b/core/widgets/menu/Menu.zig index 0e5f2330a..651145432 100644 --- a/core/widgets/menu/Menu.zig +++ b/core/widgets/menu/Menu.zig @@ -99,7 +99,7 @@ child_popup_rect: ?Rect.Physical = null, mouse_mode: bool = false, /// It's expected to call this when `self` is `undefined` -pub fn init(self: *Menu, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *Menu, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { self.* = Menu{ .wd = WidgetData.init(src, .{}, defaults.override(opts)), .init_opts = init_opts, diff --git a/core/widgets/menu/MenuItem.zig b/core/widgets/menu/MenuItem.zig index d87045116..00ba50b5d 100644 --- a/core/widgets/menu/MenuItem.zig +++ b/core/widgets/menu/MenuItem.zig @@ -54,7 +54,7 @@ hover_t: f32 = 0, over: bool = false, /// It's expected to call this when `self` is `undefined` -pub fn init(self: *MenuItem, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *MenuItem, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { const options = defaults.override(opts); const wd = WidgetData.init(src, .{}, options); diff --git a/core/widgets/menu/Popup.zig b/core/widgets/menu/Popup.zig index c03bfd667..5f71f86ac 100644 --- a/core/widgets/menu/Popup.zig +++ b/core/widgets/menu/Popup.zig @@ -28,7 +28,7 @@ menu: ?Menu = null, floating: FloatingMenu, /// Shows the popup and returns it while `open_flag.*` is true; null (and nothing drawn) when not. -pub fn active(self: *Popup, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: dvui.Options) ?*Popup { +pub fn active(self: *Popup, src: std.lang.SourceLocation, init_opts: InitOptions, opts: dvui.Options) ?*Popup { self.* = .{ .init_opts = init_opts, .floating = undefined, diff --git a/plugins/archive/static/integration.zig b/plugins/archive/static/integration.zig index 2d5706caa..ca51b95de 100644 --- a/plugins/archive/static/integration.zig +++ b/plugins/archive/static/integration.zig @@ -27,7 +27,7 @@ fn applyImports(module: *std.Build.Module, imports: ModuleImports) void { pub fn addStaticModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, consumer: *std.Build.Module, ) *std.Build.Module { @@ -48,7 +48,7 @@ pub fn addStaticModule( pub fn addDylib( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, ) *std.Build.Step.Compile { const created = helpers.addDylib(b, .{ diff --git a/plugins/devtools/src/Dashboard.zig b/plugins/devtools/src/Dashboard.zig index a0b1c6b42..e4e1e7e17 100644 --- a/plugins/devtools/src/Dashboard.zig +++ b/plugins/devtools/src/Dashboard.zig @@ -266,7 +266,7 @@ fn drawControls(p: *profile.Profiler) void { } /// Buttons joined into one rounded group, those `on` lit: a segmented control. The one clicked. -fn segmented(src: std.builtin.SourceLocation, labels: []const []const u8, on: []const bool) ?usize { +fn segmented(src: std.lang.SourceLocation, labels: []const []const u8, on: []const bool) ?usize { var group = dvui.box(src, .{ .dir = .horizontal }, .{ .background = true, .color_fill = .{ .color = dvui.themeGet().color(.control, .fill).opacity(0.5) }, diff --git a/plugins/devtools/static/integration.zig b/plugins/devtools/static/integration.zig index cadb6c290..83c0356aa 100644 --- a/plugins/devtools/static/integration.zig +++ b/plugins/devtools/static/integration.zig @@ -27,7 +27,7 @@ fn applyImports(module: *std.Build.Module, imports: ModuleImports) void { pub fn addStaticModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, consumer: *std.Build.Module, ) *std.Build.Module { @@ -48,7 +48,7 @@ pub fn addStaticModule( pub fn addDylib( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, ) *std.Build.Step.Compile { const created = helpers.addDylib(b, .{ diff --git a/plugins/guides/static/integration.zig b/plugins/guides/static/integration.zig index cfea50b5a..07af487f6 100644 --- a/plugins/guides/static/integration.zig +++ b/plugins/guides/static/integration.zig @@ -27,7 +27,7 @@ fn applyImports(module: *std.Build.Module, imports: ModuleImports) void { pub fn addStaticModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, consumer: *std.Build.Module, ) *std.Build.Module { @@ -48,7 +48,7 @@ pub fn addStaticModule( pub fn addDylib( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, ) *std.Build.Step.Compile { const created = helpers.addDylib(b, .{ diff --git a/plugins/image/static/integration.zig b/plugins/image/static/integration.zig index 74981c730..31c3aa534 100644 --- a/plugins/image/static/integration.zig +++ b/plugins/image/static/integration.zig @@ -29,7 +29,7 @@ fn applyImports(module: *std.Build.Module, imports: ModuleImports) void { pub fn addStaticModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, consumer: *std.Build.Module, ) *std.Build.Module { @@ -50,7 +50,7 @@ pub fn addStaticModule( pub fn addDylib( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, ) *std.Build.Step.Compile { const created = helpers.addDylib(b, .{ diff --git a/plugins/markdown/build.zig b/plugins/markdown/build.zig index 5f9b2d771..5c2367c2d 100644 --- a/plugins/markdown/build.zig +++ b/plugins/markdown/build.zig @@ -39,7 +39,7 @@ pub fn build(b: *std.Build) void { fn md4zigModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, ) *std.Build.Module { return b.dependency("md4zig", .{ .target = target, diff --git a/plugins/markdown/src/md/render_ast.zig b/plugins/markdown/src/md/render_ast.zig index c381880e1..adf335267 100644 --- a/plugins/markdown/src/md/render_ast.zig +++ b/plugins/markdown/src/md/render_ast.zig @@ -232,14 +232,14 @@ inline fn statBlock() void { } /// `dvui.textLayout` + the counters, so no call site can add one without the others. -inline fn textLayout(src: std.builtin.SourceLocation, init_opts: dvui.TextLayoutWidget.InitOptions, opts: dvui.Options) *dvui.TextLayoutWidget { +inline fn textLayout(src: std.lang.SourceLocation, init_opts: dvui.TextLayoutWidget.InitOptions, opts: dvui.Options) *dvui.TextLayoutWidget { stats.text_layouts += 1; const tl = dvui.textLayout(src, init_opts, opts); if (init_opts.break_lines and dvui.firstFrame(tl.data().id)) stats.fresh_text_layouts += 1; return tl; } -inline fn box(src: std.builtin.SourceLocation, init_opts: dvui.BoxWidget.InitOptions, opts: dvui.Options) *dvui.BoxWidget { +inline fn box(src: std.lang.SourceLocation, init_opts: dvui.BoxWidget.InitOptions, opts: dvui.Options) *dvui.BoxWidget { stats.boxes += 1; return dvui.box(src, init_opts, opts); } diff --git a/plugins/markdown/static/integration.zig b/plugins/markdown/static/integration.zig index 45099396b..5ab060d50 100644 --- a/plugins/markdown/static/integration.zig +++ b/plugins/markdown/static/integration.zig @@ -28,7 +28,7 @@ fn applyImports(module: *std.Build.Module, imports: ModuleImports) void { pub fn addMd4zig( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, module: *std.Build.Module, ) void { module.addImport("md4zig", b.dependency("md4zig", .{ @@ -40,7 +40,7 @@ pub fn addMd4zig( pub fn addStaticModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, consumer: *std.Build.Module, ) *std.Build.Module { @@ -61,7 +61,7 @@ pub fn addStaticModule( pub fn addDylib( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, ) *std.Build.Step.Compile { const created = helpers.addDylib(b, .{ diff --git a/plugins/shared/build/helpers.zig b/plugins/shared/build/helpers.zig index 723fddd1a..9c5ca7473 100644 --- a/plugins/shared/build/helpers.zig +++ b/plugins/shared/build/helpers.zig @@ -133,7 +133,7 @@ pub const StaticModuleOptions = struct { /// The plugin's root `plugin.zig` (module root — no more `<name>.zig` hub). root_source_file: std.Build.LazyPath, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, options_name: ?[]const u8 = null, options: ?*std.Build.Step.Options = null, }; @@ -171,7 +171,7 @@ pub const DylibOptions = struct { /// module instance the caller also imports onto `plugin_impl` (see `Created.module`). sdk: *std.Build.Module, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, options_name: ?[]const u8 = null, options: ?*std.Build.Step.Options = null, }; @@ -198,7 +198,7 @@ pub const Created = struct { fn generatedDylibRoot( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, sdk_mod: *std.Build.Module, plugin_impl: *std.Build.Module, ) *std.Build.Module { diff --git a/plugins/text/src/widgets/TextEntryWidget.zig b/plugins/text/src/widgets/TextEntryWidget.zig index 7bad9e4f3..e1a12f73b 100644 --- a/plugins/text/src/widgets/TextEntryWidget.zig +++ b/plugins/text/src/widgets/TextEntryWidget.zig @@ -497,7 +497,7 @@ text_changed_added: i64 = 0, // bytes added edited_outside_last_frame: *bool = undefined, /// It's expected to call this when `self` is `undefined` -pub fn init(self: *TextEntryWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void { +pub fn init(self: *TextEntryWidget, src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) void { var scroll_init_opts = ScrollAreaWidget.InitOpts{ .vertical = if (init_opts.scroll_vertical orelse init_opts.multiline) .auto else .none, .vertical_bar = init_opts.scroll_vertical_bar orelse .auto, @@ -2394,7 +2394,7 @@ pub fn deinit(self: *TextEntryWidget) void { } /// Same lifecycle as `dvui.textEntry`. -pub fn textEntry(src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) *TextEntryWidget { +pub fn textEntry(src: std.lang.SourceLocation, init_opts: InitOptions, opts: Options) *TextEntryWidget { var ret = dvui.widgetAlloc(TextEntryWidget); ret.init(src, init_opts, opts); ret.processEvents(); diff --git a/plugins/text/src/widgets/TooltipWidget.zig b/plugins/text/src/widgets/TooltipWidget.zig index fc4ea3712..6652ca229 100644 --- a/plugins/text/src/widgets/TooltipWidget.zig +++ b/plugins/text/src/widgets/TooltipWidget.zig @@ -106,7 +106,7 @@ mouse_good_this_frame: bool = false, installed: bool = false, /// It's expected to call this when `self` is `undefined`. -pub fn init(self: *TooltipWidget, src: std.builtin.SourceLocation, init_opts: InitOptions) void { +pub fn init(self: *TooltipWidget, src: std.lang.SourceLocation, init_opts: InitOptions) void { // No surface of its own: `install` lays down fizzy's floating surface // (`core.dialogs.tooltipSurface`) — frosted like the dialogs, menus and every other tooltip. const options: dvui.Options = core.dialogs.tooltipOptions(@intCast(init_opts.id_extra)).override(.{ diff --git a/plugins/text/static/integration.zig b/plugins/text/static/integration.zig index 1f1c836c6..fa1631ff6 100644 --- a/plugins/text/static/integration.zig +++ b/plugins/text/static/integration.zig @@ -29,7 +29,7 @@ fn applyImports(module: *std.Build.Module, imports: ModuleImports) void { pub fn addStaticModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, consumer: *std.Build.Module, ) *std.Build.Module { @@ -50,7 +50,7 @@ pub fn addStaticModule( pub fn addDylib( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, ) *std.Build.Step.Compile { const created = helpers.addDylib(b, .{ diff --git a/plugins/workbench/static/integration.zig b/plugins/workbench/static/integration.zig index 600f5ac43..cfd561332 100644 --- a/plugins/workbench/static/integration.zig +++ b/plugins/workbench/static/integration.zig @@ -30,7 +30,7 @@ fn applyImports(module: *std.Build.Module, imports: ModuleImports) void { pub fn addStaticModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, workbench_opts: *std.Build.Step.Options, consumer: *std.Build.Module, @@ -53,7 +53,7 @@ pub fn addStaticModule( pub fn addDylib( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, imports: ModuleImports, workbench_opts: *std.Build.Step.Options, ) *std.Build.Step.Compile { diff --git a/sdk/core_module.zig b/sdk/core_module.zig index 04618dd22..3ae03e8ff 100644 --- a/sdk/core_module.zig +++ b/sdk/core_module.zig @@ -33,7 +33,7 @@ pub fn addImports( dvui_mod: *std.Build.Module, sdk_pkg: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, glass_look: ?*std.Build.Module, glass: ?*std.Build.Module, ) ?*std.Build.Module { @@ -85,7 +85,7 @@ pub fn repoPath(b: *std.Build, sub_path: []const u8) std.Build.LazyPath { pub fn zfModule( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, ) *std.Build.Module { return b.dependency("zf", .{ .target = target, diff --git a/sdk/plugin_sdk.zig b/sdk/plugin_sdk.zig index 5c59ed415..97312162c 100644 --- a/sdk/plugin_sdk.zig +++ b/sdk/plugin_sdk.zig @@ -47,12 +47,12 @@ pub const Modules = struct { pub const ModulesOptions = struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, }; pub const ModuleOptions = struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, root_source_file: std.Build.LazyPath, link_libc: bool = true, }; @@ -387,7 +387,7 @@ pub const CSourceFile = struct { pub const CModuleOptions = struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, /// Zig bindings root (e.g. `zstbi.zig`). root_source_file: std.Build.LazyPath, /// C translation units compiled into the module. @@ -418,7 +418,7 @@ pub fn addCModule(b: *std.Build, opts: CModuleOptions) *std.Build.Module { pub const CreateOptions = struct { target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, link_libc: bool = true, /// Override the author's module root — defaults to `b.path("plugin.zig")`. Only for edge /// cases (e.g. a built-in whose author-facing file doesn't sit at the plugin's repo root). @@ -458,7 +458,7 @@ pub const PluginArtifact = struct { fn generatedDylibRoot( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, sdk_mod: *std.Build.Module, plugin_mod: *std.Build.Module, ) *std.Build.Module { @@ -562,7 +562,7 @@ pub fn create(b: *std.Build, opts: CreateOptions) PluginArtifact { pub fn exportModules( b: *std.Build, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, ) !void { // A wasm side module has no libc and no C libraries of its own: fonts and images are the // host's (rendered through the bridge), and the web has no tree-sitter to run. diff --git a/sdk/replay/overlay.zig b/sdk/replay/overlay.zig index 96e42f6fb..775266f80 100644 --- a/sdk/replay/overlay.zig +++ b/sdk/replay/overlay.zig @@ -63,7 +63,7 @@ fn pointerRect(p: Sequencer.Point) dvui.Rect { /// A floating widget that takes no input, raised to the top. A floating widget otherwise stays /// just above the window it was made in, under anything opened after it; re-added as a subwindow /// of its own it can be raised, and each call puts the new one above the last. -pub fn layer(src: std.builtin.SourceLocation, opts: dvui.Options, init: dvui.FloatingWidget.InitOptions) *dvui.FloatingWidget { +pub fn layer(src: std.lang.SourceLocation, opts: dvui.Options, init: dvui.FloatingWidget.InitOptions) *dvui.FloatingWidget { var init_opts = init; init_opts.mouse_events = false; const fw = dvui.widgetAlloc(dvui.FloatingWidget); diff --git a/sdk/replay_module.zig b/sdk/replay_module.zig index 508921ff4..2304ba916 100644 --- a/sdk/replay_module.zig +++ b/sdk/replay_module.zig @@ -32,7 +32,7 @@ pub fn modules( sdk_pkg: *std.Build, dvui_mod: *std.Build.Module, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, ) Modules { const tape = b.createModule(.{ .target = target, diff --git a/sdk/src/fingerprint.zig b/sdk/src/fingerprint.zig index b30c159fa..2a054ac70 100644 --- a/sdk/src/fingerprint.zig +++ b/sdk/src/fingerprint.zig @@ -159,7 +159,7 @@ pub fn hashAllShape(h_in: u64, comptime types: anytype, comptime depth: comptime } } -/// `callconv(.c)` is sugar for `std.builtin.CallingConvention.c`, which is itself +/// `callconv(.c)` is sugar for `std.lang.CallingConvention.c`, which is itself /// `builtin.target.cCallingConvention().?` — a *concrete*, target-specific tag (e.g. /// `.x86_64_sysv` on Linux/macOS x86_64, `.x86_64_win` on Windows, `.aarch64_aapcs_darwin` on /// Apple aarch64). So two hook signatures declared identically as `callconv(.c)` report @@ -167,8 +167,8 @@ pub fn hashAllShape(h_in: u64, comptime types: anytype, comptime depth: comptime /// target-specificity `hashTypeShape` exists to ignore. Canonicalize that one case back to a /// single key; every other calling convention (`.auto`, `.naked`, `.@"inline"`, ...) is already /// target-invariant and is hashed as-is. -fn callingConventionShapeKey(cc: std.builtin.CallingConvention) u64 { - if (std.meta.eql(cc, std.builtin.CallingConvention.c)) return 0; +fn callingConventionShapeKey(cc: std.lang.CallingConvention) u64 { + if (std.meta.eql(cc, std.lang.CallingConvention.c)) return 0; return 1 + @backingInt(std.meta.activeTag(cc)); } diff --git a/sdk/src/menu.zig b/sdk/src/menu.zig index 280cbb27b..a8ec151ea 100644 --- a/sdk/src/menu.zig +++ b/sdk/src/menu.zig @@ -4,7 +4,7 @@ const std = @import("std"); const dvui = @import("dvui"); pub fn menuItem( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, label_str: []const u8, init_opts: dvui.MenuItemWidget.InitOptions, opts: dvui.Options, @@ -23,7 +23,7 @@ pub fn menuItem( } pub fn menuItemWithChevron( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, label_str: []const u8, init_opts: dvui.MenuItemWidget.InitOptions, opts: dvui.Options, @@ -54,7 +54,7 @@ pub fn menuItemWithChevron( } pub fn submenu( - src: std.builtin.SourceLocation, + src: std.lang.SourceLocation, label_str: []const u8, opts: dvui.Options, draw_body: *const fn () anyerror!void, diff --git a/src/editor/Menu.zig b/src/editor/Menu.zig index 12496fde6..34ab61f29 100644 --- a/src/editor/Menu.zig +++ b/src/editor/Menu.zig @@ -83,7 +83,7 @@ const chrome = fizzy.core.dialogs; /// then blur, then its own translucent fill, and dvui's floating menu paints its background /// inside `init` where nothing outside can get in front of it. See /// `core/widgets/menu/FloatingMenu.zig`. -fn menuPopup(src: std.builtin.SourceLocation, from: dvui.Rect.Natural, id_extra: usize) *widgets.FloatingMenuWidget { +fn menuPopup(src: std.lang.SourceLocation, from: dvui.Rect.Natural, id_extra: usize) *widgets.FloatingMenuWidget { return widgets.floatingMenu(src, .{ .from = from, .frost = widgets.menuFrost() }, widgets.menuSurfaceOptions().override(.{ .id_extra = id_extra, })); @@ -237,7 +237,7 @@ fn drawRecentFolders(editor: *Editor, id_extra: usize) !void { } } -pub fn menuItem(src: std.builtin.SourceLocation, label_str: []const u8, init_opts: widgets.MenuItemWidget.InitOptions, opts: dvui.Options) ?dvui.Rect.Natural { +pub fn menuItem(src: std.lang.SourceLocation, label_str: []const u8, init_opts: widgets.MenuItemWidget.InitOptions, opts: dvui.Options) ?dvui.Rect.Natural { var mi = widgets.menuItem(src, init_opts, rowOptions(opts)); fizzy.core.anchor.mark(mi.data(), "fizzy.menu:{s}", .{label_str}); diff --git a/src/editor/OutputPanel.zig b/src/editor/OutputPanel.zig index b5aa60ae7..400dd59f9 100644 --- a/src/editor/OutputPanel.zig +++ b/src/editor/OutputPanel.zig @@ -217,7 +217,7 @@ fn drawTabStrip(scopes: []const []const u8) void { } } -fn drawTab(src: std.builtin.SourceLocation, label: []const u8, id_extra: usize, selected: bool) void { +fn drawTab(src: std.lang.SourceLocation, label: []const u8, id_extra: usize, selected: bool) void { const clicked = dvui.button(src, label, .{}, .{ .id_extra = id_extra, .expand = .horizontal, diff --git a/src/editor/dialogs/SaveQuestion.zig b/src/editor/dialogs/SaveQuestion.zig index e8ec78a53..e8451bcfa 100644 --- a/src/editor/dialogs/SaveQuestion.zig +++ b/src/editor/dialogs/SaveQuestion.zig @@ -70,7 +70,7 @@ pub fn request(doc_id: u64, q: sdk.Plugin.SaveQuestion, then: Then) void { pub fn callAfter(_: dvui.Id, _: dvui.enums.DialogResponse) !void {} -fn button(src: std.builtin.SourceLocation, label_text: []const u8, style: dvui.Theme.Style.Name, tab_idx: u16, id_extra: usize) bool { +fn button(src: std.lang.SourceLocation, label_text: []const u8, style: dvui.Theme.Style.Name, tab_idx: u16, id_extra: usize) bool { const opts: dvui.Options = .{ .tab_index = tab_idx, .style = style, diff --git a/src/editor/explorer/settings.zig b/src/editor/explorer/settings.zig index 7308514bf..84e1d7190 100644 --- a/src/editor/explorer/settings.zig +++ b/src/editor/explorer/settings.zig @@ -443,7 +443,7 @@ fn drawTheme() void { /// The four font sliders differ only in which settings field they drive, so they share one body. /// Format is value-only — `SettingsTree` draws the setting name above the control. -fn fontSizeSlider(src: std.builtin.SourceLocation, value: *f32) void { +fn fontSizeSlider(src: std.lang.SourceLocation, value: *f32) void { if (dvui.sliderEntry(src, "{d:0.0}", .{ .value = value, .interval = 1.0, @@ -488,7 +488,7 @@ fn drawWindowOpacity() void { } /// Names under a slider, each at its place along it (0 the left end, 1 the right). -fn sliderMarks(src: std.builtin.SourceLocation, names: []const []const u8, at: []const f32) void { +fn sliderMarks(src: std.lang.SourceLocation, names: []const []const u8, at: []const f32) void { var row = dvui.overlay(src, .{ .expand = .horizontal }); defer row.deinit(); const text = dvui.themeGet().color(.control, .text).opacity(0.6);