commit river for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package river for openSUSE:Factory checked in at 2024-07-26 16:15:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/river (Old) and /work/SRC/openSUSE:Factory/.river.new.1882 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "river" Fri Jul 26 16:15:52 2024 rev:24 rq:1189688 version:0.3.5 Changes: -------- --- /work/SRC/openSUSE:Factory/river/river.changes 2024-07-16 22:05:37.876890922 +0200 +++ /work/SRC/openSUSE:Factory/.river.new.1882/river.changes 2024-07-26 16:16:20.219726749 +0200 @@ -1,0 +2,39 @@ +Fri Jul 26 02:18:31 UTC 2024 - Soc Virnyl Estela <obs@uncomfyhalomacro.pl> + +- Update README-suse-maintenance.md. Point to Zig page in openSUSE wiki. + +------------------------------------------------------------------- +Fri Jul 26 02:14:14 UTC 2024 - Soc Virnyl Estela <obs@uncomfyhalomacro.pl> + +- Fix contrib file list in %prep. Contrib are not part of river's sources + from upstream so it makes sense to put it here. + * include vendor.tar.zst (so users can see what's inside) + * include river-run.sh (so users know if they want to edit this) + * include river-portals.conf + +------------------------------------------------------------------- +Fri Jul 26 02:08:30 UTC 2024 - Soc Virnyl Estela <obs@uncomfyhalomacro.pl> + +- Update to version 0.3.5: + * completions: zsh click-method option fix + * build: bump version to 0.3.5-dev + * build: update to wlroots 0.18.0 + * LayerSurface: minor style/naming tweaks + * river: attempt to recover from GPU resets + * build: bump version to 0.3.5 + * LayerSurface: focus on_demand-interactive surfaces on map + +------------------------------------------------------------------- +Mon Jul 22 02:51:37 UTC 2024 - Soc Virnyl Estela <obs@uncomfyhalomacro.pl> + +- Revert change. Viewed wrong page. Requirements was still 0.17.2 + +------------------------------------------------------------------- +Mon Jul 22 02:21:36 UTC 2024 - Soc Virnyl Estela <obs@uncomfyhalomacro.pl> + +- Restrict wlroots requirement to >= 0.18.x. This + should fail if this was not met. But seems upstream has no + code to detect wlroots version. Allow this failure for now + until 0.18.0 is merged to Factory. + +------------------------------------------------------------------- Old: ---- river-0.3.4.tar.gz river-0.3.4.tar.gz.sig New: ---- river-0.3.5.tar.gz river-0.3.5.tar.gz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ river.spec ++++++ --- /var/tmp/diff_new_pack.y439J7/_old 2024-07-26 16:16:20.823751056 +0200 +++ /var/tmp/diff_new_pack.y439J7/_new 2024-07-26 16:16:20.827751217 +0200 @@ -17,7 +17,7 @@ Name: river -Version: 0.3.4 +Version: 0.3.5 Release: 0 Summary: A dynamic tiling Wayland compositor License: GPL-3.0-only @@ -50,7 +50,7 @@ BuildRequires: pkgconfig(wayland-egl) BuildRequires: pkgconfig(wayland-protocols) >= 1.24 BuildRequires: pkgconfig(wayland-server) >= 1.20.0 -BuildRequires: pkgconfig(wlroots) >= 0.17.2 +BuildRequires: pkgconfig(wlroots-0.18) >= 0.18.0 BuildRequires: pkgconfig(xkbcommon) Recommends: xorg-x11-server-wayland # To make Qt apps work somewhat okay on Wayland and auto use it @@ -174,6 +174,8 @@ install -Dpm 0644 contrib/river.desktop %{buildroot}%{_datadir}/wayland-sessions cp -rv contrib %{buildroot}%{_datadir}/river/contrib cp -v %{SOURCE2} %{buildroot}%{_datadir}/river/contrib/ +cp -v %{SOURCE3} %{buildroot}%{_datadir}/river/contrib/ +cp -v %{SOURCE4} %{buildroot}%{_datadir}/river/contrib/ # Install convenient script to run river install -Dpm 0755 %{SOURCE3} %{buildroot}%{_bindir} ++++++ README-suse-maintenance.md ++++++ --- /var/tmp/diff_new_pack.y439J7/_old 2024-07-26 16:16:20.863752666 +0200 +++ /var/tmp/diff_new_pack.y439J7/_new 2024-07-26 16:16:20.867752827 +0200 @@ -1,17 +1,6 @@ -# VENDOR +# Packaging -1. Extract source tarball -2. Read the PACKAGING.md file in the extracted source - -OR this hack - -``` -zig fetch . --global-cache-dir vendor/ -cd vendor -rm -rfv z -``` - -Then create vendored tarball from vendor e.g. zstd compressed tarball +See <https://en.opensuse.org/Zig#Packaging>. # BUILD ++++++ river-0.3.4.tar.gz -> river-0.3.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/.builds/alpine.yml new/river-0.3.5/.builds/alpine.yml --- old/river-0.3.4/.builds/alpine.yml 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/.builds/alpine.yml 2024-07-22 17:25:37.000000000 +0200 @@ -28,15 +28,17 @@ tasks: - install_deps: | cd wayland - git checkout 1.22.0 + git checkout 1.23.0 meson setup build -Ddocumentation=false -Dtests=false --prefix /usr sudo ninja -C build install cd .. cd wlroots - git checkout 0.17.2 - meson setup build --auto-features=enabled -Drenderers=gles2 -Dexamples=false \ - -Dwerror=false -Db_ndebug=false -Dxcb-errors=disabled --prefix /usr + git checkout 0.18.0 + meson setup build --auto-features=enabled -Drenderers=gles2 \ + -Dcolor-management=disabled -Dlibliftoff=disabled \ + -Dexamples=false -Dwerror=false -Db_ndebug=false \ + -Dxcb-errors=disabled --prefix /usr sudo ninja -C build/ install cd .. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/.builds/archlinux.yml new/river-0.3.5/.builds/archlinux.yml --- old/river-0.3.4/.builds/archlinux.yml 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/.builds/archlinux.yml 2024-07-22 17:25:37.000000000 +0200 @@ -26,15 +26,17 @@ tasks: - install_deps: | cd wayland - git checkout 1.22.0 + git checkout 1.23.0 meson setup build -Ddocumentation=false -Dtests=false --prefix /usr sudo ninja -C build install cd .. cd wlroots - git checkout 0.17.2 - meson setup build --auto-features=enabled -Drenderers=gles2 -Dexamples=false \ - -Dwerror=false -Db_ndebug=false --prefix /usr + git checkout 0.18.0 + meson setup build --auto-features=enabled -Drenderers=gles2 \ + -Dcolor-management=disabled -Dlibliftoff=disabled \ + -Dexamples=false -Dwerror=false -Db_ndebug=false \ + -Dxcb-errors=disabled --prefix /usr sudo ninja -C build/ install cd .. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/.builds/freebsd.yml new/river-0.3.5/.builds/freebsd.yml --- old/river-0.3.4/.builds/freebsd.yml 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/.builds/freebsd.yml 2024-07-22 17:25:37.000000000 +0200 @@ -31,15 +31,17 @@ tasks: - install_deps: | cd wayland - git checkout 1.22.0 + git checkout 1.23.0 meson setup build -Ddocumentation=false -Dtests=false --prefix /usr sudo ninja -C build install cd .. cd wlroots - git checkout 0.17.2 - meson setup build --auto-features=enabled -Drenderers=gles2 -Dexamples=false \ - -Dwerror=false -Db_ndebug=false --prefix /usr + git checkout 0.18.0 + meson setup build --auto-features=enabled -Drenderers=gles2 \ + -Dcolor-management=disabled -Dlibliftoff=disabled \ + -Dexamples=false -Dwerror=false -Db_ndebug=false \ + -Dxcb-errors=disabled --prefix /usr sudo ninja -C build/ install cd .. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/README.md new/river-0.3.5/README.md --- old/river-0.3.4/README.md 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/README.md 2024-07-22 17:25:37.000000000 +0200 @@ -60,7 +60,7 @@ - [zig](https://ziglang.org/download/) 0.13 - wayland - wayland-protocols -- [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots) 0.17.2 +- [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots) 0.18 - xkbcommon - libevdev - pixman diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/build.zig new/river-0.3.5/build.zig --- old/river-0.3.4/build.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/build.zig 2024-07-22 17:25:37.000000000 +0200 @@ -10,7 +10,7 @@ /// with the "-dev" suffix. /// When a release is tagged, the "-dev" suffix should be removed for the commit that gets tagged. /// Directly after the tagged commit, the version should be bumped and the "-dev" suffix added. -const version = "0.3.4"; +const version = "0.3.5"; pub fn build(b: *Build) !void { const target = b.standardTargetOptions(.{}); @@ -146,7 +146,7 @@ // exposed to the wlroots module for @cImport() to work. This seems to be // the best way to do so with the current std.Build API. wlroots.resolved_target = target; - wlroots.linkSystemLibrary("wlroots", .{}); + wlroots.linkSystemLibrary("wlroots-0.18", .{}); const flags = b.createModule(.{ .root_source_file = b.path("common/flags.zig") }); const globber = b.createModule(.{ .root_source_file = b.path("common/globber.zig") }); @@ -167,7 +167,7 @@ river.linkSystemLibrary("libevdev"); river.linkSystemLibrary("libinput"); river.linkSystemLibrary("wayland-server"); - river.linkSystemLibrary("wlroots"); + river.linkSystemLibrary("wlroots-0.18"); river.linkSystemLibrary("xkbcommon"); river.linkSystemLibrary("pixman-1"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/build.zig.zon new/river-0.3.5/build.zig.zon --- old/river-0.3.4/build.zig.zon 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/build.zig.zon 2024-07-22 17:25:37.000000000 +0200 @@ -1,6 +1,6 @@ .{ .name = "river", - .version = "0.3.4", + .version = "0.3.5", .paths = .{""}, .dependencies = .{ .@"zig-pixman" = .{ @@ -12,8 +12,8 @@ .hash = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242", }, .@"zig-wlroots" = .{ - .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.17.2.tar.gz", - .hash = "1220bb5e5c802c517425bc1d8d8d43d7b7fe5eb81ce4c46b15ce829d67ddadc55418", + .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.18.0.tar.gz", + .hash = "12204d789e17c158971f69c7b900e8d8f288e7b9e42b2242f3adfbca57e8266d848f", }, .@"zig-xkbcommon" = .{ .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/completions/zsh/_riverctl new/river-0.3.5/completions/zsh/_riverctl --- old/river-0.3.4/completions/zsh/_riverctl 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/completions/zsh/_riverctl 2024-07-22 17:25:37.000000000 +0200 @@ -135,7 +135,7 @@ case "$line[2]" in events) _alternative 'input-cmds:args:(enabled disabled disabled-on-external-mouse)' ;; accel-profile) _alternative 'input-cmds:args:(none flat adaptive)' ;; - click-method) _alternative 'input-cmds:args:(none button-area clickfinger)' ;; + click-method) _alternative 'input-cmds:args:(none button-areas clickfinger)' ;; drag) _alternative 'input-cmds:args:(enabled disabled)' ;; drag-lock) _alternative 'input-cmds:args:(enabled disabled)' ;; disable-while-typing) _alternative 'input-cmds:args:(enabled disabled)' ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/Cursor.zig new/river-0.3.5/river/Cursor.zig --- old/river-0.3.4/river/Cursor.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/Cursor.zig 2024-07-22 17:25:37.000000000 +0200 @@ -324,6 +324,7 @@ math.maxInt(i32) / 2, )), event.source, + event.relative_direction, ); } @@ -568,7 +569,7 @@ cursor.seat.handleActivity(); if (cursor.touch_points.remove(event.touch_id)) { - cursor.seat.wlr_seat.touchNotifyUp(event.time_msec, event.touch_id); + _ = cursor.seat.wlr_seat.touchNotifyUp(event.time_msec, event.touch_id); } } @@ -582,32 +583,9 @@ cursor.touch_points.clearRetainingCapacity(); - // We can't call touchNotifyCancel() from inside the loop over touch points as it also loops - // over touch points and may destroy multiple touch points in a single call. - // - // What we should do here is `while (touch_points.first()) |point| cancel()` but since the - // surface may be null we can't rely on the fact tha all touch points will be destroyed - // and risk an infinite loop if the surface of any wlr_touch_point is null. - // - // This is all really silly and totally unnecessary since all touchNotifyCancel() does with - // the surface argument is obtain a seat client and touch_point.seat_client is never null. - // TODO(wlroots) clean this up after the wlroots MR fixing this is merged: - // https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4613 - - // The upper bound of 32 comes from an implementation detail of libinput which uses - // a 32-bit integer as a map to keep track of touch points. - var surfaces: std.BoundedArray(*wlr.Surface, 32) = .{}; - { - var it = cursor.seat.wlr_seat.touch_state.touch_points.iterator(.forward); - while (it.next()) |touch_point| { - if (touch_point.surface) |surface| { - surfaces.append(surface) catch break; - } - } - } - - for (surfaces.slice()) |surface| { - cursor.seat.wlr_seat.touchNotifyCancel(surface); + const wlr_seat = cursor.seat.wlr_seat; + while (wlr_seat.touch_state.touch_points.first()) |touch_point| { + wlr_seat.touchNotifyCancel(touch_point.client); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/InputConfig.zig new/river-0.3.5/river/InputConfig.zig --- old/river-0.3.4/river/InputConfig.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/InputConfig.zig 2024-07-22 17:25:37.000000000 +0200 @@ -232,7 +232,7 @@ }; switch (device.wlr_device.type) { - .pointer, .touch, .tablet_tool => { + .pointer, .touch, .tablet => { log.debug("mapping input '{s}' -> '{s}'", .{ device.identifier, if (wlr_output) |o| o.name else "<no output>", @@ -240,14 +240,14 @@ device.seat.cursor.wlr_cursor.mapInputToOutput(device.wlr_device, wlr_output); - if (device.wlr_device.type == .tablet_tool) { + if (device.wlr_device.type == .tablet) { const tablet: *Tablet = @fieldParentPtr("device", device); tablet.output_mapping = wlr_output; } }, // These devices do not support being mapped to outputs. - .keyboard, .tablet_pad, .switch_device => {}, + .keyboard, .tablet_pad, .@"switch" => {}, } } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/InputDevice.zig new/river-0.3.5/river/InputDevice.zig --- old/river-0.3.4/river/InputDevice.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/InputDevice.zig 2024-07-22 17:25:37.000000000 +0200 @@ -24,6 +24,7 @@ const globber = @import("globber"); +const c = @import("c.zig"); const server = &@import("main.zig").server; const util = @import("util.zig"); @@ -52,19 +53,21 @@ link: wl.list.Link, pub fn init(device: *InputDevice, seat: *Seat, wlr_device: *wlr.InputDevice) !void { - const device_type: []const u8 = switch (wlr_device.type) { - .switch_device => "switch", - .tablet_tool => "tablet", - else => @tagName(wlr_device.type), - }; + var vendor: c_uint = 0; + var product: c_uint = 0; + + if (wlr_device.getLibinputDevice()) |d| { + vendor = c.libinput_device_get_id_vendor(@ptrCast(d)); + product = c.libinput_device_get_id_product(@ptrCast(d)); + } const identifier = try std.fmt.allocPrint( util.gpa, "{s}-{}-{}-{s}", .{ - device_type, - wlr_device.vendor, - wlr_device.product, + @tagName(wlr_device.type), + vendor, + product, mem.trim(u8, mem.sliceTo(wlr_device.name orelse "unknown", 0), &ascii.whitespace), }, ); @@ -139,11 +142,11 @@ device.deinit(); util.gpa.destroy(device); }, - .tablet_tool => { + .tablet => { const tablet: *Tablet = @fieldParentPtr("device", device); tablet.destroy(); }, - .switch_device => { + .@"switch" => { const switch_device: *Switch = @fieldParentPtr("device", device); switch_device.deinit(); util.gpa.destroy(switch_device); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/LayerSurface.zig new/river-0.3.5/river/LayerSurface.zig --- old/river-0.3.4/river/LayerSurface.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/LayerSurface.zig 2024-07-22 17:25:37.000000000 +0200 @@ -66,11 +66,6 @@ wlr_layer_surface.surface.events.unmap.add(&layer_surface.unmap); wlr_layer_surface.surface.events.commit.add(&layer_surface.commit); wlr_layer_surface.events.new_popup.add(&layer_surface.new_popup); - - // wlroots only informs us of the new surface after the first commit, - // so our listener does not get called for this first commit. However, - // we do want our listener called in order to send the initial configure. - handleCommit(&layer_surface.commit, wlr_layer_surface.surface); } pub fn destroyPopups(layer_surface: *LayerSurface) void { @@ -100,11 +95,19 @@ fn handleMap(listener: *wl.Listener(void)) void { const layer_surface: *LayerSurface = @fieldParentPtr("map", listener); + const wlr_surface = layer_surface.wlr_layer_surface; - log.debug("layer surface '{s}' mapped", .{layer_surface.wlr_layer_surface.namespace}); + log.debug("layer surface '{s}' mapped", .{wlr_surface.namespace}); layer_surface.output.arrangeLayers(); - handleKeyboardInteractiveExclusive(layer_surface.output); + + const consider = wlr_surface.current.keyboard_interactive == .on_demand and + (wlr_surface.current.layer == .top or wlr_surface.current.layer == .overlay); + handleKeyboardInteractiveExclusive( + layer_surface.output, + if (consider) layer_surface else null, + ); + server.root.applyPending(); } @@ -114,7 +117,7 @@ log.debug("layer surface '{s}' unmapped", .{layer_surface.wlr_layer_surface.namespace}); layer_surface.output.arrangeLayers(); - handleKeyboardInteractiveExclusive(layer_surface.output); + handleKeyboardInteractiveExclusive(layer_surface.output, null); server.root.applyPending(); } @@ -134,18 +137,20 @@ @as(u32, @bitCast(wlr_layer_surface.current.committed)) != 0) { layer_surface.output.arrangeLayers(); - handleKeyboardInteractiveExclusive(layer_surface.output); + handleKeyboardInteractiveExclusive(layer_surface.output, null); server.root.applyPending(); } } +/// Focus topmost keyboard-interactivity-exclusive layer surface above normal +/// content, or if none found, focus the surface given as `consider`. /// Requires a call to Root.applyPending() -fn handleKeyboardInteractiveExclusive(output: *Output) void { +fn handleKeyboardInteractiveExclusive(output: *Output, consider: ?*LayerSurface) void { if (server.lock_manager.state != .unlocked) return; - // Find the topmost layer surface in the top or overlay layers which - // requests keyboard interactivity if any. - const topmost_surface = outer: for ([_]zwlr.LayerShellV1.Layer{ .overlay, .top }) |layer| { + // Find the topmost layer surface (if any) in the top or overlay layers which + // requests exclusive keyboard interactivity. + const to_focus = outer: for ([_]zwlr.LayerShellV1.Layer{ .overlay, .top }) |layer| { const tree = output.layerSurfaceTree(layer); // Iterate in reverse to match rendering order. var it = tree.children.iterator(.reverse); @@ -161,17 +166,21 @@ } } } - } else null; + } else consider; + + if (to_focus) |s| { + assert(s.wlr_layer_surface.current.keyboard_interactive != .none); + } var it = server.input_manager.seats.first; while (it) |node| : (it = node.next) { const seat = &node.data; if (seat.focused_output == output) { - if (topmost_surface) |to_focus| { + if (to_focus) |s| { // If we found a surface on the output that requires focus, grab the focus of all // seats that are focusing that output. - seat.setFocusRaw(.{ .layer = to_focus }); + seat.setFocusRaw(.{ .layer = s }); continue; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/Output.zig new/river-0.3.5/river/Output.zig --- old/river-0.3.4/river/Output.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/Output.zig 2024-07-22 17:25:37.000000000 +0200 @@ -556,8 +556,6 @@ if (!output.wlr_output.commitState(&state)) return error.CommitFailed; - // TODO(wlroots) remove this rotate() call when updating to wlroots 0.18 - scene_output.damage_ring.rotate(); output.gamma_dirty = false; } else { if (!scene_output.commit(null)) return error.CommitFailed; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/PointerConstraint.zig new/river-0.3.5/river/PointerConstraint.zig --- old/river-0.3.4/river/PointerConstraint.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/PointerConstraint.zig 2024-07-22 17:25:37.000000000 +0200 @@ -169,7 +169,7 @@ fn warpToHintIfSet(constraint: *PointerConstraint) void { const seat: *Seat = @ptrFromInt(constraint.wlr_constraint.seat.data); - if (constraint.wlr_constraint.current.committed.cursor_hint) { + if (constraint.wlr_constraint.current.cursor_hint.enabled) { var lx: i32 = undefined; var ly: i32 = undefined; _ = constraint.state.active.node.coords(&lx, &ly); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/Root.zig new/river-0.3.5/river/Root.zig --- old/river-0.3.4/river/Root.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/Root.zig 2024-07-22 17:25:37.000000000 +0200 @@ -117,7 +117,7 @@ pending_state_dirty: bool = false, pub fn init(root: *Root) !void { - const output_layout = try wlr.OutputLayout.create(); + const output_layout = try wlr.OutputLayout.create(server.wl_server); errdefer output_layout.destroy(); const scene = try wlr.Scene.create(); @@ -131,9 +131,6 @@ const outputs = try interactive_content.createSceneTree(); const override_redirect = if (build_options.xwayland) try interactive_content.createSceneTree(); - const presentation = try wlr.Presentation.create(server.wl_server, server.backend); - scene.setPresentation(presentation); - const event_loop = server.wl_server.getEventLoop(); const transaction_timeout = try event_loop.addTimer(*Root, handleTransactionTimeout, root); errdefer transaction_timeout.remove(); @@ -166,7 +163,7 @@ .all_outputs = undefined, .active_outputs = undefined, - .presentation = presentation, + .presentation = try wlr.Presentation.create(server.wl_server, server.backend), .xdg_output_manager = try wlr.XdgOutputManagerV1.create(server.wl_server, output_layout), .output_manager = try wlr.OutputManagerV1.create(server.wl_server), .power_manager = try wlr.OutputPowerManagerV1.create(server.wl_server), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/Seat.zig new/river-0.3.5/river/Seat.zig --- old/river-0.3.4/river/Seat.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/Seat.zig 2024-07-22 17:25:37.000000000 +0200 @@ -507,11 +507,11 @@ seat.cursor.wlr_cursor.attachInputDevice(wlr_device); }, - .tablet_tool => { + .tablet => { try Tablet.create(seat, wlr_device); seat.cursor.wlr_cursor.attachInputDevice(wlr_device); }, - .switch_device => { + .@"switch" => { const switch_device = try util.gpa.create(Switch); errdefer util.gpa.destroy(switch_device); @@ -534,7 +534,7 @@ switch (device.wlr_device.type) { .keyboard => capabilities.keyboard = true, .touch => capabilities.touch = true, - .pointer, .switch_device, .tablet_tool => {}, + .pointer, .@"switch", .tablet => {}, .tablet_pad => unreachable, } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/Server.zig new/river-0.3.5/river/Server.zig --- old/river-0.3.4/river/Server.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/Server.zig 2024-07-22 17:25:37.000000000 +0200 @@ -38,6 +38,7 @@ const Seat = @import("Seat.zig"); const SceneNodeData = @import("SceneNodeData.zig"); const StatusManager = @import("StatusManager.zig"); +const TabletTool = @import("TabletTool.zig"); const XdgDecoration = @import("XdgDecoration.zig"); const XdgToplevel = @import("XdgToplevel.zig"); const XwaylandOverrideRedirect = @import("XwaylandOverrideRedirect.zig"); @@ -96,8 +97,10 @@ new_xwayland_surface: if (build_options.xwayland) wl.Listener(*wlr.XwaylandSurface) else void = if (build_options.xwayland) wl.Listener(*wlr.XwaylandSurface).init(handleNewXwaylandSurface), -new_xdg_surface: wl.Listener(*wlr.XdgSurface) = - wl.Listener(*wlr.XdgSurface).init(handleNewXdgSurface), +renderer_lost: wl.Listener(void) = wl.Listener(void).init(handleRendererLost), + +new_xdg_toplevel: wl.Listener(*wlr.XdgToplevel) = + wl.Listener(*wlr.XdgToplevel).init(handleNewXdgToplevel), new_toplevel_decoration: wl.Listener(*wlr.XdgToplevelDecorationV1) = wl.Listener(*wlr.XdgToplevelDecorationV1).init(handleNewToplevelDecoration), new_layer_surface: wl.Listener(*wlr.LayerSurfaceV1) = @@ -113,14 +116,14 @@ // This keeps the code simpler and more readable. const wl_server = try wl.Server.create(); + const loop = wl_server.getEventLoop(); var session: ?*wlr.Session = undefined; - const backend = try wlr.Backend.autocreate(wl_server, &session); + const backend = try wlr.Backend.autocreate(loop, &session); const renderer = try wlr.Renderer.autocreate(backend); const compositor = try wlr.Compositor.create(wl_server, 6, renderer); - const loop = wl_server.getEventLoop(); server.* = .{ .wl_server = wl_server, .sigint_source = try loop.addSignal(*wl.Server, posix.SIG.INT, terminate, wl_server), @@ -167,7 +170,7 @@ .lock_manager = undefined, }; - if (renderer.getDmabufFormats() != null and renderer.getDrmFd() >= 0) { + if (renderer.getTextureFormats(@intFromEnum(wlr.BufferCap.dmabuf)) != null) { // wl_drm is a legacy interface and all clients should switch to linux_dmabuf. // However, enough widely used clients still rely on wl_drm that the pragmatic option // is to keep it around for the near future. @@ -190,7 +193,8 @@ try server.idle_inhibit_manager.init(); try server.lock_manager.init(); - server.xdg_shell.events.new_surface.add(&server.new_xdg_surface); + server.renderer.events.lost.add(&server.renderer_lost); + server.xdg_shell.events.new_toplevel.add(&server.new_xdg_toplevel); server.xdg_decoration_manager.events.new_toplevel_decoration.add(&server.new_toplevel_decoration); server.layer_shell.events.new_surface.add(&server.new_layer_surface); server.xdg_activation.events.request_activate.add(&server.request_activate); @@ -204,7 +208,8 @@ server.sigint_source.remove(); server.sigterm_source.remove(); - server.new_xdg_surface.link.remove(); + server.renderer_lost.link.remove(); + server.new_xdg_toplevel.link.remove(); server.new_toplevel_decoration.link.remove(); server.new_layer_surface.link.remove(); server.request_activate.link.remove(); @@ -277,14 +282,6 @@ } } -fn hackGlobal(ptr: *anyopaque) *wl.Global { - // TODO(wlroots) MR that eliminates the need for this hack: - // https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4612 - if (wlr.version.major != 0 or wlr.version.minor != 17) @compileError("FIXME"); - - return @as(*extern struct { global: *wl.Global }, @alignCast(@ptrCast(ptr))).global; -} - /// Returns true if the global is allowlisted for security contexts fn allowlist(server: *Server, global: *const wl.Global) bool { if (server.drm) |drm| if (global == drm.global) return true; @@ -300,8 +297,8 @@ // with an assertion failure. return global.getInterface() == wl.Output.getInterface() or global.getInterface() == wl.Seat.getInterface() or - global == hackGlobal(server.shm) or - global == hackGlobal(server.single_pixel_buffer_manager) or + global == server.shm.global or + global == server.single_pixel_buffer_manager.global or global == server.viewporter.global or global == server.fractional_scale_manager.global or global == server.compositor.global or @@ -336,7 +333,7 @@ global == server.root.output_manager.global or global == server.root.power_manager.global or global == server.root.gamma_control_manager.global or - global == hackGlobal(server.input_manager.idle_notifier) or + global == server.input_manager.idle_notifier.global or global == server.input_manager.virtual_pointer_manager.global or global == server.input_manager.virtual_keyboard_manager.global or global == server.input_manager.input_method_manager.global or @@ -349,17 +346,55 @@ return 0; } -fn handleNewXdgSurface(_: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wlr.XdgSurface) void { - if (xdg_surface.role == .popup) { - log.debug("new xdg_popup", .{}); - return; +fn handleRendererLost(listener: *wl.Listener(void)) void { + const server: *Server = @fieldParentPtr("renderer_lost", listener); + + log.info("recovering from GPU reset", .{}); + + // There's not much that can be done if creating a new renderer or allocator fails. + // With luck there might be another GPU reset after which we try again and succeed. + + server.recoverFromGpuReset() catch |err| switch (err) { + error.RendererCreateFailed => log.err("failed to create new renderer after GPU reset", .{}), + error.AllocatorCreateFailed => log.err("failed to create new allocator after GPU reset", .{}), + }; +} + +fn recoverFromGpuReset(server: *Server) !void { + const new_renderer = try wlr.Renderer.autocreate(server.backend); + errdefer new_renderer.destroy(); + + const new_allocator = try wlr.Allocator.autocreate(server.backend, new_renderer); + errdefer comptime unreachable; // no failure allowed after this point + + server.renderer_lost.link.remove(); + new_renderer.events.lost.add(&server.renderer_lost); + + server.compositor.setRenderer(new_renderer); + + { + var it = server.root.all_outputs.iterator(.forward); + while (it.next()) |output| { + // This should never fail here as failure with this combination of + // renderer, allocator, and backend should have prevented creating + // the output in the first place. + _ = output.wlr_output.initRender(new_allocator, new_renderer); + } } + server.renderer.destroy(); + server.renderer = new_renderer; + + server.allocator.destroy(); + server.allocator = new_allocator; +} + +fn handleNewXdgToplevel(_: *wl.Listener(*wlr.XdgToplevel), xdg_toplevel: *wlr.XdgToplevel) void { log.debug("new xdg_toplevel", .{}); - XdgToplevel.create(xdg_surface.role_data.toplevel.?) catch { + XdgToplevel.create(xdg_toplevel) catch { log.err("out of memory", .{}); - xdg_surface.resource.postNoMemory(); + xdg_toplevel.resource.postNoMemory(); return; }; } @@ -450,17 +485,27 @@ _: *wl.Listener(*wlr.CursorShapeManagerV1.event.RequestSetShape), event: *wlr.CursorShapeManagerV1.event.RequestSetShape, ) void { - // Ignore requests to set a tablet tool's cursor shape for now - // TODO(wlroots): https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3821 - if (event.device_type == .tablet_tool) return; - - const focused_client = event.seat_client.seat.pointer_state.focused_client; - - // This can be sent by any client, so we check to make sure this one is - // actually has pointer focus first. - if (focused_client == event.seat_client) { - const seat: *Seat = @ptrFromInt(event.seat_client.seat.data); - const name = wlr.CursorShapeManagerV1.shapeName(event.shape); - seat.cursor.setXcursor(name); + const seat: *Seat = @ptrFromInt(event.seat_client.seat.data); + + if (event.tablet_tool) |wp_tool| { + assert(event.device_type == .tablet_tool); + + const tool = TabletTool.get(event.seat_client.seat, wp_tool.wlr_tool) catch return; + + if (tool.allowSetCursor(event.seat_client, event.serial)) { + const name = wlr.CursorShapeManagerV1.shapeName(event.shape); + tool.wlr_cursor.setXcursor(seat.cursor.xcursor_manager, name); + } + } else { + assert(event.device_type == .pointer); + + const focused_client = event.seat_client.seat.pointer_state.focused_client; + + // This can be sent by any client, so we check to make sure this one is + // actually has pointer focus first. + if (focused_client == event.seat_client) { + const name = wlr.CursorShapeManagerV1.shapeName(event.shape); + seat.cursor.setXcursor(name); + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/Tablet.zig new/river-0.3.5/river/Tablet.zig --- old/river-0.3.4/river/Tablet.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/Tablet.zig 2024-07-22 17:25:37.000000000 +0200 @@ -33,7 +33,7 @@ output_mapping: ?*wlr.Output = null, pub fn create(seat: *Seat, wlr_device: *wlr.InputDevice) !void { - assert(wlr_device.type == .tablet_tool); + assert(wlr_device.type == .tablet); const tablet = try util.gpa.create(Tablet); errdefer util.gpa.destroy(tablet); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/TabletTool.zig new/river-0.3.5/river/TabletTool.zig --- old/river-0.3.4/river/TabletTool.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/TabletTool.zig 2024-07-22 17:25:37.000000000 +0200 @@ -102,24 +102,29 @@ util.gpa.destroy(tool); } -fn handleSetCursor( - listener: *wl.Listener(*wlr.TabletV2TabletTool.event.SetCursor), - event: *wlr.TabletV2TabletTool.event.SetCursor, -) void { - const tool: *TabletTool = @fieldParentPtr("set_cursor", listener); - +pub fn allowSetCursor(tool: *TabletTool, seat_client: *wlr.Seat.Client, serial: u32) bool { if (tool.wp_tool.focused_surface == null or - tool.wp_tool.focused_surface.?.resource.getClient() != event.seat_client.client) + tool.wp_tool.focused_surface.?.resource.getClient() != seat_client.client) { log.debug("client tried to set cursor without focus", .{}); - return; + return false; } - if (event.serial != tool.wp_tool.proximity_serial) { + if (serial != tool.wp_tool.proximity_serial) { log.debug("focused client tried to set cursor with incorrect serial", .{}); - return; + return false; } + return true; +} - tool.wlr_cursor.setSurface(event.surface, event.hotspot_x, event.hotspot_y); +fn handleSetCursor( + listener: *wl.Listener(*wlr.TabletV2TabletTool.event.SetCursor), + event: *wlr.TabletV2TabletTool.event.SetCursor, +) void { + const tool: *TabletTool = @fieldParentPtr("set_cursor", listener); + + if (tool.allowSetCursor(event.seat_client, event.serial)) { + tool.wlr_cursor.setSurface(event.surface, event.hotspot_x, event.hotspot_y); + } } pub fn axis(tool: *TabletTool, tablet: *Tablet, event: *wlr.Tablet.event.Axis) void { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/XdgDecoration.zig new/river-0.3.5/river/XdgDecoration.zig --- old/river-0.3.4/river/XdgDecoration.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/XdgDecoration.zig 2024-07-22 17:25:37.000000000 +0200 @@ -42,14 +42,9 @@ wlr_decoration.events.destroy.add(&decoration.destroy); wlr_decoration.events.request_mode.add(&decoration.request_mode); - const ssd = server.config.rules.ssd.match(toplevel.view) orelse - (decoration.wlr_decoration.requested_mode != .client_side); - - // TODO(wlroots): make sure this is properly batched in a single configure - // with all other initial state when wlroots makes this possible. - _ = wlr_decoration.setMode(if (ssd) .server_side else .client_side); - - toplevel.view.pending.ssd = ssd; + if (toplevel.wlr_toplevel.base.initialized) { + handleRequestMode(&decoration.request_mode, wlr_decoration); + } } pub fn deinit(decoration: *XdgDecoration) void { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/XdgPopup.zig new/river-0.3.5/river/XdgPopup.zig --- old/river-0.3.4/river/XdgPopup.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/XdgPopup.zig 2024-07-22 17:25:37.000000000 +0200 @@ -54,7 +54,7 @@ .tree = try parent.createSceneXdgSurface(wlr_xdg_popup.base), }; - wlr_xdg_popup.base.events.destroy.add(&xdg_popup.destroy); + wlr_xdg_popup.events.destroy.add(&xdg_popup.destroy); wlr_xdg_popup.base.surface.events.commit.add(&xdg_popup.commit); wlr_xdg_popup.base.events.new_popup.add(&xdg_popup.new_popup); wlr_xdg_popup.events.reposition.add(&xdg_popup.reposition); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/XdgToplevel.zig new/river-0.3.5/river/XdgToplevel.zig --- old/river-0.3.4/river/XdgToplevel.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/XdgToplevel.zig 2024-07-22 17:25:37.000000000 +0200 @@ -62,12 +62,12 @@ destroy: wl.Listener(void) = wl.Listener(void).init(handleDestroy), map: wl.Listener(void) = wl.Listener(void).init(handleMap), unmap: wl.Listener(void) = wl.Listener(void).init(handleUnmap), +commit: wl.Listener(*wlr.Surface) = wl.Listener(*wlr.Surface).init(handleCommit), new_popup: wl.Listener(*wlr.XdgPopup) = wl.Listener(*wlr.XdgPopup).init(handleNewPopup), // Listeners that are only active while the view is mapped ack_configure: wl.Listener(*wlr.XdgSurface.Configure) = wl.Listener(*wlr.XdgSurface.Configure).init(handleAckConfigure), -commit: wl.Listener(*wlr.Surface) = wl.Listener(*wlr.Surface).init(handleCommit), request_fullscreen: wl.Listener(void) = wl.Listener(void).init(handleRequestFullscreen), request_move: wl.Listener(*wlr.XdgToplevel.event.Move) = wl.Listener(*wlr.XdgToplevel.event.Move).init(handleRequestMove), @@ -104,11 +104,10 @@ wlr_toplevel.base.surface.data = @intFromPtr(&view.tree.node); // Add listeners that are active over the toplevel's entire lifetime - wlr_toplevel.base.events.destroy.add(&toplevel.destroy); + wlr_toplevel.events.destroy.add(&toplevel.destroy); wlr_toplevel.base.surface.events.map.add(&toplevel.map); + wlr_toplevel.base.surface.events.commit.add(&toplevel.commit); wlr_toplevel.base.events.new_popup.add(&toplevel.new_popup); - - _ = wlr_toplevel.setWmCapabilities(.{ .fullscreen = true }); } /// Send a configure event, applying the inflight state of the view. @@ -213,8 +212,10 @@ toplevel.destroy.link.remove(); toplevel.map.link.remove(); toplevel.unmap.link.remove(); + toplevel.commit.link.remove(); + toplevel.new_popup.link.remove(); - // The wlr_surface may outlive the wlr_xdg_surface so we must clean up the user data. + // The wlr_surface may outlive the wlr_xdg_toplevel so we must clean up the user data. toplevel.wlr_toplevel.base.surface.data = 0; const view = toplevel.view; @@ -228,7 +229,6 @@ // Add listeners that are only active while mapped toplevel.wlr_toplevel.base.events.ack_configure.add(&toplevel.ack_configure); - toplevel.wlr_toplevel.base.surface.events.commit.add(&toplevel.commit); toplevel.wlr_toplevel.events.request_fullscreen.add(&toplevel.request_fullscreen); toplevel.wlr_toplevel.events.request_move.add(&toplevel.request_move); toplevel.wlr_toplevel.events.request_resize.add(&toplevel.request_resize); @@ -270,7 +270,6 @@ // Remove listeners that are only active while mapped toplevel.ack_configure.link.remove(); - toplevel.commit.link.remove(); toplevel.request_fullscreen.link.remove(); toplevel.request_move.link.remove(); toplevel.request_resize.link.remove(); @@ -309,6 +308,23 @@ const toplevel: *XdgToplevel = @fieldParentPtr("commit", listener); const view = toplevel.view; + if (toplevel.wlr_toplevel.base.initial_commit) { + _ = toplevel.wlr_toplevel.setWmCapabilities(.{ .fullscreen = true }); + + if (toplevel.decoration) |decoration| { + const ssd = server.config.rules.ssd.match(toplevel.view) orelse + (decoration.wlr_decoration.requested_mode != .client_side); + _ = decoration.wlr_decoration.setMode(if (ssd) .server_side else .client_side); + toplevel.view.pending.ssd = ssd; + } + + return; + } + + if (!view.mapped) { + return; + } + { const state = &toplevel.wlr_toplevel.current; view.constraints = .{ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/river-0.3.4/river/main.zig new/river-0.3.5/river/main.zig --- old/river-0.3.4/river/main.zig 2024-07-10 12:58:21.000000000 +0200 +++ new/river-0.3.5/river/main.zig 2024-07-22 17:25:37.000000000 +0200 @@ -31,12 +31,6 @@ const Server = @import("Server.zig"); -comptime { - if (wlr.version.major != 0 or wlr.version.minor != 17 or wlr.version.micro < 2) { - @compileError("river requires at least wlroots version 0.17.2 due to bugs in wlroots 0.17.0/0.17.1"); - } -} - const usage: []const u8 = \\usage: river [options] \\ ++++++ vendor.tar.zst ++++++ ++++ 15453 lines of diff (skipped)
participants (1)
-
Source-Sync