Commit graph

93 commits

Author SHA1 Message Date
Simon Ser
3da3ec0c27 output: use backend commits
Some checks failed
Continuous integration build / compile (clang, alpine:edge, disabled) (push) Has been cancelled
Continuous integration build / compile (clang, alpine:edge, enabled) (push) Has been cancelled
Continuous integration build / compile (clang, archlinux:base-devel, disabled) (push) Has been cancelled
Continuous integration build / compile (clang, archlinux:base-devel, enabled) (push) Has been cancelled
Continuous integration build / compile (gcc, alpine:edge, disabled) (push) Has been cancelled
Continuous integration build / compile (gcc, alpine:edge, enabled) (push) Has been cancelled
Continuous integration build / compile (gcc, archlinux:base-devel, disabled) (push) Has been cancelled
Continuous integration build / compile (gcc, archlinux:base-devel, enabled) (push) Has been cancelled
Continuous integration build / format (push) Has been cancelled
Continuous integration build / scan-build (push) Has been cancelled
Pass the whole new desired state to the backend, so that the
backend can leverage KMS atomic commits.
2025-06-20 19:19:25 +02:00
Simon Ser
6b1ba34a4a output: drop unused wlr_matrix.h include
This is dropped in the next wlroots release.
2025-04-10 17:49:51 +02:00
Simon Ser
412c11ea91 cage: fix abort on shutdown
Workaround for [1]: register a listener for wl_display destroy and
avoid calling wl_display_terminate() after.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/421
2024-09-07 23:42:24 +02:00
Simon Ser
d07afac4ae output: fix assert when re-adding output to layout
wlr_scene_output_layout_add_output() aborts when called with an
already-added output.

To reproduce, run wlr-randr to reconfigure one of the enabled
outputs.
2024-02-23 12:14:00 +01:00
Simon Ser
767ccf9bbd output: use wlr_output_head_v1_state_apply()
No need to hand-roll this code, there is a wlroots helper for it.
Additionally, this fixes missing adaptive sync handling.
2024-02-20 11:01:41 +01:00
Kenny Levinsen
8a009212bc output: Transition to wlr_output_state
We previously used the wlr_output's built-in pending state and
wlr_output_rollback. The modern state API is much nicer.
2024-01-26 23:45:57 +01:00
Kenny Levinsen
f0bc13bef7 output: Add scene output layout helper manually 2024-01-26 23:45:57 +01:00
Kenny Levinsen
63c0887664 output: Implement request_state event listener
wlroots backends no longer change state on their own, and instead send a
request_state event. Monitor this event and apply any state we receive.
2024-01-26 23:45:57 +01:00
Kenny Levinsen
8df120dafd output: Use state field in wlr_output_event_commit 2024-01-26 23:45:57 +01:00
Kenny Levinsen
2f7ab094d4 output: Remove output mode handler
This is replaced by monitoring for WLR_OUTPUT_STATE_MODE on commit.
2024-01-26 23:45:57 +01:00
Kenny Levinsen
b51a6e950f output: wlr_scene_output_commit NULL options 2024-01-26 23:45:57 +01:00
Kenny Levinsen
b772a00df8 output: Call wlr_scene_output_create 2024-01-26 23:45:57 +01:00
Kenny Levinsen
64e2a44124 output: Remove wlr_output_damage include 2024-01-26 23:45:57 +01:00
Jonathan GUILLOT
4dc3cf80b2 output: fix crash when re-enabling DRM output
The output is disabled then re-enabled using the wlr-output-management
protocol with tool such as wlr-randr.

$ wlr-randr --output HDMI-A-1 --off
$ wlr-randr --output HDMI-A-1 --on

When re-enabled the new output configuration is committed before the
output to be added to the global output layout. However,
handle_output_commit() expects the output to be already part of this
global layout and assert failed. Now, do not treat this in
handle_output_commit() and simply ensure the resulting scene output is
not NULL in handle_output_frame().
2023-09-20 00:01:35 +09:00
Jonathan GUILLOT
a769943447 output: ensure output is marked as enabled before trying to set mode
Otherwise, testing to set preferred / "best" mode will always return an
error. Consequently, output will simply be configured with last and
probably "worst" mode.
2023-09-01 18:37:53 +09:00
Jonathan GUILLOT
96ffaa340e output: do not always terminate when last output is destroyed
Only terminate if the last output was nested under the Wayland or X11
backend. If not, using DRM backend for example, terminating Cage when
unplugging the last monitor or simply turning it off does not seem to be
the right behavior.
2023-09-01 18:37:53 +09:00
Jonathan GUILLOT
b1129ca72e output: fix segfault when using -m last option
Check output list length before accessing previous or next item to avoid
segfault.
2023-07-28 15:36:34 +02:00
Jonathan GUILLOT
6f78d9d5b2 cage: add basic wlr-output-management support
Co-authored-by: Dima Krasner <dima@dimakrasner.com>
2023-07-28 15:36:34 +02:00
Jente Hidskes
27b6971b36 cage: remove support for rotating outputs
This is now handled through wlr_output_management
2023-07-28 15:36:34 +02:00
Alexander Orzechowski
36c9c52d3f Port 0.16 surface header includes 2022-12-17 21:56:03 +01:00
Leonardo Hernández Hernández
46778e6d6c output: get scene_output by wlroots function 2022-03-22 16:58:24 +01:00
Jente Hidskes
ee5410d3fb util: remove unneeded module 2022-01-14 14:59:13 +01:00
Jente Hidskes
1ccbacf198 output: set pointer to cg_output in wlr_output->data
This will be used later in the layer shell implementation.
2022-01-14 14:59:13 +01:00
Dima Krasner
3321daef98 fall back to a lower output mode if needed (swaywm/sway@4cdc4ac) 2021-12-22 07:36:43 +01:00
Jente Hidskes
dfba2d8f9d Remove no longer needed dependencies 2021-12-21 21:53:28 +01:00
Simon Ser
77a3f6bb0c Use wlr_scene_output_send_frame_done 2021-12-21 21:53:28 +01:00
Simon Ser
af610192f4 Use wlr_scene_output_for_each_surface 2021-12-21 21:53:28 +01:00
Simon Ser
5a1933f660 Delegate direct scan-out to wlr_scene
Depends on [1].

[1]: https://github.com/swaywm/wlroots/pull/3279
2021-12-21 21:53:28 +01:00
Simon Ser
e6f89ed6f1 Remove output_for_each_surface
It's used only by send_frame_done. Instead of keeping a generic
iterator, let's inline it in the only user.
2021-12-21 21:53:28 +01:00
Simon Ser
48b31afb5a Drop unused output_surface_for_each_surface 2021-12-21 21:53:28 +01:00
Simon Ser
0736d72e88 Use wlr_scene_attach_output_layout
This provides wlr_output_layout integration.

References: https://github.com/swaywm/wlroots/pull/3160
2021-12-21 21:53:28 +01:00
Simon Ser
d46e8a82dd Use scene-graph for damage tracking
References: https://github.com/swaywm/wlroots/pull/3117
2021-12-21 21:53:28 +01:00
Simon Ser
128fa90ea1 Use scene-graph helpers for sub-surfaces
Delegate sub-surface handling to wlr_scene_surface_tree_create.

References: https://github.com/swaywm/wlroots/pull/3128
2021-12-21 21:53:28 +01:00
Simon Ser
f544483340 Use the wlroots scene-graph API
References: https://github.com/swaywm/wlroots/pull/1966
2021-12-21 21:53:28 +01:00
Simon Ser
395189fb05 Upgrade to wlroots 0.15
- Update wlr_box includes to util/box.h: the wlroots header has
  been moved upstream.
- Subsurface fields have been moved
- Create renderer and allocator, stop using wlr_backend_get_renderer
- Initalize output rendering
2021-12-21 21:53:28 +01:00
Simon Ser
b21f9c6322 Fix count_surface_iterator
This increments the pointer value, not the actual count.

References: https://github.com/Hjdskes/cage/issues/176
2021-08-11 12:54:49 +02:00
Jan Beich
a5aa497ff1 output: chase swaywm/wlroots@cc56b4f073
output.c:456:36: error: no member named 'transform' in 'struct wlr_output::(anonymous at /usr/local/include/wlr/types/wlr_output.h:154:2)'
        wl_signal_add(&wlr_output->events.transform, &output->transform);
                       ~~~~~~~~~~~~~~~~~~ ^

Based on 2c76923282
2021-04-09 19:33:14 +02:00
Jan Beich
82bad3f0fc xdg_shell: chase swaywm/wlroots@07111828c5
xdg_shell.c:230:2: warning: implicit declaration of function 'wlr_xdg_surface_for_each_popup' is invalid in C99 [-Wimplicit-function-declaration]
        wlr_xdg_surface_for_each_popup(xdg_shell_view->xdg_surface, iterator, data);
        ^
ld: error: undefined symbol: wlr_xdg_surface_for_each_popup
>>> referenced by xdg_shell.c:230 (../xdg_shell.c:230)
>>>               cage.p/xdg_shell.c.o:(for_each_popup)

Based on 5438cc158a
2021-04-09 19:33:14 +02:00
Jente Hidskes
0d694db6fe Invert wlr_xcursor_manager_load return value 2020-07-16 15:25:11 +02:00
Jan Beich
a6b1cf1d69 output: unbreak with wlroots 0.11.0
Port changes changes from
9d0aa0cb83
40e87fa98a
2020-07-16 15:25:11 +02:00
Jente Hidskes
72f6c0bae3 output: implement CAGE_MULTI_OUTPUT_MODE_LAST
In this mode, only the last connected output will be used. If that one
is unplugged, the previously last connected output will be enabled. This
for example allows one to switch between two outputs, e.g. on a handheld
device such as a mobile phone.
2020-06-26 20:56:11 +02:00
Jente Hidskes
f4b63cd6b8 output: add enable and disable functions
These will allow different patterns of multimonitor behaviour. In a
followup commit, we will introduce a behaviour where only the last
connected output is in use.
2020-06-26 20:56:11 +02:00
Jente Hidskes
6d0714bfa3 Begrudgingly format wl_list_* macros with a space before parameter list
I can't seem to configure clang-format to remove this space...
2020-02-18 21:20:23 +01:00
Jente Hidskes
6cbc202662 Apply clang-format 2020-02-18 21:20:23 +01:00
Jente Hidskes
8a6d16391f
output: include seat.h 2020-02-03 21:23:39 +01:00
Damon
e3be8159b3
output: wrap xwayland.h include in CAGE_HAS_XWAYLAND (#120)
* move xwayland.h include to ifdef block for X11

* use correct ifdef CAGE_HAS_XWAYLAND
2020-02-03 21:14:29 +01:00
Jente Hidskes
b04e02cd60 output: add support for direct scan-out
Fixes #88.
2020-02-01 23:24:49 +01:00
Jente Hidskes
cc1f975c44
cage: center cursor only on initial startup
With Cage now supporting hotplugging of outputs, we shouldn't warp the
cursor to the center of every new output. Rather, we should warp it only
on the initial startup.
2020-01-18 11:57:16 +01:00
Jente Hidskes
12aa43abba output: initialise wlr_output before positioning views 2020-01-11 17:07:33 +01:00
Jente Hidskes
2f9442906d output: refactor get_surface_box
The function also did an intersection check, so it did more than just
getting the surface box. This refactoring makes it more clear.

This commit also fixes a bug in coordinate spaces that makes dialogs
render properly over multiple outputs.
2020-01-11 17:07:33 +01:00