Commit Graph

23 Commits

Author SHA1 Message Date
Simon Ser 65bf7d1679 examples: send xdg_toplevel configure events
Commit 811ca199c4 ("xdg-shell: drop automatic surface configuration")
has updated tinywl for the breaking change, but missed examples.
2024-03-15 13:20:35 +01: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 d1b39b5843 backend: take wl_event_loop instead of wl_display in wlr_backend_autocreate() 2024-01-25 15:05:36 +00:00
Simon Ser 5717e27c06 output: take wl_display in wlr_output_create_global()
Currently wlr_output holds a wl_display, but it will go away soon.
Instead of relying on that field in wlr_output_create_global(),
make the dependency explicit by taking a wl_display as argument.
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
Rose Hudson 214df8eda0 scene_output: optionally record and report timings 2023-07-10 09:57:02 +00:00
Simon Ser 2aabaf8809 examples: enable new outputs 2023-06-27 16:26:30 +00: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
Alexander Orzechowski 495bcbeedd examples: Drop usage of wlr_output.pending 2023-06-13 09:19:51 +00:00
Simon Ser 0bb574239d compositor: pass version in wlr_compositor_create
This allows wlroots to support newer versions of the interface
without breaking the API.
2023-04-14 17:07:26 +02:00
Simon Ser 41b7acbab7 backend: return wlr_session in wlr_backend_autocreate() call
Up until now, wlr_backend_autocreate() created the wlr_session and
then stuffed it into struct wlr_multi_backend so that compositors
can grab it later.

This is an abuse of wlr_multi_backend and the wlr_backend API:
wlr_backend_get_session() and wlr_multi_backend.session only exist
to accomodate the needs of wlr_backend_autocreate(). What's more,
the DRM and libinput backends don't implement
wlr_backend_impl.get_session.

Instead, return the struct wlr_session to the compositor in the
wlr_backend_autocreate() call. wlr_backend_get_session() will be
removed in the next commit.
2022-11-15 21:16:25 +00:00
Alexander Orzechowski ccd0f85c2a wlr_scene: Only allow parenting on a wlr_scene_tree 2022-05-31 09:14:28 +00:00
Alexander Orzechowski 9eb71146ae wlr_scene: Refactor wlr_scene (the root element) to encase a wlr_scene_tree
Co-authored-by: Isaac Freund <mail@isaacfreund.com>
2022-05-31 09:14:28 +00:00
Alexander Orzechowski dc9bc5683a wlr_scene: Refactor wlr_scene_surface to be a helper on top of wlr_scene_buffer 2022-05-19 14:26:50 -04:00
Simon Ser 8fe3aa29da xdg-shell: specify version in wlr_xdg_shell_create
With protocol additions such as [1], compositors currently have no
way to opt out of the version upgrade. The protocol upgrade will
always be backwards-compatible but may require new compositor
features.

The status quo doesn't make it possible to ship a protocol addition
without breaking the wlroots API. This will be an issue for API
stabilization [2].

To address this, let compositors provide a maximum version in the
function creating the global. We need to support all previous versions
of the interface anyways because of older clients.

This mechanism works the same way as Wayland clients passing a version
in wl_global.bind.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514
[2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3397
2022-05-15 15:44:40 +00:00
Alexander Orzechowski c22ea3eb99 scene_graph: Simplify computation for offset of new surfaces.
This became possible after the usage of wlr_surface_send_frame_done.
2022-01-19 04:46:30 -05:00
Alexander Orzechowski 1bc6f7f243 scene_graph: remove unused outputs list 2022-01-19 04:42:01 -05:00
Alexander Orzechowski 8656c77248 scene_graph: use wlr_scene_output_send_frame_done 2022-01-19 04:38:19 -05:00
Kirill Primak 617eb4fb93 surface: deprecate wlr_surface.h 2022-01-13 10:06:41 +00:00
Simon Zeni 6d6e70b9e0 examples: init wlr_output with allocator and renderer 2021-11-18 09:37:57 -05:00
Simon Ser e05c884891 examples/scene-graph: use wlr_scene_output
This allows us to get damage tracking for free™.
2021-09-08 09:50:08 -04:00
Devin J. Pohly e2e68ff680 examples/scene-graph: demonstrate scene_rect node type
Add RECT nodes to the scene-graph demo to illustrate how they are used.
Here, we add a solid rectangle behind each surface as a quick-and-dirty
border, handling surface.commit in order to size it appropriately.
2021-09-02 19:05:02 +02:00
Simon Ser c41bd320be examples/scene-graph: new example 2021-08-26 21:12:28 +02:00