diff options
| author | Enrico Zandomeni Borba <enricozb@gmail.com> | 2024-08-04 09:16:15 +0200 |
|---|---|---|
| committer | Enrico Zandomeni Borba <enricozb@gmail.com> | 2024-08-04 17:40:29 +0200 |
| commit | 7093f142916d1e6887432dfd88697a1c2ed1b004 (patch) | |
| tree | 527df8c4b4bf1adde97a730665baad99457dde8c /src/keys.hh | |
| parent | 10ed78fe8a580b3558348746ee53f81c5b0aeae1 (diff) | |
add scroll coordinates
adds scroll amount in the upper 16-bits of `Key.modifiers`, reclaiming
the space in `Key.key` for coordinates. Previously, while mouse events
included their coordinates, scrolling did not. Scroll events are now
emitted as <scroll:amount:line.column>.
Diffstat (limited to 'src/keys.hh')
| -rw-r--r-- | src/keys.hh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/keys.hh b/src/keys.hh index ccafe336..b4796ea5 100644 --- a/src/keys.hh +++ b/src/keys.hh @@ -91,6 +91,7 @@ struct Key constexpr DisplayCoord coord() const { return {(int)((key & 0xFFFF0000) >> 16), (int)(key & 0x0000FFFF)}; } constexpr MouseButton mouse_button() { return MouseButton{((int)modifiers & (int)Modifiers::MouseButtonMask) >> 6}; } + constexpr int scroll_amount() { return (int)modifiers >> 16; } static Modifiers to_modifier(MouseButton button) { return Key::Modifiers{((int)button << 6) & (int)Modifiers::MouseButtonMask}; } Optional<Codepoint> codepoint() const; |
