Commit graph

258 commits

Author SHA1 Message Date
Daniel Eklöf
9699c9b8bf
csd: initial implementation of minimize/maximize/close buttons 2020-03-02 20:29:28 +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
875b067f13
render: csd: don't try to render a zero-width/height border 2020-03-01 13:17:54 +01:00
Daniel Eklöf
b6f8a2e422
search: enable/disable weston sub-surface desync quirk when rendering search box 2020-03-01 13:06:00 +01:00
Daniel Eklöf
a29427a185
render: search: add todo to only position sub-surface on a window resize 2020-03-01 12:54:50 +01:00
Daniel Eklöf
b8d79c719b
render: search: mark visible portion of sub-surface opaque 2020-03-01 12:54:27 +01:00
Daniel Eklöf
7b1dafae0f
render: search: kwin has problems with a resizing/repositioned sub-surface
So, make it equal to the window size, and make the non-used area fully
transparent.
2020-03-01 12:28:33 +01:00
Daniel Eklöf
f038a27366
render: csd: switch-based CSD positioning 2020-03-01 12:28:01 +01:00
Daniel Eklöf
92d638eb1c
render: csd: split up positioning from rendering 2020-02-29 18:02:38 +01:00
Daniel Eklöf
9264e1e5bd
render: don't update last 'un-maximized' size when in fullscreen 2020-02-29 17:25:08 +01:00
Daniel Eklöf
cbf657e2d2
render: resize: redraw search box, if visible 2020-02-29 11:42:00 +01:00
Daniel Eklöf
f67572208d
render: search: fix off-by-one error in number of visible characters 2020-02-29 11:41:40 +01:00
Daniel Eklöf
601dc02ea1
render: wl_subsurface_set_position() uses un-scaled coordinates
This fixes an issue where the CSDs and the search box was incorrectly
positioned when output's scale != 1.
2020-02-29 11:40:41 +01:00
Daniel Eklöf
e01030f99f
render: csd: bump title bar height from 20 -> 26 2020-02-29 09:39:05 +01:00
Daniel Eklöf
de9fcbc339
render: csd: use a struct for positioning information 2020-02-28 19:00:48 +01:00
Daniel Eklöf
45c1585bfb
render: resize: change 'resize' log from info to debug 2020-02-28 18:51:51 +01:00
Daniel Eklöf
ec2ad7755f
render: CSDs: transparent borders
This gives the illusion that window is border-less, but still gives us
surfaces the user can grab to resize the window.
2020-02-28 18:51:09 +01:00
Daniel Eklöf
e7e553ae5b
render: resize: exclude CSD borders when loading default geometry in maximized mode 2020-02-28 18:50:15 +01:00
Daniel Eklöf
b44bbb5b2b
render: CSDs: don't render borders (only title bar) in maximized mode 2020-02-28 18:49:34 +01:00
Daniel Eklöf
925088a8f2
render: color_hex_to_pixman_with_alpha(): handle alpha == 0 (transparent) 2020-02-28 18:35:21 +01:00
Daniel Eklöf
ddbfb3676c
render: remember, and use, last unmaximized size
When the compositor wants us to decide the size (it sends a configure
event with width/height == 0), then use the last unmaximized size, if
there is one.

If there isn't one, use the size from the user configuration.
2020-02-26 20:59:11 +01:00
Daniel Eklöf
3228758951
render: resize: adjust user configured size for CSDs 2020-02-26 15:27:40 +01:00
Daniel Eklöf
6eece79218
render: csd: fix typo when CSDs are positioned *inside* main surface 2020-02-26 13:22:20 +01:00
Daniel Eklöf
90efe6ec02
render: don't center grid on surface
Up until now, we've centered the grid on the main surface. Meaning, we
calculated the unusable area, added the user configured padding and
then centered the grid.

This may look nice at first, but doesn't anymore when you start
resizing the window. Resizing the window will cause the top+left
margins to change, which makes the text "jump" or "wobble".

So, now we fix the grid in the upper left corner defined by the user
configured padding (plus CSDs if they aren't positioned outside the
main surface).
2020-02-26 12:51:58 +01:00
Daniel Eklöf
1e1b204377
csd: don't draw CSDs in fullscreen mode 2020-02-26 12:39:17 +01:00
Daniel Eklöf
f960e7aff7
render: resize: ignore unconfigured windows 2020-02-26 12:21:03 +01:00
Daniel Eklöf
2f587f6f3d
csd: position CSD sub-surfaces *outside* the main window
For now, this behavior is controlled with an ifdef. At least kwin
seems very buggy when the decorations are positioned like this (but
normally you'd use server-side decorations with kwin anyway).

This commit also changes 'use_csd' to be a tri-state variable;
when instantiating a window it is set to 'unknown'.

If there's no decoration manager available (e.g. weston), we
immediately set it to 'yes' (use CSDs).

Otherwise, we wait for the decoration manager callback to indicate
whether we should use CSDs or not.
2020-02-26 12:17:58 +01:00
Daniel Eklöf
cc3dad9599
render: search: take CSD into account 2020-02-25 20:30:45 +01:00
Daniel Eklöf
ef53729242
render: resize with with/height == 0 resizes to user configured dimensions 2020-02-25 20:29:44 +01:00
Daniel Eklöf
595b32ddf9
render: render_resize_*() returns a boolean indicating whether size changed. 2020-02-25 19:51:03 +01:00
Daniel Eklöf
7db9221aa9
render: render_resize(): don't allow too small window sizes 2020-02-25 19:10:48 +01:00
Daniel Eklöf
d3c7d25dae
render: call render_csd() from render_resize(), not render_grid()
The CSDs doesn't need to be re-drawn each time we redraw the grid,
only when the window is resized.
2020-02-25 19:09:49 +01:00
Daniel Eklöf
70ce7245c6
render: export render_csd() 2020-02-25 19:09:29 +01:00
Daniel Eklöf
d15eb936ef
render: make CSD border and title size globally accessible 2020-02-25 19:08:14 +01:00
Daniel Eklöf
0b265cc9a5
render: csd: sort geometry entries 2020-02-24 22:40:02 +01:00
Daniel Eklöf
2798807853
render: csd: render all borders and the title bar
* Still no content in the title bar
* Colors are temporary
* No resize/drag yet
2020-02-24 22:06:20 +01:00
Daniel Eklöf
01a11457a5
Merge branch 'master' into csd 2020-02-24 18:47:08 +01:00
Daniel Eklöf
d804bc8579
term: resize: pre-calculate right/bottom margins 2020-02-24 18:38:11 +01:00
Daniel Eklöf
8368e8184f
csd: wip: something to get started... 2020-02-23 14:17:48 +01:00
Daniel Eklöf
85684bc0c7
render: sixel: don't render sixels on the 'other' grid 2020-02-23 00:41:28 +01:00
Daniel Eklöf
63140a68f5
sixel: calculate image height in (cell) rows 2020-02-22 00:05:25 +01:00
Daniel Eklöf
564e8909f4
render: break out sixel rendering code 2020-02-21 23:48:45 +01:00
Daniel Eklöf
f0fc82f098
sixel: wip: maintain a list of finished, and "active" sixel images
In unhook, add the generated image to a list of finished sixel images,
along with positioning and size information.

When rendering, loop this list of images, and render the images (or
parts of) that are visible.

When scrolling, check if any part of the images cover the re-cycled
lines, and if so, remove the *entire* image from the list.

This means we have the following limitations:

* The renderer always renders the whole (visible area of) the
  image(s). There are times when this isn't necessary - for example,
  when the image is scrolled inside the visible area.
* It would be nice if we could crop the image when parts of it is
  scrolled out.
2020-02-21 23:40:35 +01:00
Daniel Eklöf
9e3bfb1eab
sixel: initial support
This implements basic parsing of sixel data. Lots of limitations and
temporary solutions as this is still work-in-progress:

* Maximum image size hardcoded to 800x800
* No HLS color format support
* Image is always rendered at 0x0 in the terminal
2020-02-21 21:53:23 +01:00
Daniel Eklöf
38a682f0d0
render/grid: move grid reflow code to grid.c 2020-02-15 22:19:08 +01:00
Daniel Eklöf
b036a66c42
render: resize: take padding from configuration into account 2020-02-15 19:01:26 +01:00
Daniel Eklöf
f07a124c11
render: reflow: set 'linebreak' flag before inserting new line 2020-02-15 18:59:21 +01:00
Daniel Eklöf
3019d59369
render: reflow: remove 'linebreak' flag from recycled rows 2020-02-15 18:58:57 +01:00
Daniel Eklöf
56c2dd4199
render: reflow: no need to mark new rows as dirty 2020-02-15 18:58:36 +01:00
Daniel Eklöf
ab43a6fd37
render: resize: cancel selection before reflowing text
The old selection will no longer be valid once we resize the grids.
2020-02-15 18:57:52 +01:00