Commit graph

1027 commits

Author SHA1 Message Date
Daniel Eklöf
f0ad3d3afc
font: log fontconfig/freetype version when debug logging has been enabled 2019-12-01 11:38:20 +01:00
Daniel Eklöf
3df292a944
Revert "font: ceil:ing the top value seems to look better when scaled"
This reverts commit 95d97b3973.
2019-12-01 11:33:22 +01:00
Daniel Eklöf
95d97b3973
font: ceil:ing the top value seems to look better when scaled 2019-11-30 23:31:51 +01:00
Daniel Eklöf
16c25f9a8f
font: fix estimated underline thickness; descent is typically negative 2019-11-30 23:16:50 +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
2208f4304b
term: add term_mouse_grabbed()
When this returns true, it means we have keyboard focus and are
grabbing the mouse (for e.g. selections), regardless of whether the
client has enabled mouse tracking or not.
2019-11-30 17:06:15 +01:00
Daniel Eklöf
5d2b2dc8a7
commands: scrollback: don't scrollback if mouse tracking is enabled 2019-11-30 16:57:52 +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
caee8db89a
commands: scrollback: don't scrollback if mouse tracking is enabled 2019-11-30 16:49:38 +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
Daniel Eklöf
62ed0ef4f2
term: "raw" mouse mode requires shift only to be pressed 2019-11-30 16:48:32 +01:00
Daniel Eklöf
90bfcc1fbd
render: fix underline/strikeout positioning
There were two errors:

* We subtracted half the line width instead of adding it to the
  baseline

* We rounded the line positioning and thickness before the positioning
  calculation. In particular, rounding the thickness before using it
  to adjust the position was wrong. Now we round just before the
  pixman call.
2019-11-30 14:53:22 +01:00
Daniel Eklöf
7be98291e1
render: font_baseline(): simply use the primary font's ascent
This is what we used as baseline for regular glyphs anyway. Thus, we
can update that code to call font_baseline() now. This makes it easier
to change how we define the baseline in the future.
2019-11-30 14:51:44 +01:00
Daniel Eklöf
719d521e33
font: bug: bad multiplier when converting from 16.16 fixed float 2019-11-30 13:10:20 +01:00
Daniel Eklöf
8f8ef5df0e
term: define xcursor strings as global variables 2019-11-30 12:43:06 +01:00
Daniel Eklöf
10f563dc6b
font: cache_size -> glyph_cache_size
This makes it more clear it has nothing to do with the font cache.
2019-11-30 12:41:09 +01:00
Daniel Eklöf
7a4d1b1a6e
font: destructor: pop elements as we go
Otherwise we'll end up free:ing the same font over and over again.
2019-11-30 12:39:18 +01:00
Daniel Eklöf
4e1a6b5739
font: original -> requested 2019-11-30 12:38:54 +01:00
Daniel Eklöf
62a239bcd1
font: log freetype errors 2019-11-30 12:35:07 +01:00
Daniel Eklöf
a87b39f6eb
wayland: track current xcursor, and don't update if same
We may have many windows open, which tries to update/change the
xcursor at various points.

Track which cursor is currently loaded, regardless of which window it
was set by. If someone tries to load that very same xcursor again,
simply skip it.

One example is when we've moused over a window that does *not* have
keyboard focus, and then the user clicks, or by some other mean gives
that window keyboard focus. In many cases it will then try to set the
same cursor again (most of the times, the cursor is the same
regardless of keyboard focus, but not always).
2019-11-30 12:09:57 +01:00
Daniel Eklöf
841e20b75b
input: update xcursor on terminal with *keyboard* focus when modifiers change 2019-11-30 12:02:45 +01:00
Daniel Eklöf
c8d94931e6
term: xcursor: use selection_enabled()
Instead of duplicating the code from selection_enabled() that deals
with forced selection, just call selection_enabled().

This was previously not possible since selection_enabled() didn't
require keyboard_focus. Now it does.
2019-11-30 12:01:40 +01:00
Daniel Eklöf
edb78575c7
selection: forced selection requires keyboard focus
Up the requirements for enabling "forced" selection (that is, allowing
selections even though mouse tracking has been disabled).

* Require keyboard focus (if we don't have it, then the shift-key
  isn't is for us)
* Don't just require shift being pressed, but that all other modifiers
  are *not* pressed.
2019-11-30 11:59:47 +01:00
Daniel Eklöf
0e5a69d869
vt: don't try to move cursor outside the terminal
When we insert an auto-newline, we must make sure we don't try to move
outside the terminal window.

This can for example happen when a scrolling region have been
configured, and the cursor is **outside** the scrolling
region (i.e. it's in the bottom margin).
2019-11-30 00:32:34 +01:00
Daniel Eklöf
a81c65caa2
term: reset: set 'origin' to ORIGIN_ABSOLUTE 2019-11-30 00:32:06 +01:00
Daniel Eklöf
8274e3e034
font: never set glyph->cols to something that is less than 0 2019-11-30 00:15:54 +01:00
Daniel Eklöf
88c1a8939f
vt: fix memory corruption: wcwidth() may return -1
When it did, we called print_insert() with that, which in turn
resulted in a too large size value passed to memmove.
2019-11-30 00:15:05 +01:00
Daniel Eklöf
9551be492c
csi/vt: don't bad client data as errors
This gets rid of spam when cat:ing binary data.
2019-11-30 00:12:30 +01:00
Daniel Eklöf
66f941d00a
vt: only define esc_as_string() when debug logging has been enabled 2019-11-30 00:02:19 +01:00
Daniel Eklöf
cd9510aa7b
vt: disable logging BELL 2019-11-30 00:00:41 +01:00
Daniel Eklöf
616896e2a5
csi/ocs/vt: log unhandled/unrecognized sequences as debug messages
Having them as error messages was nice when we where still missing
lots of sequences.

Now we don't anymore, and these just spam stdout as well as syslog
when e.g. cat:ing binary data.
2019-11-29 23:59:24 +01:00
Daniel Eklöf
3026b8981a
vt: there are actually many state transitions that are no-ops
In most states, most 8-bit values are no-ops. This is already handled;
action() recognizes ACTION_NONE as a no-op. Thus, all we need to do is
remove the assertion.
2019-11-29 23:38:01 +01:00
Daniel Eklöf
8b7158703d
term: reset: don't access rows directly
We've just re-set the grid offsets, meaning rows 0..term->rows may not
all have been initialized.

Call grid_row_and_alloc() to ensure they are.
2019-11-29 23:36:04 +01:00
Daniel Eklöf
bf9a9e7b90
term: xcursor: use 'hand2' instead of 'left_ptr' when mouse tracking
Mouse tracking always reports clicks, so using a cursor that suggests
you can click makes sense I think.
2019-11-29 22:30:56 +01:00
Daniel Eklöf
f41788c185
term: xcursor cleanup
Show 'text' cursor when:

* we have no mouse tracking enabled
* forced selection has been enabled (shift being held down)
* We're *not* scrollback searching

In all other cases, show the 'left_ptr' cursor.
2019-11-29 22:15:03 +01:00
Daniel Eklöf
2c12549f93
input: pointer-leave: reset moused *before* doing anything else
And update xcursor. This is currently not necessary, but doesn't hurt.
2019-11-29 22:13:19 +01:00
Daniel Eklöf
6947928a7f
input: pointer-enter: add debug log 2019-11-29 22:12:54 +01:00
Daniel Eklöf
6b9837056e
input: keyboard_leave: reset focused *before* doing anything else
And update xcursor. This is necessary since we may still have mouse
focus. But without keyboard focus, we don't display the 'text'
xcursor.
2019-11-29 22:11:41 +01:00
Daniel Eklöf
876cd6895f
search: update xcursor when starting and ending a search 2019-11-29 22:11:15 +01:00
Daniel Eklöf
c8724fe656
wayland: terminal_from_surface: recognize scrollback search surfaces
This fixes an assertion when hovering over the input field for
scrollback searches.
2019-11-29 22:10:28 +01:00
Daniel Eklöf
304ee33fd6
wayland: always flush after dispatching messages
This means we don't have to e.g. roundtrip when setting the cursor.
2019-11-29 22:09:56 +01:00
Daniel Eklöf
c2e81cd4b2
doc: foot.1: mention that selection is kept after ending a scrollback search 2019-11-29 22:09:08 +01:00
Daniel Eklöf
cb168ec8d7
font: add missing ';' 2019-11-28 21:33:45 +01:00
Daniel Eklöf
bd3f2fdf0e
font: use pixelsizefixupfactor on regular bitmap fonts too, if set
But if it isn't set, only estimate it if the font is a *scalable*
non-outline (bitmap) font.
2019-11-28 21:32:28 +01:00
Daniel Eklöf
b58fd1c205
osc 52: default to 'clipboard' if no source/target has been specified 2019-11-28 20:56:55 +01:00
Daniel Eklöf
2956a7d472
input: keyboard/pointer_leave: warn if we didn't see corresponding enter event 2019-11-28 19:47:00 +01:00
Daniel Eklöf
a319cc813c
input: keyboard/pointer_enter: assert surface != NULL 2019-11-28 19:46:27 +01:00
Daniel Eklöf
0dd37f0a36
terminal: use the 'text' xcursor pointer whenever selection is possible 2019-11-28 19:35:47 +01:00
Daniel Eklöf
729ba8b8ac
input: pointer_button: apply same workaround as in pointer_motion
Sway 1.2 has been seen to send pointer_button events without first
having sent pointer_enter.
2019-11-28 19:26:52 +01:00
Daniel Eklöf
9efa28b4c6
input: sway 1.2 bug: keyboard_leave() called with surface == NULL 2019-11-28 19:24:16 +01:00