Commit Graph

286 Commits

Author SHA1 Message Date
Simon Ser e3ab52af7b backend/x11: add error logging to query_dri3_drm_fd() 2024-03-02 13:14:12 +01:00
Simon Ser 488a23c169 pointer: drop enum wlr_axis_orientation
Instead, use enum wl_pointer_axis from the Wayland protocol.
2024-02-28 16:39:18 +00:00
Simon Ser 812451cd8f pointer: use enum wl_pointer_button_state 2024-02-28 16:39:18 +00:00
Simon Ser 9f4cf242d9 pointer: drop enum wlr_axis_source
Instead, use enum wl_pointer_axis_source from the Wayland protocol.
2024-02-28 16:39:18 +00:00
Simon Ser 842093bb84 Define _POSIX_C_SOURCE globally
Stop trying to maintain a per-file _POSIX_C_SOURCE. Instead,
require POSIX.1-2008 globally. A lot of core source files depend
on that already.

Some care must be taken on a few select files where we need a bit
more than POSIX. Some files need XSI extensions (_XOPEN_SOURCE) and
some files need BSD extensions (_DEFAULT_SOURCE). In both cases,
these feature test macros imply _POSIX_C_SOURCE. Make sure to not
define both these macros and _POSIX_C_SOURCE explicitly to avoid
POSIX requirement conflicts (e.g. _POSIX_C_SOURCE says POSIX.1-2001
but _XOPEN_SOURCE says POSIX.1-2008).

Additionally, there is one special case in render/vulkan/vulkan.c.
That file needs major()/minor(), and these are system-specific.
On FreeBSD, _POSIX_C_SOURCE hides system-specific symbols so we need
to make sure it's not defined for this file. On Linux, we can
explicitly include <sys/sysmacros.h> and ensure that apart from
symbols defined there the file only uses POSIX toys.
2024-02-15 15:41:12 +01:00
Simon Ser b62ac611c8 backend/x11: take wl_event_loop instead of wl_display 2024-01-25 15:05:36 +00:00
Simon Ser 3cc4374542 backend: stop calling wl_display_terminate()
Leave it up to the compositor to decide what to do when a backend
becomes unavailable.
2024-01-25 14:58:00 +03:00
Kirill Primak db69dcf767 backend/x11: handle touchpoint allocation failure 2024-01-17 15:44:37 +00:00
Simon Ser a0b1329ee6 Fix bool return types
This makes wlroots build in C23 mode.

C23 is more strict and rejects implicit conversions from bool to a
pointer.
2024-01-04 22:24:06 +01:00
Alexander Orzechowski 8ac5139007 backend/x11: Use wlr_texture_read_pixels 2023-11-30 20:01:12 -05:00
Kirill Primak 4990ed99eb backend/x11: don't send ConfigureRequest with the same size
Under X11, ConfigureNotify means that the window has already been resized.
Sending ConfigureRequest with the received size is not only useless, but also
can confuse the window manager, which will probably reply with the current
(i.e. *old*) size causing a configure loop.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3769
2023-11-27 09:46:11 +00:00
Kirill Primak 4102b722d9 backend/x11: check buffer format in output_test() 2023-11-26 23:11:28 +03:00
Simon Ser 56ec13596a Cleanup wlr_matrix.h includes
Many files used to require wlr_matrix but no longer do.
2023-11-25 08:37:43 +01:00
Simon Ser d61ec694b3 output: take wl_event_loop in wlr_output_init()
We don't need the whole wl_display here anymore. The wl_event_loop
is enough.
2023-11-23 11:39:25 +00:00
Alexander Orzechowski 1b0694b794 treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical 2023-10-03 01:51:07 -04:00
Simon Ser e5fc8cd4c7 output: trigger frame/present events on all commits on enabled output
Up until now, frame/present events were only triggered when the
user submitted a buffer. Change the wlr_output API so that these
events are triggered when any commit is applied on an enabled
output.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3708
2023-08-23 15:42:22 +00:00
Alexander Orzechowski 869b0f14bc backend/x11: Use output state to set init custom mode 2023-08-16 11:46:27 -04:00
Alexander Orzechowski 6cda3e251c output: Add initialization state to wlr_output_init 2023-08-16 11:46:27 -04:00
Brett Ernst 7ce4d557c5 backend/x11: log output test failure reasons 2023-07-18 15:27:44 -07:00
Simon Ser fe06e5f49a Use wl_container_of() instead of casts
This slightly improves type safety.

The culprits were found with:

    git grep -E '\([a-z0-9_ ]+ \*\)\W?[a-z]'
2023-07-11 20:16:17 +02:00
Simon Ser e1bdc62c38 backend/x11: leave new outputs disabled by default 2023-06-27 16:26:30 +00:00
Simon Ser bfe8138210 backend/x11: unmap when output is disabled 2023-06-27 16:26:30 +00:00
Alexander Orzechowski 8243399385 output: Set output mode during main commit
Removes duplication across all the backends to finally apply the mode
to the output.
2023-06-27 11:47:58 -04:00
Alexander Orzechowski 99314aac9f backend/x11: Reject non 0 refresh rate mode sets 2023-06-27 11:45:44 -04:00
Simon Ser be05097968 output: add wlr_output_state_init()
This changes the semantics of wlr_output_state. Instead of having
fields with uninitialized memory when missing from the committed
bitflag, all fields are always initialized (and maybe NULL/empty),
just like we do in wlr_surface_state. This reduces the chances of
footguns when reading a field, and removes the need to check for
the committed bitfield everywhere.

A new wlr_output_state_init() function takes care of initializing
the Pixman region.
2023-06-23 18:07:26 +00:00
ptrcnull 56502be1d1 backend/x11: prevent segfault on empty DRI3 response 2022-05-01 06:13:58 +02:00
Kirill Primak 9c7db7124e backend/x11: fix delta_discrete value
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3563
2023-01-16 14:19:44 +03:00
Simon Ser bc8260f377 backend/x11: fix initial value of wlr_x11_buffer.n_busy
We lock the buffer there, so we need to initialize the n_busy
count to 1 as well.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3556
2023-01-03 10:59:57 +01:00
Simon Ser 86fc2199f8 build: unify naming for HAVE_* defines
We sometimes used HAS_, sometimes polluted the LIBINPUT_ namespace,
etc.
2022-12-06 22:39:45 +00:00
Simon Ser afe1ae4479 backend/x11: ensure buffers are released on shutdown 2022-12-06 20:22:55 +01:00
Simon Ser 3ef68a4842 backend/x11: use request_state when window is resized 2022-11-15 15:39:55 +00:00
Simon Ser feb5691240 backend: remove const casts for pixman_region32_t
Pixman 0.42.0 has constified APIs for pixman_region32_t. We no longer
need the casts.
2022-11-11 23:11:17 +00:00
Simon Ser a28caf08e3 backend: use global output name counters
The output names must be globally unique per the Wayland spec, even
if the compositor creates multiple backends of the same kind.
2022-10-13 13:12:43 +02:00
Simon Ser 6832ae14aa render: drop wlr_renderer_read_pixels() flags
These are unused.
2022-10-04 09:15:19 +02:00
Isaac Freund 135e60ff82 backend/x11: report adaptive sync as enabled
All we can do to influence adaptive sync on the X11 backend is set the
_VARIABLE_REFRESH window property like mesa automatically does. We don't
have any control beyond that, so we set the state to enabled on creating
the output and never allow changing it (just like the Wayland backend).
2022-08-30 17:53:50 +00:00
Simon Ser 8c70245d5f output: fail commits if adaptive sync cannot be enabled
Previously, adaptive sync was just a hint and wouldn't make any
atomic commit fail if the backend didn't support it. The main reason
is wlr_output_test wasn't supported at the time.

Now that we have a way for compositors to test whether a change can
work, let's remove the exception for adaptive sync and convert it to
a regular output state field.
2022-08-30 17:53:50 +00:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Isaac Freund 91943a68a6 wlr_input_device: remove anon union field
This union is unnecessary since the recent input device refactor and can
now be replaced by wlr_*_from_input_device() functions.
2022-06-21 18:42:07 +00:00
Simon Ser 25dd3cc0cd output: pass wlr_output_state to backend
Groundwork for the following commits. The goal is to allow users
to specify their own wlr_output_state instead of wlr_output.pending.
2022-05-30 11:34:57 +02:00
Simon Ser 4f5d6e4746 backend/x11: fix output model strdup call
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3434#note_1401193
Fixes: be86145322 ("output: turn make/model/serial into char *")
2022-05-27 13:21:50 +00:00
Simon Ser be86145322 output: turn make/model/serial into char *
This allows the make/model/serial to be NULL when unset, and allows
them to be longer than the hardcoded array length.

This is a breaking change: compositors need to handle the new NULL
case, and we stop setting make/model to useless "headless" or
"wayland" strings.
2022-05-26 13:36:06 +00:00
Simon Zeni aaf787ee56 types/wlr_touch: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni 9a17200446 types/wlr_keyboard: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni bd6c000d14 types/wlr_pointer: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni a92e5f8d46 types/wlr_input_device: move output_name field to wlr_pointer and wlr_touch 2022-03-17 13:44:18 -04:00
Simon Zeni 10cbb9fbe1 interface/wlr_touch: rework destroy sequence
The destroy callback in wlr_touch_impl has been removed. The function
`wlr_touch_finish` has been introduced to clean up the resources owned by a
wlr_touch.

`wlr_input_device_destroy` no longer destroys the wlr_touch, attempting to
destroy a wlr_touch will result in a no-op.

The field `name` has been added to the wlr_touch_impl to be able to identify
a given wlr_touch device.
2022-03-07 16:37:41 +00:00
Simon Zeni 51cd3c0726 interface/wlr_pointer: rework destroy sequence
The destroy callback in wlr_pointer_impl has been removed. The function
`wlr_pointer_finish` has been introduced to clean up the resources owned by a
wlr_pointer.

`wlr_input_device_destroy` no longer destroys the wlr_pointer, attempting to
destroy a wlr_pointer will result in a no-op.

The field `name` has been added to the wlr_pointer_impl to be able to identify
a given wlr_pointer device.
2022-03-07 16:37:41 +00:00
Simon Zeni 7dc4a3ecd7 interface/wlr_keyboard: rework destroy sequence
The destroy member in wlr_keyboard_impl has been removed. The function
`wlr_keyboard_finish` has been introduce to clean up the resources owned by a
wlr_keyboard.

`wlr_input_device_destroy` no longer destroys the wlr_keyboard, attempting to
destroy a wlr_keyboard will result in a no-op.

The field `name` has been added to the wlr_keyboard_impl to be able to identify
a given wlr_keyboard device.
2022-03-07 16:37:41 +00:00
Simon Zeni e279266f71 interfaces: remove wlr_input_device_impl 2022-02-22 14:23:46 -05:00
Simon Zeni 19f7e5d2b4 backend/x11: remove wlr_input_device_impl 2022-02-21 13:53:40 -05:00