Commit graph

126 commits

Author SHA1 Message Date
Daniel Eklöf
264acd6463
input: do a full CSD repaint on pointer motion over CSD buttons
This fixes repainting issues on mutter.
2020-03-03 18:22:32 +01:00
Daniel Eklöf
9699c9b8bf
csd: initial implementation of minimize/maximize/close buttons 2020-03-02 20:29:28 +01:00
Daniel Eklöf
6eae5ebd94
input: don't change xcursor if active surface isn't the main grid 2020-03-02 18:47:17 +01:00
Daniel Eklöf
22ce09eb44
config: make CSD user configurable
The user can now configure the following:

* Whether to prefer CSDs or SSDs. But note that this is only a hint to
  the compositor - it may deny our request. Furthermore, not all
  compositors implement the decoration manager protocol, meaning CSDs
  will be used regardless of the user configuration (GNOME/mutter
  being the most prominent one).
* Title bar size and color, including transparency
* Border size and color, including transparency

Also drop support for rendering the CSDs inside the main surface.
2020-03-02 18:42:49 +01:00
Daniel Eklöf
ae22366f3b
input: raise window 'move' timeout to 200ms
100ms was a bit low and prevented double-tap on touchpads from
working.
2020-03-01 13:20:07 +01:00
Daniel Eklöf
fff480e584
input: use xdg_toplevel_resize_edge enum type 2020-03-01 11:43:58 +01:00
Daniel Eklöf
ea2d7f8b8c
input: start window move right away if user starts dragging the window
When the user left-clicks the title-bar, we start a timer. When the
timer has elapsed, we initiate a 'move' operation.

However, if the user clicked, and then started dragging right away,
there was a very visible lag since we waited for the timeout before
starting the move.

Now, on a pointer motion event we detect a running 'move' timer, and
abort it and instead start the 'move' operation right away.
2020-02-29 15:38:04 +01:00
Daniel Eklöf
33744ebe63
input: fix 'unused variable' warning (release builds) 2020-02-29 15:29:58 +01:00
Daniel Eklöf
73133c10ee
input: cleanup 2020-02-29 15:29:00 +01:00
Daniel Eklöf
e496d81f4d
input: don't update xcursor on keyboard enter/leave
I'm not sure why I added this in the first place... our cursor doesn't
depend on keyboard focus.

Furthermore, with CSDs, we may get keyboard enter events for the CSD
surfaces, and these should definitely *not* update the xcursor
as if it was inside the main surface.
2020-02-29 13:04:18 +01:00
Daniel Eklöf
43b07b122a
input: csd: add a small delay before initiating a move
This ensures the user has time to double-click to toggle the maximized
state.
2020-02-29 12:56:04 +01:00
Daniel Eklöf
c917a74f48
wayland: remove all usages of wayl_terminal_from_surface()
Use the 'user data' pointer from the wayland surface instead.
2020-02-29 12:13:58 +01:00
Daniel Eklöf
43c0551806
wayland: store pointer to window instance in all surfaces 2020-02-29 12:09:28 +01:00
Daniel Eklöf
1091d1c078
input: reset mouse state on pointer leave 2020-02-29 12:08:59 +01:00
Daniel Eklöf
4ee5a81d1a
input: toggle maximized state when double-clicking the title bar 2020-02-29 11:56:16 +01:00
Daniel Eklöf
7b51d6919d
input: handle double/triple click state regardless of surface 2020-02-29 11:55:43 +01:00
Daniel Eklöf
d48a789412
input: handle CSD border corners correctly
That is, change to correct cursor, and do resize correctly.
2020-02-29 09:32:22 +01:00
Daniel Eklöf
d863ea8a46
input: temporary code to trigger maximize/minimize 2020-02-26 13:23:11 +01:00
Daniel Eklöf
c0e3db1712
input: wip: trigger move/resize when left-clicking CSD 2020-02-25 20:31:13 +01:00
Daniel Eklöf
551170d940
input: pointer-motion/button: ignore actions in non-main surfaces 2020-02-24 22:42:04 +01:00
Daniel Eklöf
7b18f8394e
input: pointer-leave: reset 'active-surface' in terminal 2020-02-24 22:41:46 +01:00
Daniel Eklöf
d303084a81
input: pointer-enter: differentiate between the surfaces 2020-02-24 22:40:24 +01:00
Daniel Eklöf
d804bc8579
term: resize: pre-calculate right/bottom margins 2020-02-24 18:38:11 +01:00
Daniel Eklöf
e5253ca737
input: fix xcursor getting stuck
Apparently, a frame callback for the cursor surface is *never*
triggered if we get a pointer-leave event *before* the callback is
triggered. At least on Sway 1.4.

This caused the cursor being stuck, and never updating once this state
was reached.

Fix by destroying the cursor frame callback on pointer-leave.
2020-02-15 19:02:43 +01:00
Daniel Eklöf
8716430450
input: ctrl+= increases font size, not resets it 2020-02-10 21:57:55 +01:00
Daniel Eklöf
1b81c700f9
input: hook ctrl+{=,0} to term_font_size_reset() 2020-02-08 17:58:06 +01:00
Daniel Eklöf
7ca8f85cd0
input: hook ctrl+{plus/KP-Add/minus/KP-Subtract} to term_font_size_{increase,decrease} 2020-02-08 14:09:28 +01:00
Daniel Eklöf
d6ea676ef2
presentation: store input timestamp in a per-commit context
This should reduce the risk of mixing up an input timestamp with the
corresponding rendered frame.
2020-01-21 18:51:04 +01:00
Daniel Eklöf
a3d919a90d
input: implement metaSendsEscape and eightBitMeta 2020-01-20 18:45:14 +01:00
Daniel Eklöf
c645a4b180
input: reset XKB compose state on keyboard leave 2020-01-14 19:32:02 +01:00
Daniel Eklöf
3a108499ce
Revert "input: generate key down events on keyboard-enter"
This reverts commit 84739d78c6.
2020-01-14 19:28:37 +01:00
Daniel Eklöf
84739d78c6
input: generate key down events on keyboard-enter 2020-01-13 19:59:18 +01:00
Daniel Eklöf
c80cbc9a79
input: reset modifier state on keyboard-leave 2020-01-13 19:58:57 +01:00
Daniel Eklöf
53a437007e
input: comments 2020-01-11 18:59:46 +01:00
Daniel Eklöf
fed0e5c853
input: keymap_lookup: only do lookup, don't sent to client 2020-01-11 18:40:27 +01:00
Daniel Eklöf
e658fe3da7
input: add a switch-based function that translates XKB keysym to escape data 2020-01-11 18:18:31 +01:00
Daniel Eklöf
8efedc9655
input: break out keymap lookup to a separate function 2020-01-11 17:55:45 +01:00
Daniel Eklöf
040a1cd00d
input: scroll: call term_mouse_up() once, after all term_mouse_down()
Note that scroll button release events are not actually sent to the
client, but this makes the code more correct, logically.
2020-01-04 21:35:38 +01:00
Daniel Eklöf
d706e68280
selection: track selection type; normal or block selection 2020-01-03 23:29:45 +01:00
Daniel Eklöf
4be3c04999
input: keyboard-leave: move comment to where it belongs 2020-01-02 19:30:34 +01:00
Daniel Eklöf
e9325b958f
term: rename term_focus_{in,out} -> term_kbd_focus_{in,out} 2020-01-02 19:29:42 +01:00
Daniel Eklöf
4ecb0ecf4d
wayland: rename focused/moused to kbd_focus/mouse_focus 2020-01-02 15:58:52 +01:00
Daniel Eklöf
5a07419096
wayland: optionally use the presentation time protocol to measure input lag
This adds a flag, -p,--presentation-timings, that enables input lag
measuring using the presentation time Wayland protocol.

When enabled, we store a timestamp when we *send* a key to the
slave. Then, when we commit a frame for rendering to the compositor,
we request presentation feedback. We also store a timestamp for when
the frame was committed.

The 'presented' callback then looks at the input and commit
timestamps, and compares it with the presented timestamp.

The delay is logged at INFO when the delay was less than one frame
interval, at WARN when it was one frame interval, and at ERR when it
was two or more frame intervals.

We also update statistic counters that we log when foot is shut down.
2019-12-31 15:39:40 +01:00
Daniel Eklöf
57de9feaa5
term: term_spawn_new(): new function, spawns a new foot/footclient process
Bind ctrl+shift+return to it
2019-12-21 15:27:17 +01:00
Daniel Eklöf
81840b4e8e
cursor blink: move reset to pty input 2019-12-19 07:23:58 +01:00
Daniel Eklöf
66b948750e
input: restart cursor blink on keyboard input
This makes the cursor stay unblinking while typing.
2019-12-16 21:33:44 +01:00
Daniel Eklöf
f1c876884a
input: discard canceled compose sequences 2019-12-02 21:32:09 +01:00
Daniel Eklöf
fbeb1e9610
term: mouse reporting functions no longer take modifier state
The mouse reporting functions are called from input when we receive
Wayland mouse events.

We used to pass the current keyboard modifier (shift, alt, ctrl, etc)
to the terminal functions.

This however is wrong, since we may receive Wayland mouse events
without having keyboard focus. When we don't have keyboard focus, the
modifier state doesn't apply to us.

Remove the modifier arguments from the terminal mouse reporting
functions. These functions now read this state directly instead, but
only when the terminal instance in question has keyboard focus.
2019-11-30 17:11:00 +01:00
Daniel Eklöf
664041d04f
input: doh! mouse_scroll: first argument to keyboard_key() is a struct wayland
This is the problem with void* user data pointers in callbacks...
2019-11-30 16:54:41 +01:00
Daniel Eklöf
6aa14ccdfc
input: mouse_scroll: cache XKB_KEY_Up and XKB_KEY_Down 2019-11-30 16:48:58 +01:00