Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmstill committed Mar 4, 2024
1 parent abd08e4 commit 3e7e3e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {
exe.linkSystemLibrary("c");
exe.linkSystemLibrary("gl");
exe.linkSystemLibrary("xkbcommon");
exe.linkSystemLibrary("xkbcommon-x11");
// exe.linkSystemLibrary("xkbcommon-x11");
exe.linkSystemLibrary("libsystemd");
exe.linkSystemLibrary("libudev");
exe.linkSystemLibrary("libinput");
Expand Down
3 changes: 2 additions & 1 deletion src/client.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,8 @@ pub const Client = struct {
client.unregister(.{ .xdg_popup = msg.xdg_popup });
},
.grab => |_| {
unreachable;
// unreachable;
log.warn(".grab not implemented", .{});
},
.reposition => |_| unreachable,
}
Expand Down
2 changes: 1 addition & 1 deletion src/resource/rectangle.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub const Rectangle = struct {
height: i32,

pub fn init(x: i32, y: i32, width: i32, height: i32) Rectangle {
return Rectangle{
return .{
.x = x,
.y = y,
.width = width,
Expand Down
12 changes: 7 additions & 5 deletions src/resource/region.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@ const wl = @import("../client.zig").wl;
pub const Region = struct {
client: *Client,
wl_region: wl.WlRegion,
rectangles: RectangleBuffer = RectangleBuffer.init(),
window: ?*Window = null,
rectangles: RectangleBuffer,
window: ?*Window,

const Self = @This();

pub fn init(client: *Client, wl_region: wl.WlRegion) Region {
return Region{
return .{
.client = client,
.wl_region = wl_region,
.rectangles = RectangleBuffer.init(),
.window = null,
};
}

pub fn pointInside(self: *Self, local_x: f64, local_y: f64) bool {
const slice = self.rectangles.readableSlice(0);
pub fn pointInside(region: *Region, local_x: f64, local_y: f64) bool {
const slice = region.rectangles.readableSlice(0);
for (slice) |rect| {
const left: f64 = @floatFromInt(rect.rectangle.x);
const right = left + @as(f64, @floatFromInt(rect.rectangle.width));
Expand Down

0 comments on commit 3e7e3e0

Please sign in to comment.