Fix bug causing XDG toplevels with a parent to not respect the CSD filter

This commit is contained in:
Leon Henrik Plickat 2020-07-16 19:48:13 +02:00 committed by Isaac Freund
parent a93c263502
commit 228c2c372f
2 changed files with 18 additions and 29 deletions

View File

@ -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 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 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| { _ = c.wlr_xdg_toplevel_decoration_v1_set_mode(
if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) break true; self.wlr_xdg_toplevel_decoration,
} else false; for (self.server.config.csd_filter.items) |filter_app_id| {
if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) {
if (use_csd) { break .WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
_ = c.wlr_xdg_toplevel_decoration_v1_set_mode( }
self.wlr_xdg_toplevel_decoration, } else .WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE,
.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,
);
}
} }

View File

@ -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 // If the toplevel has an app_id which is not configured to use client side
// to use client side decorations, inform it that it is tiled. This // decorations, inform it that it is tiled.
// prevents firefox, for example, from drawing shadows around itself. for (root.server.config.csd_filter.items) |filter_app_id| {
if (wlr_xdg_toplevel.parent == null) { if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) {
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) {
view.draw_borders = false; view.draw_borders = false;
} else { break;
_ = 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,
);
} }
} 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(); view.map();