Commit graph

1589 commits

Author SHA1 Message Date
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
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
5717a0dfb0
config: change default geometry from 800x600 -> 700x500
If the display resolution *is* 800x600, using this size is bad since
there will typically be panels and other things on the screen too.

Not that 800x600 is something we expect to see in real life, but may
happen on virtual displays.
2020-02-29 11:01:23 +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
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
8c98dfc51a
term: loop through all sub-surfaces when switching sync/desync mode 2020-02-29 09:26:49 +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
6ba476b3bd
wayland: configure: work around GNOME/mutter weirdness
When resizing the window under mutter, mutter seems to expect a
configure ack *and* a surface commit *right* away, or things get out
of sync.

Unlike kwin, which is requires a commit for each configure ack, but is
fine with having the commit arrive later (after we've rendered it),
mutter is not.

I even tried delaying the configure ack until just before the commit,
but still no go.

So for now, detect when we're running under mutter and always do a
surface commit right away.

This can *not* be done on any other compositor as it breaks the CSD
and main surface synchronization; we've resized the CSDs, but not the
main surface.

I.e. this *should* not work, but for some reason is the *only* way to
make things work on mutter.

Interestingly, doing it any other way on mutter causes visual
glitches; window jumping around when resizing, or de-synchronized
CSDs/main surface.
2020-02-28 18:43:33 +01:00
Daniel Eklöf
b69c9b5f58
wayland: fix window size adjustment for CSDs placed outside main surface
* Do this both in XDG configure, and when the decoration manager
  switches between CSDs/SSDs at run-time.

* Exclude CSD borders when we're maximized
2020-02-28 18:42:10 +01:00
Daniel Eklöf
6c20abf279
wayland: warn when compositor doesn't implement the decoration manager interface 2020-02-28 18:37:07 +01:00
Daniel Eklöf
7d021b5b37
wayland: request server side decorations 2020-02-28 18:36:52 +01:00
Daniel Eklöf
3c7e17e8c1
wayland: drop required wl_output interface version from 3 -> 2
We don't need version 3, and mutter 3.34 only implements version 2.
2020-02-28 18:35:50 +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
40f3d4c24c
terminal: error out when we fail to load the primary font 2020-02-28 18:35:05 +01:00
Daniel Eklöf
3a9a2bb6a4
config: add default font when using the default config
When there is no configuration file, and we're using the default
configuration, we accidentally jumped pasted the code that ensures
we have at least "monospace" in the font list.
2020-02-28 18:33:30 +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
77b37fb288
wayland: once again switch to positioning CSDs outside the main surface 2020-02-26 20:45:44 +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
66decac16b
wayland: document what FOOT_CSD_OUTSIDE does 2020-02-26 13:49:54 +01:00
Daniel Eklöf
1ccfceca05
wayland: switch back to positioning CSDs inside the main surface 2020-02-26 13:47:29 +01:00
Daniel Eklöf
02fedfb2fc
wayland: resize main surface when enabling CSDs runtime
When we position CSDs inside the main surface, and CSDs are switched
on run-time, we need to force a grid resize, since the actual window
content will now be smaller.

Alternative solution: call resize with width/height increased, to
account for the CSDs. This would increase the window size, but would
keep the grid size fixed.
2020-02-26 13:46:37 +01:00
Daniel Eklöf
d863ea8a46
input: temporary code to trigger maximize/minimize 2020-02-26 13:23:11 +01:00
Daniel Eklöf
5fbbd2f80e
wayland: track window maximized state 2020-02-26 13:23:00 +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
020ce60778
wayland: don't adjust size when CSDs are positioned inside main surface 2020-02-26 13:02:15 +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
6ca880bd3e
wayland: disable debug logs 2020-02-26 12:47:00 +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
be5988dd3a
wayland: decoration configure: no need to force a resize - just update the CSDs 2020-02-26 12:28:12 +01:00
Daniel Eklöf
135ca0884d
wayland: configure: adjust configured size when using CSDs
The size (width, height) arguments provided by the compositor in the
XDG toplevel configure event *include* the surrounding CSDs.

Since our code assumes the size is for the main surface only (and then
positions the sub-surfaces *outside* the main surface), adjust the
provided size when using CSDs.

This ensures our actual window size ends up being what the compositor
wants it to be, and it fixes resize-glitches when resizing using CSDs.
2020-02-26 12:26:03 +01:00
Daniel Eklöf
ea97a0dc87
wayland: instantiate sub-surfaces on-demand
While most compositors handle instantiated but not-yet-mapped
sub-surfaces correctly, e.g. kwin does not.

For example, it will incorrectly offset the main surface both
horizontally and vertically with a couple of pixels, leaving two
transparent areas at the top and left, between the SSDs and the main
surface.

Note that a workaround is to position the sub-surfaces inside the main
surface while they're unmapped. However, since the surfaces may be
larger than the main surface (the CSDs, for examples, always are),
this doesn't quite work since kwin, at least, resizes the window to
include the sub-surfaces, even when unmapped.

So, instead we instantiate all sub-surfaces on demand, when we know
where to position them, and when they should be mapped.
2020-02-26 12:22:16 +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
45ba9f9c8f
grid: grid_reflow(): may be called with old_rows/cols == new_rows/cols
TODO: avoid calling grid_reflow() in this case.
2020-02-25 20:33:27 +01:00
Daniel Eklöf
e9d3e7d87f
term: visual_focus_in/out: redraw CSDs
We draw the CSDs in a darker color when we're inactive.

Weston seems to be buggy with synchronized subsurfaces, so temporarily
reconfigure them to desynchronized surfaces.
2020-02-25 20:31:37 +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
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
2855d06c6e
wayland: mark the whole search surface as opaque 2020-02-25 19:57:19 +01:00
Daniel Eklöf
f05e0ad0ae
wayland: synchronize the CSD surfaces to the main surface 2020-02-25 19:56:56 +01:00
Daniel Eklöf
7e26d96d17
wayland: default to CSDs
Only when the compositor implements the XDG decoration manager
interface, and it tells us to use server side decorations to we do so.
2020-02-25 19:56:23 +01:00
Daniel Eklöf
8af5bf49b0
wayland: weston does not implement the xdg decoration manager interface 2020-02-25 19:56:17 +01:00