Commit Graph

4203 Commits

Author SHA1 Message Date
Tudor Brindus ec3f432bbb examples: use `perror` instead of `fprintf` GNU %m `printf` extension 2020-10-11 06:36:23 +02:00
Simon Ser 45c1a3621c backend/libinput: improve logger callback
- Add a prefix to make it clear log messages come from libinput
- Properly convert libinput log priority to wlroots'
2020-10-10 10:51:32 -04:00
Roman Gilg 86c0b9986b output-management-v1: send complete head state on enable change
The data of a head is only sent when it is enabled. While the head was disabled
data might have been changed. In this case clients were not informed about this
change. A later enable change that does not also update the other data must
still lead to the propagation of this data.

Since we do not know what other data was changed while the head was disabled
just send together with an enable change all current data.
2020-10-09 16:28:09 +02:00
Isaac Freund 8dec751a6d layer-shell: error on 0 dimension without anchors
The protocol requires clients to set opposing anchors when requesting
a width or height of 0.

The goal of this patch is not to break clients that rely on this
behavior but to improve the consistency of the layer shell ecosystem
through adherence to the protocol.
2020-10-09 15:42:46 +02:00
Rouven Czerwinski 5012121d33 xwm: add loop detection for read_surface_parent
Implement a simple loop detection while trying to retrieve the parent
for a TRANSIENT_FOR window.

Fixes swaywm/sway#4624
2020-10-08 19:32:58 +02:00
Simon Ser 87836dcb55 backend: remove check for _WAYLAND_DISPLAY
I'm not sure what this was used for, but it's not used by libwayland.
Setting _WAYLAND_DISPLAY would result in the Wayland backend being
picked but would ignore the actual value of the env variable.
2020-09-16 15:53:14 -04:00
Isaac Freund 8ad2cc39eb layer-shell: add for_each_popup
This brings the layer-shell api in line with that of xdg-shell and
avoids reimplementing this function in every compositor in order to
render layer shell popups correctly.
2020-09-10 17:44:55 +02:00
Roman Gilg bae8d7593c output-management-v1: send head identifying information
With version 2 we send make, model and serial number to allow clients the
identification of heads.
2020-09-04 21:21:18 +02:00
Roman Gilg e4a7075a9e output-management-v1: add head identifying events
The following information through separate events are added:
- make
- model
- serial_number

This should allow clients to identify a display over different sessions and
load configuration data back.

A note is added that the description should be preferred when representing a
display in UI to users but as a short form for example the model could be used
in this case of course too.
2020-09-04 21:21:18 +02:00
Ilia Bozhinov 3e03f786ee xwayland: disconnect display destroy listener even if xwayland didn't initialize 2020-09-04 17:55:23 +02:00
nerdopolis e44bed0c2b Accommodate for CONFIG_VT=0, all TTYs are in seat0, but not all
seat0s have TTYs
2020-09-04 11:46:54 +02:00
Patrick Steinhardt fa05d3cde6 session: Don't refuse unprivileged creation of "direct" backend
When starting a compositor that's using the "direct" session backend,
wlroots needs to handle calls to `drmSetMaster()` and `drmDropMaster()`.
As both calls used to require `CAP_SYS_ADMIN`, wlroots thus simply
refused starting in case the process doesn't enjoy evelated privileges.

Permission rules have changed since linux.git commit 45bc3d26c95a (drm:
rework SET_MASTER and DROP_MASTER perm handling, 2020-03-19). As a
result, starting with Linux v5.8, both ioctls will now also succeed if
the process is currently or has been the DRM master. And as the first
process to open render nodes will become the DRM master automatically,
this effectively means that process elevation is not strictly required
in all setups anymore.

So let's drop the `geteuid() != 0` permission check to allow those new
rules to do their magic.
2020-09-04 11:39:25 +02:00
Ilia Bozhinov efe6414640 wayland: emit relative pointer events only for current pointer 2020-09-04 10:13:35 +02:00
Drew DeVault a9cbfd950e Remove xdg-shell v6
Ding dong the witch is dead

Fixes #2381
2020-09-03 00:01:10 +02:00
Ryan Walklin 28cedb5623 Quieten failure to set login session type
(almost certainly due to systemd version <246)
2020-09-02 11:35:32 +02:00
Simon Ser 971de474f0 backend/session/libseat: register log handler
Route libseat errors through wlroots logging infrastructure.

This requires libseat 0.2.0.
2020-09-01 12:09:25 +02:00
Valentin 65abd4e92a Fix undefined behavior
Without the casts the bytes accesses get converted to int. but int is
not guaranteed to be 4 bytes large. Even when it is 4 bytes large
`bytes[3] << 24` does not fit because int is signed.
2020-09-01 11:58:56 +02:00
Valentin 8b744412aa Use fixed size integer type
This type is meant to be 4 bytes large as seen in _XcursorReadUInt which
always reads 4 bytes. An unsigned int is often 4 bytes large but this
isnt' guaranteed so it is cleaner to use the exact type we want.
2020-09-01 11:58:56 +02:00
Simon Ser 2b418b4d88 examples/dmabuf-capture: add extra roundtrip for wl_output listener
This example was relying on wl_display_dispatch being enough to fetch
output information. This worked by chance.

Add an explicit wl_display_roundtrip.

Other examples don't setup wl_output listeners, so they should be fine.

Fixes: 297354f847 ("Remove unnecessary wl_display_dispatch calls")
Closes: https://github.com/swaywm/wlroots/issues/2386
2020-08-31 08:43:54 -06:00
Simon Ser b0144c7ded output-power-management-v1: listen to output commit 2020-08-27 13:54:19 -06:00
Simon Ser c674241ec0 output: introduce wlr_output_event_commit
This event contains a `committed` bitfield, which allows callers to know
which output fields changed during the commit.

This allows users to setup a single atomic commit listener, instead of
setting up one listener for each event (mode, scale, transform, and so
on).

References: https://github.com/swaywm/wlroots/issues/2098
2020-08-27 13:54:19 -06:00
Guido Cella 6949d0fd38 render: Don't crash on 0 dimensions
Don't force compositors to check when an empty shape is being renderered.
References #2282. This was motivated by dwl crashing when setting window
borders to 0 (djpohly/dwl#51).
2020-08-27 17:39:31 +02:00
Isaac Freund 2072d59da5 xdg-shell: split last-acked and current state
These states are distinct in the time period between the ack_configure
and the next commit on the surface. Splitting these states avoids the
following race for example:

- client starts at 1000x1000
- wlr_xdg_toplevel_set_size 500x500
- size is different -> configure sent
- client acks the configure
- wlr_xdg_toplevel_set_size 1000x1000
- compare_xdg_toplevel_state returns true since there is no pending
  configure and the currently committed size is still 1000x1000
- no new configure is sent
- client commits at the size it last acked, 500x500
2020-08-27 12:36:29 +02:00
Kenny Levinsen 330c50b48d session: Add missing init to direct-freebsd
bad1e9afa8 ("session: Add libseat backend") introduced a change to to
how session backends initialize, but failed to update the FreeBSD
specific version of the direct backend accordingly.

Closes: https://github.com/swaywm/wlroots/issues/2376
2020-08-26 22:56:54 +02:00
Simon Ser 297354f847 Remove unnecessary wl_display_dispatch calls
wl_display_roundtrip already takes care of dispatching the display.
2020-08-24 07:55:35 -06:00
Kenny Levinsen bad1e9afa8 session: Add libseat backend 2020-08-24 11:13:55 +02:00
Ilia Bozhinov 9feeb2738d
backend/wayland: destroy relative pointer when output is disconnected
Fixes #2243
Fixes #2106
2020-08-17 11:33:57 +02:00
Simon Ser 379835c42f examples/simple: use wlr_renderer instead of GL 2020-08-14 09:57:31 -06:00
Simon Ser 801c7670b7 examples/simple: use wlr_output_preferred_mode 2020-08-14 09:57:31 -06:00
Daniel De Graaf c236f60bb6 wlr_virtual_keyboard: fix fd leak 2020-08-09 21:13:06 +02:00
Ryan Walklin 7e990a2991 Don't set XDG_SESSION_TYPE unless logind SetType succeeds 2020-08-07 19:15:25 +02:00
Ryan Walklin e81d2086c0 Also set XDG_SESSION_TYPE 2020-08-07 19:15:25 +02:00
Ryan Walklin f0d03fb892 Implement logind session SetType method to change session type to wayland 2020-08-07 19:15:25 +02:00
Simon Ser 30226eb1fb gamma-control-v1: fix use-after-free in gamma_control_handle_set_gamma
gamma_control_send_failed destroys gamma_control.
2020-08-05 18:18:11 +02:00
Ilia Bozhinov 0032954c75 make sure to fail setting gamma on disabled outputs 2020-08-03 12:05:35 +02:00
Devin J. Pohly aaf490d794 drm: fix uninitialized read
get_drm_prop_blob does not set path_len if it returns NULL.  Check the
return value before path_len to avoid reading uninitialized memory.

(Granted, this doesn't change the logic at all, but it does make
Valgrind a bit happier.)
2020-07-31 09:32:14 +02:00
Ilia Bozhinov 74f7be7287 xwayland: do not allow apps to change focus after wlroots request 2020-07-30 13:40:36 +02:00
Simon Ser 1dbcfdaf81 render/gles2: remove gles2_procs
Move the global into wlr_gles2_renderer. This removes global state and
allows us to have multiple renderers with different GL loaders.
2020-07-28 06:59:07 -06:00
Simon Ser 62da61716f render/gles2: make push/pop debug functions take a wlr_renderer 2020-07-28 06:59:07 -06:00
Simon Ser e8872d9ed7 render/gles2: keep ref to wlr_gles2_renderer in wlr_gles2_texture 2020-07-28 06:59:07 -06:00
Simon Ser 26af316b3b render/gles2: make wlr_gles2_texture_from_* private
These functions are unused by compositors (see e.g. [1]) and prevent
wlr_gles2_texture from accessing wlr_gles2_renderer state. This is an
issue for proper teardown [2] and for accessing GLES2 extensions.

[1]: https://github.com/swaywm/wlroots/pull/1962#issuecomment-569511830
[2]: https://github.com/swaywm/wlroots/pull/1962
2020-07-28 06:59:07 -06:00
Rouven Czerwinski c32d89ee3e
examples: remove unnecessary gles2.h imports 2020-07-28 13:36:09 +02:00
Scott Moreau 6d0ee53e1a xwm: Set _NET_WM_STATE_FOCUSED property for the focused surface
Certain clients require this property to be set for expected behavior.
Most notably, steam client CSD maximize button no longer worked
after unmaximizing once, unless the state was changed by another
method. The state is unset whenever another surface gains focus.
2020-07-27 14:26:30 +02:00
Antonin Décimo 1ae2d976c0 xwayland: free server in error path 2020-07-27 10:49:19 +02:00
Antonin Décimo d9bb792794 Fix incorrect format parameters 2020-07-27 10:49:19 +02:00
Ronan Pigott 39fd2335bf virtual_pointer: remember current axis for axis events 2020-07-27 10:39:41 +02:00
Simon Ser c72efcd1ce xwayland/xwm: use initializer for props in xsurface_set_wm_state
This avoids uninitialized items and makes it clear where the magic
number 2 is coming from.
2020-07-22 13:49:24 -06:00
Simon Ser 13f35139d3 xwayland/xwm: add prop count assert in xsurface_set_net_wm_state
This helps mitigate buffer overflows.
2020-07-22 13:49:24 -06:00
Simon Ser cd4827b3b6 xwayland/xwm: don't insert surface in list on error
In case wl_event_loop_add_timer errors out, don't insert the free'd
wlr_xwayland_surface in the list.

Closes: https://github.com/swaywm/wlroots/issues/1721
2020-07-22 13:48:59 -06:00
Antonin Décimo 9686895b4e Fix typos 2020-07-21 23:00:13 +02:00