Skip to content

Commit

Permalink
src -> wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
psnszsn committed Jun 28, 2024
1 parent c0331d7 commit 2d73e98
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 59 deletions.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void {
const libxev = b.dependency("libxev", .{}).module("xev");

const wayland = b.addModule("wayland", .{
.root_source_file = b.path("./src/lib.zig"),
.root_source_file = b.path("./wayland/lib.zig"),
.imports = &.{
.{ .name = "xev", .module = libxev },
},
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// vi: ft=zig
.{
.name = "zoinx",
.name = "way-z",
.version = "0.0.0",
.paths = .{""},
.dependencies = .{
Expand Down
4 changes: 2 additions & 2 deletions examples/hello.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const SurfaceCtx = struct {
wl_surface: wl.Surface,
xdg_surface: xdg.Surface,
xdg_toplevel: xdg.Toplevel,
width: u32,
height: u32,
width: u31,
height: u31,
offset: f32,
last_frame: u32,
};
Expand Down
4 changes: 2 additions & 2 deletions examples/kb_grab.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const SurfaceCtx = struct {
wl_surface: wl.Surface,
layer_surface: wayland.zwlr.LayerSurfaceV1,
shortcut_inhibitor: zwp.KeyboardShortcutsInhibitorV1,
width: u32,
height: u32,
width: u31,
height: u31,
offset: f32,
last_frame: u32,
};
Expand Down
7 changes: 4 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ Native Zig Wayland client library and widget toolkit
## Description

This project has a few different parts:
- Wayland client library (in `src/`): This can be used to crate a statically linked binary capable of displaying CPU rendered graphics.
- Widget toolkit (in `toolkit/`): This builds over the wayland client and povides a Data Oriented library for creating GUI apps
- Apps (in `apps/`): Demo apps built using the widget toolkit

- Wayland client library (in `wayland/`): This can be used to crate a statically linked binary capable of displaying CPU rendered graphics.
- Widget toolkit (in `toolkit/`): This builds over the wayland client and povides a Data Oriented library for creating GUI apps
- Apps (in `apps/`): Demo apps built using the widget toolkit

## Getting Started

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
184 changes: 139 additions & 45 deletions src/generated/wl.zig → wayland/generated/wl.zig

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/generated/wp.zig → wayland/generated/wp.zig
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ pub const CursorShapeManagerV1 = enum(u32) {
};
};

/// This interface advertises the list of supported cursor shapes for a
/// device, and allows clients to set the cursor shape.
/// This interface allows clients to set the cursor shape.
pub const CursorShapeDeviceV1 = enum(u32) {
_,
pub const interface = Interface{
Expand Down
2 changes: 1 addition & 1 deletion src/generated/xdg.zig → wayland/generated/xdg.zig
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub const Positioner = enum(u32) {
///
/// The default adjustment is none.
set_constraint_adjustment: struct {
constraint_adjustment: u32, // bit mask of constraint adjustments
constraint_adjustment: ConstraintAdjustment, // bit mask of constraint adjustments
},
/// Specify the surface position offset relative to the position of the
/// anchor on the anchor rectangle and the anchor on the surface. For
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions scanner.py → wayland/scanner.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# pyright: strict
# TODO: Use ZigEtc everywhere

Expand Down Expand Up @@ -781,13 +782,14 @@ def emit(self, fd: TextIO):
const {g} = @import("{g}.zig");"""
)

script_dir = Path(__file__).parent

def main():
global protocols
xml_protocols = [
"/usr/share/wayland/wayland.xml",
"/usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml",
"./protocols/wlr-layer-shell-unstable-v1.xml",
script_dir / "./protocols/wlr-layer-shell-unstable-v1.xml",
"/usr/share/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml",
"/usr/share/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml",
"/usr/share/wayland-protocols/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml",
Expand All @@ -799,7 +801,7 @@ def main():
Namespace.get(p.prefix).protocols.append(p)

for ns in Namespace.instances.values():
out = Path(__file__).parent / f"src/generated/{ns.name}.zig"
out = script_dir / f"generated/{ns.name}.zig"
out.parent.mkdir(exist_ok=True)
with out.open("w") as f:
ns.emit(f)
Expand Down
File renamed without changes.

0 comments on commit 2d73e98

Please sign in to comment.