Commit graph

2053 commits

Author SHA1 Message Date
Daniel Eklöf
3ec50369ce
search: update search box before we update the main grid 2020-03-01 12:24:37 +01:00
Daniel Eklöf
9d834bb43d
shm: log 'size' when failing to fallocate() 2020-03-01 12:19:28 +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
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
d6f0a47fb8
wayland: always update window->is_fullscreen, not just when using CSDs 2020-02-29 17:24:45 +01:00
Daniel Eklöf
32a3f56710
wayland: don't resize when we're not mapped anywhere
Normally, we resize and update the font's DPI whenever our window
enters or leaves an output.

This is since a change in the outputs we're mapped on means the scale
factor to use, or the DPI to use for the fonts may have changed.

However, a special case is when we're removed from the last
output. This should only happen at shutdown, when we're un-mapping
ourselves.

In this case, we typically don't have a access to e.g. the PTMX
fd (often, the reason we're shutting down is because the client
exited). This resulted in (harmless) error messages when emitting the
TIOCSWINSZ event.

Since we're shutting down anyway, we can simply skip the resize and
everything. This gets rid of the error message, and also means we're
shutting down faster.
2020-02-29 15:46:40 +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
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