massively removed a lot of dead code
This commit is contained in:
parent
0231794f5b
commit
019d08cbfc
|
|
@ -146,8 +146,8 @@ must arrange its runtime location/rpath.
|
||||||
|
|
||||||
## C interface
|
## C interface
|
||||||
|
|
||||||
- [Introduction and complete API reference](index.html): a self-contained webpage
|
- Guide and API reference: the full repository generates them from `uhdk.h`
|
||||||
covering the types, functions, and contracts in `uhdk.h`.
|
with `zig build docs-uhdk` (into `build/docs/uhdk/`).
|
||||||
- [uhdk.h](include/uhdk.h): desktop API, lifecycle, ownership, and threading contracts.
|
- [uhdk.h](include/uhdk.h): desktop API, lifecycle, ownership, and threading contracts.
|
||||||
- [OPENGL-SOURCES.md](include/OPENGL-SOURCES.md): GLAD generation recipe and Khronos header provenance and licenses.
|
- [OPENGL-SOURCES.md](include/OPENGL-SOURCES.md): GLAD generation recipe and Khronos header provenance and licenses.
|
||||||
|
|
||||||
|
|
|
||||||
102
src/arenas.zig
102
src/arenas.zig
|
|
@ -140,24 +140,6 @@ pub const BumpArena = struct {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
test "bump arena initialization" {
|
|
||||||
var arena = try BumpArena.init(std.testing.allocator, std.testing.io);
|
|
||||||
defer arena.deinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
test "reset clears usage" {
|
|
||||||
var arena = try BumpArena.init(std.testing.allocator, std.testing.io);
|
|
||||||
defer arena.deinit();
|
|
||||||
|
|
||||||
const allocator = arena.allocator();
|
|
||||||
const mem = allocator.alloc(u8, 128) catch unreachable;
|
|
||||||
defer _ = mem;
|
|
||||||
|
|
||||||
try std.testing.expect(arena.usage() >= 128);
|
|
||||||
arena.reset();
|
|
||||||
try std.testing.expectEqual(@as(usize, 0), arena.usage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// it's like an normal vector/ arraylist except it never invalidates old pointers.
|
// it's like an normal vector/ arraylist except it never invalidates old pointers.
|
||||||
// and never causes re-allocations. (excepting in the control block, which is just a vector of things)
|
// and never causes re-allocations. (excepting in the control block, which is just a vector of things)
|
||||||
//
|
//
|
||||||
|
|
@ -306,77 +288,6 @@ pub fn PagedVectorAdvanced(comptime T: type, comptime growth: usize) type {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn PagedVectorUnmanaged(comptime T: type) type {
|
|
||||||
return PagedVectorAdvanced(T, 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn PagedVector(comptime T: type) type {
|
|
||||||
return struct {
|
|
||||||
const VectorType = PagedVectorAdvanced(T, 1024);
|
|
||||||
|
|
||||||
vector: VectorType,
|
|
||||||
allocator: std.mem.Allocator,
|
|
||||||
|
|
||||||
pub fn init(allocator: std.mem.Allocator) !@This() {
|
|
||||||
return .{
|
|
||||||
.vector = try VectorType.init(allocator),
|
|
||||||
.allocator = allocator,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deinit(self: *@This()) void {
|
|
||||||
self.vector.deinit(self.allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn appendSlice(self: *@This(), slice: []const T) !void {
|
|
||||||
try self.vector.appendSlice(self.allocator, slice);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn append(self: *@This(), value: T) !void {
|
|
||||||
try self.vector.append(self.allocator, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn appendAndGet(self: *@This(), value: T) !*T {
|
|
||||||
const index = self.len();
|
|
||||||
try self.append(value);
|
|
||||||
return self.getMutable(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get(self: *const @This(), index: usize) *const T {
|
|
||||||
return self.vector.get(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn getMutable(self: *@This(), index: usize) *T {
|
|
||||||
return self.vector.getMutable(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn len(self: @This()) usize {
|
|
||||||
return self.vector.len();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn capacity(self: @This()) usize {
|
|
||||||
return self.vector.capacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn getStatistics(self: *const @This()) PoolStatistics {
|
|
||||||
return self.vector.getStatistics();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn swapRemove(self: *@This(), index: usize) void {
|
|
||||||
self.vector.swapRemove(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reset(self: *@This()) void {
|
|
||||||
self.vector.reset(self.allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
// // retrieves a value, shrinking length by 1
|
|
||||||
pub fn pop(self: *@This()) !T {
|
|
||||||
return try self.vector.pop();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
test "simple loading multiple pages." {
|
test "simple loading multiple pages." {
|
||||||
const TestStruct = struct {
|
const TestStruct = struct {
|
||||||
lmao: usize,
|
lmao: usize,
|
||||||
|
|
@ -440,19 +351,6 @@ test "simple loading multiple pages." {
|
||||||
std.debug.assert(vector.len() == 128 + 1024 * 5 - 4 - 1024);
|
std.debug.assert(vector.len() == 128 + 1024 * 5 - 4 - 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
test "managed version" {
|
|
||||||
const allocator = std.testing.allocator;
|
|
||||||
|
|
||||||
var vec = try PagedVector(struct { lmao: u64 }).init(allocator);
|
|
||||||
defer vec.deinit();
|
|
||||||
|
|
||||||
for (0..8192) |i| {
|
|
||||||
try vec.append(.{ .lmao = i });
|
|
||||||
}
|
|
||||||
|
|
||||||
std.debug.assert(vec.vector.pages.items.len == 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
test "reset retains pages and clears length" {
|
test "reset retains pages and clears length" {
|
||||||
const allocator = std.testing.allocator;
|
const allocator = std.testing.allocator;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,60 @@ NixOS with Plasma 6.5.6 and Mesa 25.2.6; other systems are not runtime-qualified
|
||||||
children. Queue overflow requests a rescan; lost roots are invalidated. Each
|
children. Queue overflow requests a rescan; lost roots are invalidated. Each
|
||||||
watch owns an inotify descriptor and is subject to the host's instance limits.
|
watch owns an inotify descriptor and is subject to the host's instance limits.
|
||||||
|
|
||||||
|
## Not yet implemented
|
||||||
|
|
||||||
|
Release readiness is the first supported Linux milestone; until then the backend
|
||||||
|
remains a preview. The remaining milestones, in order:
|
||||||
|
|
||||||
|
- Release readiness: run the identical portable artifact on at least two clean
|
||||||
|
non-Nix Plasma distributions, for example a Kubuntu LTS and Fedora KDE, without
|
||||||
|
the Nix shell. Check launch, graphics, clipboard and portal dialogs rather than
|
||||||
|
linkage alone, and confirm native NixOS launches outside `nix-shell`. Report
|
||||||
|
unverified IME, fractional-scale or hardware cases separately. Shared builds
|
||||||
|
limit exports with `exports.map`, but no Linux check compares them with the
|
||||||
|
public header yet.
|
||||||
|
- Other Wayland desktops: test GNOME, Sway and Hyprland with their portal and IME
|
||||||
|
setups and broaden GPU coverage, including NVIDIA. Compositors without
|
||||||
|
server-side decorations need a libdecor adapter that owns toplevel role
|
||||||
|
creation, because libdecor cannot wrap an independently created `xdg_toplevel`.
|
||||||
|
Compositors without cursor-shape-v1 need a `libwayland-cursor.so.0` theme
|
||||||
|
fallback. These fallbacks must work before those desktops are claimed.
|
||||||
|
- X11: add `src/linux/x11/`, reuse the portal, file, watch and keyboard code, and
|
||||||
|
choose EGL or GLX from its own driver matrix. `AUTO` may then try X11 after
|
||||||
|
Wayland startup fails; explicit preferences never fall back. Backend-selection
|
||||||
|
and Xorg/XWayland tests arrive with it. Until then builds contain no X11
|
||||||
|
sources or dependencies.
|
||||||
|
|
||||||
|
## Tradeoffs
|
||||||
|
|
||||||
|
- Runtime verification concentrates on one Plasma Wayland session. Behavior
|
||||||
|
follows advertised standard protocols and services, with KDE-specific adapters
|
||||||
|
optional, which keeps GNOME and wlroots compositors reachable; those desktops
|
||||||
|
and X11 remain follow-on support rather than advertised parity.
|
||||||
|
- Graphics use EGL on Wayland only, which matches the observed driver stack. X11
|
||||||
|
graphics choices remain open.
|
||||||
|
- Zig owns state machines, allocations and lifetimes; C is limited to generated
|
||||||
|
protocol code and the small `libraries.c` loader. This costs more binding work
|
||||||
|
than a large C bridge but keeps lifetime and test logic in the library's
|
||||||
|
primary language.
|
||||||
|
- Vendored ABI headers and runtime-loaded host libraries give clone-and-build
|
||||||
|
with Zig alone. UHDK maintains small loaders and a declared runtime baseline
|
||||||
|
instead of library implementations; host libraries, drivers and loader
|
||||||
|
compatibility still need validation on each target.
|
||||||
|
- Server-side decorations avoid a libdecor dependency on KWin; compositors without
|
||||||
|
them need the adapter above. Library-drawn decorations would add rendering, hit
|
||||||
|
testing, move/resize and accessibility responsibilities.
|
||||||
|
- Portals share one asynchronous integration and the sandbox path but depend on
|
||||||
|
installed portal services. Toolkit dialogs would add dependencies and
|
||||||
|
event-loop complexity.
|
||||||
|
- Global-menu export neither guarantees a visible consumer nor supplies context
|
||||||
|
menus. Accelerators therefore work without a consumer, and context menus use
|
||||||
|
the internal renderer: no toolkit or font library, but no theme matching,
|
||||||
|
complex text shaping or accessibility tree.
|
||||||
|
- XKB composition gives basic typing without an input method; text-input-v3 adds
|
||||||
|
protocol, range, ordering and interoperability work. `UHDK_CAP_TEXT_INPUT`
|
||||||
|
reports keyboard text entry, not a working input method.
|
||||||
|
|
||||||
## Validation
|
## Validation
|
||||||
|
|
||||||
From the package directory:
|
From the package directory:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue