Commit graph

481 commits

Author SHA1 Message Date
Daniel Eklöf
5c8579043d
wayland: drop ‘_surface’ suffix from subsurface struct instances 2021-02-17 21:48:08 +01:00
Daniel Eklöf
438853a2d8
render-timer: use wayl_win_subsurface_new/destroy() 2021-02-17 21:48:08 +01:00
Daniel Eklöf
c8324943de
scrollback-indicator: use wayl_win_subsurface_new/destroy() 2021-02-17 21:48:08 +01:00
Daniel Eklöf
e049124f6d
search: use wayl_win_subsurface_new/destroy() 2021-02-17 21:48:07 +01:00
Daniel Eklöf
587f04f2e1
csd: use wayl_win_subsurface_new/destroy() 2021-02-17 21:48:07 +01:00
Daniel Eklöf
9d362158e3
url-mode: convert struct wl_url to use wayl_win_subsurface_new() 2021-02-17 21:48:07 +01:00
Daniel Eklöf
34699ad3b2
render: block all signals in the rendering threads 2021-02-11 18:55:30 +01:00
Craig Barnes
3c86af52c2 Convert all but 2 remaining uses of xassert(false) to BUG("...") 2021-02-10 09:01:51 +00:00
Craig Barnes
2f81a1d07c Convert some more uses of xassert(false) to BUG("...") 2021-02-09 15:16:19 +00:00
Craig Barnes
1ec5684438 Convert some uses of xassert(false) to BUG("some error message") 2021-02-09 13:52:33 +00:00
Craig Barnes
e19db15104 render: use portable HAS_INCLUDE() wrapper instead of __has_include() 2021-02-09 03:14:08 +00:00
Daniel Eklöf
5af481cd89
render: urls: blank out keys already pressed 2021-02-07 16:33:35 +01:00
Daniel Eklöf
85f7503aec
render: urls: fix string formatter in swprintf() 2021-02-07 16:33:35 +01:00
Daniel Eklöf
b3043e92f6
render: urls: don’t use/allocate maximum allowed characters unless needed 2021-02-07 16:33:35 +01:00
Daniel Eklöf
0f57e6c422
render: render_osd(): remove ‘alpha’ parameter - it’s always 0xffff 2021-02-07 16:33:35 +01:00
Daniel Eklöf
672c414b91
render: urls: reduce vertical margin 2021-02-07 16:33:34 +01:00
Daniel Eklöf
19e23254fb
render: urls: uppercase the activation key sequence 2021-02-07 16:33:34 +01:00
Daniel Eklöf
01c0535b5a
render: urls: add TODO: highlight already entered keys 2021-02-07 16:33:34 +01:00
Daniel Eklöf
5df2e990e3
render: urls: don’t display URLs whose key sequence doesn’t match 2021-02-07 16:33:34 +01:00
Daniel Eklöf
2c10a147ea
url-mode: underline URLs using the color from colors.urls
This is implemented by allocating one of the (few!) remaining bits in
the cells’ attribute struct to indicate the cell should be “URL
highlighted”.

render_cell() looks at this bit and draws an underline using the color
from colors.urls (defaults to regular3 - i.e. yellow).

A new function, url_tag_cells(), iterates the currently detected URLs
and sets the new ‘url’ attribute flag on the affected cells.

Note: this is done in a separate function to keep urls_collect() free
from as many dependencies as possible.

urls_reset() is updated to *clear* the ‘url’ flag (and thus implicitly
also results in a grid refresh, _if_ there were any URLs).

We now exit URL mode on *any* client application input. This needs to
be so since we can’t know if the URLs we previously detected are still
valid.
2021-02-07 16:33:34 +01:00
Daniel Eklöf
6726494f4c
url-mode: store absolute row numbers in start/end coordinates
This allows us to update the jump label positions when the viewport
changes.

This in turn allows us to stay in URL mode while the user is using the
mouse to scroll in the scrollback history.

Scrolling with the keyboard is currently not possible, since input
handling in URL mode does not recognize “regular” key bindings. We
_could_ add scrollback up/down bindings to URL mode too, but lets not,
for the time being.

(Note: an alternative to this patch is to disallow mouse scrolling
too. Then we could have kept the URL start/end as viewport local
coordinates).
2021-02-07 16:33:34 +01:00
Daniel Eklöf
ee1d179b8f
config: use a bitfield for flags tracking whether to use custom colors for CSD or not 2021-02-07 16:33:33 +01:00
Daniel Eklöf
e9c3d03837
config: add colors.jump_labels and colors.urls
* colors.jump_labels configures the foreground and background colors
  used when rendering URL jump labels. Defaults to “regular0
  regular3” (i.e. black on yellow).

* colors.urls configures the color to use when highlighting URLs in
  URL mode. Note that we aren’t currently doing any
  highlighting... Defaults to regular3 (i.e. yellow).
2021-02-07 16:33:33 +01:00
Daniel Eklöf
fcbb5a0bf7
config: use a packed bitfield for “use custom color” flags 2021-02-07 16:33:33 +01:00
Daniel Eklöf
013b26d212
render: urls: tweak positioning
Don’t offset the labels too much vertically, _or_ horizontally.
2021-02-07 16:33:32 +01:00
Daniel Eklöf
d69497efe4
render: reduce URL jump label margins 2021-02-07 16:33:32 +01:00
Daniel Eklöf
eb0b244c89
render: url labels: don’t position outside window 2021-02-07 16:33:32 +01:00
Daniel Eklöf
44b7758416
render: urls: positioning: place a bit further away from the starting position 2021-02-07 16:33:31 +01:00
Daniel Eklöf
2cc84db979
urls: initial support for detecting URLs and rendering jump-labels
The jump labels work, but is currently hardcoded to use xdg-open
2021-02-07 16:33:31 +01:00
Tadeo Kondrak
95c0c89cac
Send text_input_rectangle requests for text-input 2021-01-28 22:22:01 -07:00
Daniel Eklöf
3a7588bc99
config: promote tweak.resize-delay-ms to a real, supported option 2021-01-26 19:32:21 +01:00
Daniel Eklöf
a2b3ab6d9e
render: remove unneeded parantheses 2021-01-26 19:32:07 +01:00
Daniel Eklöf
b4f1f72585
render: don’t center content while doing an interactive resize 2021-01-26 19:32:07 +01:00
Daniel Eklöf
2dc774fb17
render: remove debug logging 2021-01-26 19:32:07 +01:00
Daniel Eklöf
c82cb8bcc7
render: codespell: tiemout -> timeout 2021-01-26 19:32:07 +01:00
Daniel Eklöf
9a1df7bb03
render: delay TIOCSWINSZ while doing an interactive resize
Instead of disabling content centering, delay the TIOCSWINSZ (a.k.a
delay sending the new dimensions to the client) by a small amount
while doing an interactive resize.

Non-interactive resizes are still immediate.

For now, force a resize when the user stops the interactive
resize. This ensures the client application receives the new
dimensions immediately.

It still works without the last, forced, resize, but there typically
be a small delay until the client application receives the final
dimensions.

Closes #301
Closes #283
2021-01-26 19:32:06 +01:00
Daniel Eklöf
3948145d66
render: don’t center content while we’re being resized
Doing so causes the content to jump around while interactively
resizing the window.
2021-01-26 19:32:06 +01:00
Daniel Eklöf
a763531775
ime: fix rendering of pre-edit cursor when positioned after the pre-edit string
We failed to convert the byte-indices to cell indices, resulting in a
box cursor covering the entire pre-edit string.

Note that in addition to fixing the translation from byte index to
cell index, the rendered had to be updated to dirty one extra cell
from the original grid.

Without this, we left trailing cursors behind us when the user deleted
text from the pre-edit string.
2021-01-26 19:30:34 +01:00
Daniel Eklöf
8f3fcf8275
search: ad-hoc workaround for combining characters with positive x-offsets
When rendering the search input box, do the same ad-hoc workaround for
combining characters with a positive x-offset as we do when rendering
normal grid cells.

In this case, we don’t *know* when we’re dealing with combining
characters. But we can detect zero-width characters. For these, check
their glyph’s x-offset. If positive, adjust it like we do when
rendering combining glyphs in the main grid, to ensure the glyph is
positioned over the _previous_ character, not the next.
2021-01-26 19:29:55 +01:00
Jan Beich
f2ad02aaab
render: set thread name in a portable way
prctl is Linux-only but pthread_setname_np is same as PR_SET_NAME.
Solaris and FreeBSD >= 13 have pthread_setname_np similar to Linux.
DragonFly, OpenBSD, FreeBSD < 13 lack pthread_setname_np but provide
pthread_set_name_np which doesn't return a value. NetBSD requires 3
arguments for pthread_setname_np where the last one is void *.

render.c:8:10: fatal error: 'sys/prctl.h' file not found
 #include <sys/prctl.h>
          ^~~~~~~~~~~~~
render.c🔢9: error: implicit declaration of function 'prctl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (prctl(PR_SET_NAME, proc_title, 0, 0, 0) < 0)
        ^
render.c🔢15: error: use of undeclared identifier 'PR_SET_NAME'
    if (prctl(PR_SET_NAME, proc_title, 0, 0, 0) < 0)
              ^
2021-01-23 09:52:40 +01:00
Craig Barnes
e56136ce11 debug: rename assert() to xassert(), to avoid clashing with <assert.h> 2021-01-16 20:16:00 +00:00
Daniel Eklöf
a6fc8b5da4
config: line-height, letter-spacing: values are in pt by default, but we allow px
If the value is specified without a unit, then the value is assumed to
be in points, subject to DPI scaling.

The value can optionally have a ‘px’ suffix, in which case the value
is treated as a raw pixel count.
2021-01-11 09:31:08 +01:00
Daniel Eklöf
3eba48d74b
render: offset all glyphs with {horizontal,vertical}-letter-offset 2021-01-11 09:31:06 +01:00
Daniel Eklöf
ba48109a9b
Merge branch 'center-grid-content'
Closes #273
2021-01-07 12:08:31 +01:00
Daniel Eklöf
124759bd2c
render: sixel: fix assertion: x/y coords may be outside visible area
But when they are, width/height must be 0.
2021-01-06 16:57:07 +01:00
Daniel Eklöf
e14c592f39
config: add optional ‘center’ argument to ‘pad’
When set, the grid contents is centered in the window. I.e. the
left/right and top/bottom margins are equal (+- 1px).

This causes the content to “jump” while doing an interactive resize,
but may still be preferred in e.g. a tiling WM.

Closes #273
2021-01-06 11:17:29 +01:00
Daniel Eklöf
dc676f96ce
render: codespell: accomodate -> accommodate 2021-01-04 19:49:24 +01:00
Daniel Eklöf
482690e5fb
render: draw combining characters on top of colored bitmap glyphs (emoji) 2021-01-04 18:32:55 +01:00
Craig Barnes
39b2e46e72 Use wrappers from macros.h instead of bare GCC attributes/pragmas 2021-01-03 08:56:47 +00:00
Daniel Eklöf
5cc2f94668
Merge branch 'box-drawing'
Closes #198
2021-01-03 00:08:08 +01:00