diff --git a/river/Decoration.zig b/river/Decoration.zig index 7223117..ad8920f 100644 --- a/river/Decoration.zig +++ b/river/Decoration.zig @@ -61,19 +61,12 @@ fn handleRequestMode(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) voi const wlr_xdg_toplevel: *c.wlr_xdg_toplevel = @field(wlr_xdg_surface, c.wlr_xdg_surface_union).toplevel; const app_id: [*:0]const u8 = if (wlr_xdg_toplevel.app_id) |id| id else "NULL"; - const use_csd = for (self.server.config.csd_filter.items) |filter_app_id| { - if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) break true; - } else false; - - if (use_csd) { - _ = c.wlr_xdg_toplevel_decoration_v1_set_mode( - self.wlr_xdg_toplevel_decoration, - .WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE, - ); - } else { - _ = c.wlr_xdg_toplevel_decoration_v1_set_mode( - self.wlr_xdg_toplevel_decoration, - .WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE, - ); - } + _ = c.wlr_xdg_toplevel_decoration_v1_set_mode( + self.wlr_xdg_toplevel_decoration, + for (self.server.config.csd_filter.items) |filter_app_id| { + if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) { + break .WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; + } + } else .WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE, + ); } diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig index 3dfe837..945d68a 100644 --- a/river/XdgToplevel.zig +++ b/river/XdgToplevel.zig @@ -189,22 +189,18 @@ fn handleMap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { } } - // If the toplevel has no parent and has an app_id which is not configured - // to use client side decorations, inform it that it is tiled. This - // prevents firefox, for example, from drawing shadows around itself. - if (wlr_xdg_toplevel.parent == null) { - const use_csd = for (root.server.config.csd_filter.items) |filter_app_id| { - if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) break true; - } else false; - - if (use_csd) { + // If the toplevel has an app_id which is not configured to use client side + // decorations, inform it that it is tiled. + for (root.server.config.csd_filter.items) |filter_app_id| { + if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) { view.draw_borders = false; - } else { - _ = c.wlr_xdg_toplevel_set_tiled( - self.wlr_xdg_surface, - c.WLR_EDGE_LEFT | c.WLR_EDGE_RIGHT | c.WLR_EDGE_TOP | c.WLR_EDGE_BOTTOM, - ); + break; } + } else { + _ = c.wlr_xdg_toplevel_set_tiled( + self.wlr_xdg_surface, + c.WLR_EDGE_LEFT | c.WLR_EDGE_RIGHT | c.WLR_EDGE_TOP | c.WLR_EDGE_BOTTOM, + ); } view.map();