Commit graph

479 commits

Author SHA1 Message Date
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
Simon Ser
840fd7dce6 examples: drop unnecessary include_directories
wlr_inc is already pulled in via the wlroots dep. proto_inc is
already pulled in because extra_src contains these headers.
2023-06-14 16:33:18 +02:00
Simon Ser
670915eeea output: add wlr_output_state_set_layers() 2023-06-13 12:02:49 +00:00
Alexander Orzechowski
495bcbeedd examples: Drop usage of wlr_output.pending 2023-06-13 09:19:51 +00:00
Simon Ser
ac426c0c24 examples/output-layers: fix layers not included in commit
wlr_output_set_layers() attaches layers to the output's pending
state, but then uses a detached wlr_output_state in
wlr_output_state_commit(). This results in layers being left out
of the committed state.

Fixes: 8e81b4bb42 ("examples: convert to new rendering API")
2023-06-12 21:52:16 +00:00
Simon Ser
c5f4df6c96 examples/multi-pointer: drop
We already have another very similar example which demonstrates
wlr_cursor: "pointer".
2023-06-05 20:37:38 +00:00
Rose Hudson
9e8947e4d5 add render timer API
Based on five calls:
wlr_render_timer_create - creates a timer which can be reused across
  frames on the same renderer
wlr_renderer_begin_buffer_pass - now takes a timer so that backends can
  record when the rendering starts and finishes
wlr_render_timer_get_time - should be called as late as possible so that
  queries can make their way back from the GPU
wlr_render_timer_destroy - self-explanatory

The timer is exposed as an opaque `struct wlr_render_timer` so that
backends can store whatever they want in there.
2023-06-05 19:50:07 +00:00
Alexander Orzechowski
46a014bf47 examples: Drop quads
This example is incomparable with the new rendering API. The old one which
we will drop one day.
2023-06-05 13:02:03 +00:00
Simon Ser
8e81b4bb42 examples: convert to new rendering API
Left out multi-pointer (will be removed) and quads (requires
arbitrary rotation).
2023-05-30 16:18:19 +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
835208db98 output-layer: add support for scaling buffers
This allows callers to set a destination size different from the
buffer size to scale them.

The DRM backend supports this. The Wayland backend doesn't yet
(we'd need to wire up viewporter).
2023-04-04 19:39:38 +02:00
Rose Hudson
12e28c3492 examples/touch: support touch cancel events 2023-03-24 11:47:08 +00:00
Rose Hudson
689627f0c0 examples/touch: fix incorrect event type 2023-03-17 16:00:16 +00:00
Simon Ser
8db0d82890 examples/dmabuf-capture: fix frame_number deprecated in FFmpeg 6.0
Fixes the following error:

    ../examples/dmabuf-capture.c:524:33: error: 'frame_number' is deprecated [-Werror=deprecated-declarations]
      524 |                                 ctx->avctx->frame_number, get_fifo_size(&ctx->vid_frames));
          |                                 ^~~
2023-02-28 11:57:07 +01:00
Simon Ser
9a425841b0 examples/output-layers: relay feedback events 2023-02-20 18:38:57 +01:00
Simon Ser
c3d969d2d4 examples/output-layers: new example 2023-02-20 18:38:57 +01:00
Simon Ser
21f8388b58 examples: use NULL theme name instead of "default"
This leaves it up to wlr_xcursor_theme_load() to pick the theme
name.
2023-02-01 15:01:20 +01:00
Simon Ser
3668c9d86c examples, tinywl: use "default" cursor instead of "left_ptr"
"left_ptr" is the X11 name, "default" is the cursor spec name.
2023-02-01 15:00:42 +01: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
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
c2952411d3 examples/screencopy-dmabuf: stop using strncpy
strncpy doesn't guarantee that the result is zero-terminated.
2022-06-04 23:03:39 +02:00
Simon Ser
366e8e3b91 examples/text-input: stop using strcpy/strcat
These functions are too easy to misuse, they don't do bounds
checking.
2022-06-04 23:02:42 +02: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
Simon Ser
bb2946f737 build: make GBM optional
Now that the DRM backend no longer depends on GBM, we can make it
optional. The GLES2 renderer still depends on it because of our EGL
device selection.

This is useful for compositors with their own renderers, and for
compositors using the Vulkan renderer.
2022-05-30 13:30:08 +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
Kirill Primak
0326ceff90 examples/layer-shell: premultiply alpha 2022-05-09 10:08:44 +00:00
Johannes
12d84f8c36 examples/egl_common: switch rgba format
The current ARGB2101010 has really "corase" control over the alpha.
Particularily, examples/layer-shell would look really strange with certain
parameters. For examples, when passing an alpha of 0.84, the box would not
appear transparent at all anymore.

Patched as suggested by @mstoeckl -- thank you!
2022-05-09 09:38:32 +00:00
Simon Zeni
aaf787ee56 types/wlr_touch: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
e732c5c895 types/wlr_tablet_tool: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
d1f543a9d8 types/wlr_tablet_pad: 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
96ccc50c57 types/wlr_input_device: move width_mm and height_mm fields to wlr_tablet and wlr_touch 2022-03-17 13:44:19 -04:00
Guido Günther
0a5a65cf48 examples/input-method: Don't crash on NULL surrounding text
E.g. With e.g. gnome-terminal we never end up in handle_surrouding
so it will be NULL.
2022-03-02 14:28:58 +00:00
Keith Bowes
35b3d67e5f Fixed compiling with FFmpeg 5.0 2022-02-21 15:51:17 +01: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 Ser
1fbd13ec79 examples: remove unnecessary partial_dependency() call
The definition of the "drm" dep already calls it.
2021-12-07 16:20:54 +01:00
Simon Ser
90e9d327dd examples: remove unnecessary wlroots deps for clients
These clients don't need wlroots.
2021-12-07 16:20:20 +01:00
Simon Ser
83bdb3ad07 examples/layer-shell: remove wlroots dependency
This is a client example, it shouldn't use a compositor library
like wlroots.
2021-12-07 16:19:26 +01:00
Simon Ser
ad28490cf4 build: move wayland-client dep to backend/wayland/
wayland-client isn't really used by wlroots core, so let's move the
dep to where it's needed in the Wayland backend.
2021-12-07 16:11:29 +01:00
Simon Zeni
6d6e70b9e0 examples: init wlr_output with allocator and renderer 2021-11-18 09:37:57 -05:00
fwsmit
dc22a06184 examples/foreign-toplevel: fix toplevel not being freed 2021-10-07 20:36:21 +02: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