river-status: add mode event to seat status
This allows clients such as a status bar to display the currently active mode.
This commit is contained in:
@ -38,9 +38,12 @@ pub fn declareMode(
|
||||
|
||||
if (config.mode_to_id.get(new_mode_name) != null) return;
|
||||
|
||||
try config.mode_to_id.ensureUnusedCapacity(1);
|
||||
try config.modes.ensureUnusedCapacity(util.gpa, 1);
|
||||
const owned_name = try util.gpa.dupe(u8, new_mode_name);
|
||||
errdefer util.gpa.free(owned_name);
|
||||
try config.mode_to_id.putNoClobber(owned_name, config.modes.items.len);
|
||||
config.modes.appendAssumeCapacity(.{});
|
||||
|
||||
const owned_name = try util.gpa.dupeZ(u8, new_mode_name);
|
||||
|
||||
const id = @intCast(u32, config.modes.items.len);
|
||||
config.mode_to_id.putAssumeCapacityNoClobber(owned_name, id);
|
||||
config.modes.appendAssumeCapacity(.{ .name = owned_name });
|
||||
}
|
||||
|
@ -59,5 +59,5 @@ pub fn enterMode(
|
||||
return Error.Other;
|
||||
}
|
||||
|
||||
seat.mode_id = mode_id;
|
||||
seat.enterMode(mode_id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user