config: implement map-pointer command

This command takes a mode, modifiers, button/event name, and pointer
action as arguments. It stores these in the config data structure.

The currently available pointer actions are move-view and resize-view,
which replace the previously hard-coded functionality.

Closing the hovered view with middle click has temorarily been removed
until it is decided if we wish to make this another special pointer
action or perhaps allow running any arbitrary command (which would of
course include close).
This commit is contained in:
Isaac Freund
2020-08-24 14:52:47 +02:00
parent fd8c5e6410
commit 989e7aaeda
14 changed files with 240 additions and 86 deletions

View File

@ -65,9 +65,6 @@ focus_stack: ViewStack(*View) = ViewStack(*View){},
/// List of status tracking objects relaying changes to this seat to clients.
status_trackers: std.SinglyLinkedList(SeatStatus) = std.SinglyLinkedList(SeatStatus).init(),
/// State of pointer modifier; Used for pointer operations such as move ans resize.
pointer_modifier: bool = false,
listen_request_set_selection: c.wl_listener = undefined,
pub fn init(self: *Self, input_manager: *InputManager, name: [*:0]const u8) !void {
@ -258,7 +255,7 @@ pub fn handleViewUnmap(self: *Self, view: *View) void {
/// Returns true if the key was handled
pub fn handleMapping(self: *Self, keysym: c.xkb_keysym_t, modifiers: u32) bool {
const modes = &self.input_manager.server.config.modes;
for (modes.items[self.mode_id].items) |mapping| {
for (modes.items[self.mode_id].mappings.items) |mapping| {
if (modifiers == mapping.modifiers and keysym == mapping.keysym) {
// Execute the bound command
const args = mapping.command_args;