Commit graph

21 commits

Author SHA1 Message Date
Ian Fan 6865b8aae9 ipc: add binding event 2018-08-01 16:57:15 +01:00
frsfnrrg 94dd8823a0 Invoke mouse bindings
The mouse binding logic is inspired/copied from the
keyboard binding logic; we store a sorted list of the
currently pressed buttons, and trigger a binding when
the currently pressed (or just recently pressed, in
the case of a release binding) buttons, as well as
modifiers/container region, match those of a given
binding.

As the code to execute a binding is not very keyboard
specific, keyboard_execute_command is renamed to
seat_execute_command and moved to where the other
binding handling functions are. The call to
transaction_commit_dirty has been lifted out.
2018-07-23 21:38:29 -04:00
frsfnrrg 754372c3de Parse mouse binding options
First, the existing sway_binding structure is given an
enumerated type code. As all flags to bindsym/bindcode
are boolean, a single uint32 is used to hold all flags.
The _BORDER, _CONTENTS, _TITLEBAR flags, when active,
indicate in which part of a container the binding can
trigger; to localize complexity, they do not overlap
with the command line arguments, which center around
_TITLEBAR being set by default.

The keyboard handling code is adjusted for this change,
as is binding_key_compare; note that BINDING_LOCKED
is *not* part of the key portion of the binding.

Next, list of mouse bindings is introduced and cleaned up.

Finally, the binding command parsing code is extended
to handle the case where bindsym is used to describe
a mouse binding rather than a keysym binding; the
difference between the two may be detected as late as
when the first key/button is parsed, or as early as
the first flag.  As bindings can have multiple
keycodes/keysyms/buttons, mixed keysym/button sequences
are prohibited.
2018-07-23 21:14:22 -04:00
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
frsfnrrg b23cd827cf Sort binding key lists
Sort the list comprising the set of keys for the binding in ascending
order. (Keyboard shortcuts depend only on the set of simultaneously
pressed keys, not their order, so this change should have no external
effect.) This simplifies comparisons between bindings.
2018-06-12 11:26:24 -04:00
frsfnrrg eb00edc6e2 Style fixes for bind.c 2018-06-01 18:52:36 -04:00
frsfnrrg 705230a26c Fix binding bindcode flag initialization 2018-06-01 18:52:36 -04:00
frsfnrrg f5ed65e633 Use XKB keycode numbering for bindcode 2018-06-01 18:52:36 -04:00
frsfnrrg d77681ea3d Share common code between bindsym and bindcode commands 2018-06-01 18:52:36 -04:00
frsfnrrg a78a5684ea Implement bindsym/bindcode --locked
Adds the --locked flag to bindsym and bindcode commands.

When a keyboard's associated seat has an exclusive client
(i.e, a screenlocker), then bindings are only executed if
they have the locked flag. When there is no such client,
this restriction is lifted.
2018-05-27 13:28:02 -04:00
Dominique Martinet 67985e9031 sway: change all sway_log to wlr_log 2018-01-05 23:39:46 +01:00
Tony Crisci 50e791cadb binding release 2018-01-04 07:25:52 -05:00
Tony Crisci bd3ca70e3d fix nitpicks 2017-12-29 09:11:15 -05:00
Tony Crisci 62b7ab3959 overwrite old bindings 2017-12-28 18:50:22 -05:00
Tony Crisci ba69f06695 binding config 2017-12-27 12:31:06 -05:00
Drew DeVault 733993a651 Move everything to sway/old/ 2017-11-18 11:22:02 -05:00
Tobias Blass 566863ba5d fix use-after-free bug 2017-07-10 22:59:59 +02:00
Josip Janzic 400998d6d2 Add mouse button bindings
Adds support for bindings like:

bindsym button3 floating toggle
bindsym $mod+button3 floating toggle
2017-05-04 23:00:03 +02:00
Drew DeVault 248df18c24 Handle allocation failure in commands 2016-12-15 19:01:40 -05:00
Zandr Martin 65ace5dec5
merge in latest commits 2016-09-02 14:11:48 -05:00
Zandr Martin b374c35758
refactor commands.c 2016-09-01 21:39:08 -05:00