Commit graph

4144 commits

Author SHA1 Message Date
Simon Ser
0b882475ad build: use meson.override_dependency
When built as a subproject, this removes the need for the parent project
to know about the dependency variable name.

This requires Meson 0.54.0.
2020-04-21 14:56:05 +02:00
Tudor Brindus
f0d818f36e backend/libinput: correctly populate x/y fields on tablet proximity in
Otherwise, the cursor will briefly jump to (0, 0). This is particularly
noticeable in the referenced issue (the game osu!).

Refs swaywm/sway#3633
2020-04-21 09:22:26 +02:00
Isaac Freund
85e299e6c5 Document the events of wlr_layer_surface 2020-04-17 15:44:07 +02:00
Kenny Levinsen
904c37845d logind: Close fd before releasing device
This speeds up shutdown significantly, and is in line with how Weston
does it.
2020-04-15 21:36:19 +02:00
Tudor Roman
ffcf25cc25
seat: add selection event docs 2020-04-15 17:04:40 +02:00
Isaac Freund
25d0d1be3a tinywl: remove redundant create output global call 2020-04-15 12:40:20 +02:00
Simon Ser
ab4dc1636c backend/multi: add backends at end of list
This allows wlr_multi_for_each_backend to iterate on the backends in the
order where they have been added.
2020-04-14 16:05:58 +02:00
r-c-f
f679895c77
seat: add check for NULL keyboard
Check for a NULL keyboard_state.keyboard value in
seat_client_create_keyboard() before trying to use it, as is done in
other functions like seat_client_send_repeat_info(). Prevents a segfault
in certain situations on keyboard removal, as seen in the sway issue.

Closes: https://github.com/swaywm/sway/issues/5205
Closes: https://github.com/swaywm/wlroots/issues/2073
2020-04-14 12:12:48 +02:00
Simon Ser
0281b58d2f output: fix maybe-uninitialized warning
GCC is complaining about a maybe-uninitialized variable when doing a
release build. Even if that can't actually happen because all enum
values are handled, add an abort call to silence the warning.
2020-04-10 17:05:00 +02:00
Simon Ser
83c1ba7783 backend/wayland: check scan-out buffer is compatible in output_test
If the buffer doesn't have a supported format/modifier, make the test
fail.
2020-04-10 15:52:20 +02:00
Simon Ser
50ade3671f output: check for buffer size compatibility in common code
Instead of checking for buffer size compatibility in each backend,
centralize the check in wlr_output itself.
2020-04-10 15:52:20 +02:00
Simon Ser
5f092c55d1 output: fix blurred hw cursors with fractional scaling
The scaling factor was being implicitly cast to an int.

Closes: https://github.com/swaywm/sway/issues/4927
2020-04-10 15:10:12 +02:00
Simon Ser
d10f8a98ec render: only expose linux-dmabuf if EGL extension is supported
Only expose linux-dmabuf extension if EGL_EXT_image_dmabuf_import_ext is
supported.

Closes: https://github.com/swaywm/wlroots/issues/2076
2020-04-09 00:16:03 +00:00
Simon Ser
4a1015faff render/gles2: only call wlr_egl_bind_display if supported
This allows us to hard-fail if the extension is advertised but we fail
to enable it.
2020-04-09 00:16:03 +00:00
Simon Ser
9acca4fc73 backend: set EGL_RENDERABLE_TYPE and EGL_SURFACE_TYPE
Ensure these are set to the correct value.
2020-04-09 00:15:25 +00:00
Simon Ser
6787ff521b render/egl: make config attribs const
wlr_egl_init is not allowed to mutate these attribs.
2020-04-09 00:15:25 +00:00
Simon Ser
507d9bc19e Add wlr_output_impl.rollback
Most of the pending output state is not forwarded to the backend prior
to an output commit. For instance, wlr_output_set_mode just stashes the
mode without calling any wlr_output_impl function.
wlr_output_impl.commit is responsible for applying the pending mode.

However, there are exceptions to this rule. The first one is
wlr_output_attach_render. It won't go away before renderer v6 is
complete, because it needs to set the current EGL surface.

The second one is wlr_output_attach_buffer.
wlr_output_impl.attach_buffer is removed in [1].

When wlr_output_rollback is called, all pending state is supposed to be
cleared. This works for all the state except the two exceptions
mentionned above. To fix this, introduce wlr_output_impl.rollback.

Right now, the backend resets the current EGL surface. This prevents GL
commands from affecting the output after wlr_output_rollback.

This patch is required for FBO-based outputs to work properly. The
compositor might be using FBOs for its own purposes [2], having leftover
FBO state can have bad consequences.

[1]: https://github.com/swaywm/wlroots/pull/2097
[2]: https://github.com/swaywm/wlroots/pull/2063#issuecomment-597614312
2020-04-08 17:33:00 +02:00
Simon Ser
d3bd5f2a7b backend: reset EGL surface after buffer swap
This prevents GL commands to affect a previously current EGL surface
after a buffer swap.
2020-04-08 17:33:00 +02:00
Simon Ser
6977f3a843 output: check buffer in wlr_output_test
Check that buffer can be scanned out in wlr_output_test instead of
wlr_output_attach_buffer. This allows the backend to have access to the
whole pending state when performing the check.

This brings the wlr_output API more in line with the KMS API.

This removes the need for wlr_output_attach_buffer to return a value,
and for wlr_output_impl.attach_buffer.
2020-04-08 16:31:21 +02:00
Simon Ser
e041158988 output: introduce wlr_output_test 2020-04-08 16:31:21 +02:00
Simon Ser
1fa9e0203b buffer: add width and height 2020-04-02 15:03:43 +02:00
Simon Ser
6595db6409 buffer: add a release event
Consumers call wlr_buffer_lock. Once all consumers are done with the
buffer, only the producer should have a reference to the buffer. In this
case, we can release the buffer (and let the producer re-use it).
2020-04-02 15:03:43 +02:00
Simon Ser
1674ca725c buffer: add destroy event 2020-04-02 15:03:43 +02:00
Simon Ser
7516a98167 Gracefully handle inert wl_output resources
Closes: https://github.com/swaywm/wlroots/issues/2088
2020-03-29 20:57:28 +02:00
Rabit
13db99b0f8 Prevent memory leak in copypaste of the screencopy example
If someone want to use screencopy as is processing multiple screenshots - it could be hard to find this issue with shm.
2020-03-25 20:36:12 +01:00
Scott Moreau
30308e35fa build: Add 'auto' to logind-provider combo option
The logind provider defaulted to systemd and in order to use elogind,
-Dlogin-provider=elogind was required. This adds 'auto' as a choice
for the login-provider option and sets it as default. Using 'auto',
the build will check for systemd first and if it's not found, try
to find and use elogind automatically.
2020-03-24 14:11:39 +01:00
Isaac Freund
8707a9b7ec Return false on wlr_keyboard_set_keymap() failure
This allows users of the library to handle or ignore the error as they
see fit.
2020-03-24 00:22:50 +01:00
Isaac Freund
c682d97841 Return failure of wlr_renderer_init_wl_display()
This makes it easier for the user of this library to properly handle
failure of this function.

The signature of wlr_renderer_impl.init_wl_display was also modified to
allow for proper error propagation.
2020-03-23 15:19:16 +01:00
Scott Anderson
34303e1b47 wlr_surface: Post error if multiple role objects created
This fixes an assertion failure if a client tries to do this, e.g. by
creating multiple toplevel objects for the same surface. If the same
role data is set multiple times, this does not cause an error, which is
how cursors use this interface.
2020-03-21 13:58:27 +01:00
Simon Ser
b614ded3fc backend/wayland: close keymap FD
We don't actually need the keymap. We need to close the FD or we will
run out of FDs.
2020-03-17 13:37:53 +01:00
Filip Sandborg
5ee52a3ab9
Fix uint32 overflow in fill_empty_gamma_table on Icelake platform
Closes: https://github.com/swaywm/sway/issues/4826
2020-03-15 18:41:12 +01:00
Isaac Freund
1282c3b12f Send pointer enter/leave on capability change
This is more correct according to the protocol and fixes issues with
clients that wait for an enter event before processing pointer events.
2020-03-14 00:09:32 +01:00
Isaac Freund
7c309ba4d3 Properly popluate keys array for enter on creation
This corrects an oversight made in 3f617631cb
2020-03-13 23:24:56 +01:00
Isaac Freund
3f617631cb Send keyboard enter/leave on capability change
This is more correct according to the protocol and fixes issues with
clients that wait for an enter event before processing key events
2020-03-13 22:19:51 +01:00
Simon Ser
e0bbafc253 output: replace wlr_output.damage with a damage event
This patch disambiguates the needs_frame event by uncoupling it from
damage. A new separate damage event is emitted when the backend damages
the output (this happens e.g. VT is changed or software cursors are
used). The event specifies the damaged region.

The wlr_output.damage field is removed. wlr_output is no longer
responsible for tracking its own damage, this is wlr_output_damage's
job.

This is a breaking change, but wlr_output_damage users shouldn't need an
update.

Bugs fixed:

- Screen flashes on VT switch
- Cursor damage issues on the X11 and headless backends

Closes: https://github.com/swaywm/sway/issues/5086
2020-03-12 22:47:59 +01:00
Simon Ser
07737e85cc output: add comment about needs_frame in wlr_output_schedule_frame
Add a comment to not forget why this call is necessary.

References: https://github.com/swaywm/wlroots/pull/2053
2020-03-12 15:01:09 +01:00
Simon Ser
41f9916ae5 buffer: remove unused wlr_client_buffer fields
Forgot to remove these, they are superseded by fields in wlr_buffer. Some
functions were still using them.

Fixes: 8afc1ed68c ("Introduce wlr_client_buffer")
Closes: https://github.com/swaywm/sway/issues/5087
2020-03-09 19:26:12 +01:00
Simon Ser
a71649dde9 render/gles2: remove duplicated format list 2020-03-09 15:26:28 +01:00
Simon Ser
e7f8cc6801 util/log: improve time prefix
Log milliseconds. This is useful when debugging a rendering loop.

Print the time relative to the compositor start-up.
2020-03-07 00:25:01 +01:00
Simon Ser
7bce056f1d output: don't send a needs_frame event if already sent 2020-03-06 21:35:00 +01:00
Simon Ser
a4c7c6db09 output: make wlr_output_schedule_frame set output->needs_frame
This way, wlr_output_schedule_frame will always be followed by a
wlr_output_commit. This forces the compositor to render an extra
frame before stopping the rendering loop.

To test, run wleird's frame-callback [1], make sure it's the only
visible client on the output and check the interval between frame
events is the output's refresh period instead of zero.

[1]: https://github.com/emersion/wleird/blob/master/frame-callback.c

Closes: https://github.com/swaywm/wlroots/issues/2051
2020-03-06 21:35:00 +01:00
Simon Ser
4bb391c896 xwayland: remove underscore prefix from atom names
Previously, some atoms had a leading underscore, others didn't. Be more
consistent and never use a leading underscore (symbols with a leading
underscore followed by an upper-case letter are reserved).
2020-03-06 21:34:44 +01:00
Simon Ser
175af4f74f xwayland: remove duplicate _NET_WM_NAME entry 2020-03-06 21:34:44 +01:00
Simon Ser
68a69ee079 xwayland: use explicit indexes when initializing atom_map
It's very easy to break the mapping between the atom_name enum and the
atom_map array. Use explicit indexes to prevent issues.
2020-03-06 21:34:44 +01:00
Simon Ser
52c67284e2 backend/drm: add support for adaptive_sync_enabled
The vrr_capable and VRR_ENABLED properties are used.
2020-03-06 21:32:58 +01:00
Simon Ser
9be1af3afb backend/x11: add support for adaptive_sync_enabled
This sets the _VARIABLE_REFRESH window property [1].

[1]: 0616b7ac90/src/vulkan/wsi/wsi_common_x11.c (L1374)
2020-03-06 21:32:58 +01:00
Simon Ser
7017fa95b8 output: add adaptive_sync_enabled property 2020-03-06 21:32:58 +01:00
Simon Ser
8afc1ed68c Introduce wlr_client_buffer
Split out the client/resource handling out of wlr_buffer by introducing
wlr_client_buffer. Make wlr_buffer an interface so that compositors can
create their own wlr_buffers (e.g. backed by GBM, like glider [1]).

[1]: c66847dd1c/include/gbm_allocator.h (L7)
2020-03-06 21:32:06 +01:00
Jan Beich
8d2e8d8a06 xcursor: also look for cursor themes under ${datadir}/icons by default
Same as https://gitlab.freedesktop.org/wayland/wayland/commit/dd8891be36ec
2020-03-04 10:02:31 +01:00
Simon Ser
a3c699eee5 backend/wayland: fix seat caps handling
Previously, each time a wl_seat.capabilities event was received the
Wayland backend created new input devices. It now only does so the first
time.

Input devices are now destroyed when the cap is removed.

Closes: https://github.com/swaywm/sway/issues/5055
2020-03-04 09:57:10 +01:00