Skip to content

Commit

Permalink
code: update to wlroots 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ifreund committed Jun 23, 2021
1 parent d3a9e96 commit 41874b4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ installed:
- [zig](https://ziglang.org/download/) 0.8.0
- wayland
- wayland-protocols
- [wlroots](https://github.com/swaywm/wlroots) 0.13.0
- [wlroots](https://github.com/swaywm/wlroots) 0.14.0
- xkbcommon
- libevdev
- pixman
Expand Down
5 changes: 1 addition & 4 deletions river/DragIcon.zig
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ pub fn init(drag_icon: *DragIcon, seat: *Seat, wlr_drag_icon: *wlr.Drag.Icon) vo
wlr_drag_icon.events.unmap.add(&drag_icon.unmap);
wlr_drag_icon.surface.events.new_subsurface.add(&drag_icon.new_subsurface);

// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = wlr_drag_icon.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, .{ .drag_icon = drag_icon });
Subsurface.handleExisting(wlr_drag_icon.surface, .{ .drag_icon = drag_icon });
}

fn handleDestroy(listener: *wl.Listener(*wlr.Drag.Icon), wlr_drag_icon: *wlr.Drag.Icon) void {
Expand Down
5 changes: 1 addition & 4 deletions river/LayerSurface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ pub fn init(self: *Self, output: *Output, wlr_layer_surface: *wlr.LayerSurfaceV1
// we do want our listener called in order to send the initial configure.
handleCommit(&self.commit, wlr_layer_surface.surface);

// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = wlr_layer_surface.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, .{ .layer_surface = self });
Subsurface.handleExisting(wlr_layer_surface.surface, .{ .layer_surface = self });
}

fn handleDestroy(listener: *wl.Listener(*wlr.LayerSurfaceV1), wlr_layer_surface: *wlr.LayerSurfaceV1) void {
Expand Down
16 changes: 12 additions & 4 deletions river/Subsurface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,18 @@ pub fn create(wlr_subsurface: *wlr.Subsurface, parent: Parent) void {
wlr_subsurface.events.unmap.add(&subsurface.unmap);
wlr_subsurface.surface.events.new_subsurface.add(&subsurface.new_subsurface);

// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = wlr_subsurface.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, parent);
Subsurface.handleExisting(wlr_subsurface.surface, parent);
}

/// Create Subsurface structs to track subsurfaces already present on the
/// given surface when river becomes aware of the surface as we won't
/// recieve a new_subsurface event for them.
pub fn handleExisting(surface: *wlr.Surface, parent: Parent) void {
var below_it = surface.subsurfaces_below.iterator(.forward);
while (below_it.next()) |s| Subsurface.create(s, parent);

var above_it = surface.subsurfaces_above.iterator(.forward);
while (above_it.next()) |s| Subsurface.create(s, parent);
}

fn handleDestroy(listener: *wl.Listener(*wlr.Subsurface), wlr_subsurface: *wlr.Subsurface) void {
Expand Down
5 changes: 1 addition & 4 deletions river/XdgPopup.zig
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ pub fn create(wlr_xdg_popup: *wlr.XdgPopup, parent: Parent) void {
wlr_xdg_popup.base.events.new_popup.add(&self.new_popup);
wlr_xdg_popup.base.surface.events.new_subsurface.add(&self.new_subsurface);

// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = wlr_xdg_popup.base.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, parent);
Subsurface.handleExisting(wlr_xdg_popup.base.surface, parent);
}

fn handleDestroy(listener: *wl.Listener(*wlr.XdgSurface), wlr_xdg_surface: *wlr.XdgSurface) void {
Expand Down
5 changes: 1 addition & 4 deletions river/XdgToplevel.zig
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ pub fn init(self: *Self, view: *View, xdg_surface: *wlr.XdgSurface) void {
xdg_surface.events.new_popup.add(&self.new_popup);
xdg_surface.surface.events.new_subsurface.add(&self.new_subsurface);

// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = xdg_surface.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, .{ .view = view });
Subsurface.handleExisting(xdg_surface.surface, .{ .view = view });
}

pub fn deinit(self: *Self) void {
Expand Down

0 comments on commit 41874b4

Please sign in to comment.