Commit graph

187 commits

Author SHA1 Message Date
Consolatis
95e8573388 src/output.c: refactor virtual output related functions
This commit moves the virtual output related functions
into their own file at `src/output-virtual.c` with its
own include file to reduce `include/labwc.h` bit by bit.

Additionally, it removes the need to keep the
`server->headless.pending_output_name` char array around
by temporarily disconnecting the handler when creating a
new virtual output. This allows to set the output name
right in the `output_virtual_add()` call rather than to
store the pending name until the new output event handler
has been called.

It also makes adding a virtual fallback output easier in
a follow-up PR.
2024-03-07 19:51:54 +00:00
Consolatis
74501bc7fa src/output.c: restore flicker free resize when running nested
PR #1301 did partly revert the first variant because
`lab_wlr_scene_output_commit()` (which uses the `output->pending`
state in contrast to `wlr_scene_output_commit()`) was deemd to
cause 'frozen' frames during video playback (#1273).

We are now back at using `lab_wlr_scene_output_commit()` for
unrelated reasons and the cause of the original issue #1273 was
likely that `wlr_scene_output_send_frame_done()` was only sent
on a successful commit. This was changed to always be sent.

So lets restore the flicker free nested resize as well.
2024-03-04 21:24:17 +00:00
Consolatis
7adf5533f9 src/output.c: log when disabling adaptive_sync on a nested labwc 2024-02-22 23:40:03 +01:00
Consolatis
d69faffc4e src/output.c: notify clients about config errors
Preliminary fix for #1525.

Based on the protocol we should also revert all
previously correctly committed outputs. #1528
is doing just that but may cause regressions so
we need a short term solution and then deal with
potential issues in #1528 after the release.
2024-02-22 23:40:03 +01:00
Ph42oN
f7e811f2fa
output: allow changing adaptive sync state
Fixes: #1412
2024-02-07 22:17:17 +01:00
Consolatis
396a4b93d1 src/output.c: expose output configuration test to clients 2024-01-23 20:14:24 +00:00
Consolatis
6e773592f6 src/output.c: properly test new output configurations
Fixes #1458
2024-01-23 20:14:24 +00:00
Jens Peters
17e15ed987 seat: re-map tablet to output on output change 2024-01-10 21:10:11 +00:00
Ph42oN
bce0c6ce56
Add tearing support (#1390)
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
2024-01-08 20:58:58 +00:00
Ph42oN
1b5af86402 fix adaptive sync fullscreen 2024-01-06 15:37:18 +00:00
Tomi Ollila
785a34e8ad Fixed some typos 2024-01-04 19:32:51 +00:00
Ph42oN
08045d7843 config: add adaptive sync fullscreen option 2023-12-30 15:46:35 +00:00
kyak
266690091f Remove headers not being used directly
Fix clangd warnings regarding headers not being used directly.
2023-12-22 20:19:39 +00:00
John Lindgren
447c67df62 output: do not call wlr_scene_output_layout_add_output() twice
Fixes an assertion failure that occurred if reconfiguring outputs after
an output had been disabled using wlopm --off.

Fixes: #1303
2023-12-19 01:03:08 +01:00
kyak
45e0dad3f1
src/output.c: fix strncpy warning
Fixes #1307
2023-12-11 10:33:06 +01:00
kyak
111b955b53
Implement key binds to control virtual outputs (#1287)
Add actions `VirtualOutputAdd` and `VirtualOutputRemove`
2023-12-09 09:01:11 +00:00
Johan Malm
8d220536e0 Partially revert a bit more of ddc9047
...to enable re-size of nested labwc instances
2023-12-08 22:13:02 +00:00
Johan Malm
b05b5ba0cf Partially revert ddc9047
...to just call wlr_scene_output_commit() as was previously the case and
thus avoid freezing screens reported by a number of users.

Fixes: #1273
2023-12-08 22:13:02 +00:00
Consolatis
e841d44b6f src/output.c: ensure we don't carry around a stale output pointer
Prevent carrying around the wlr_output->data pointer when
destroying an output. The set_gamma handler may be called
during the destruction of a wlr_output after our own
destroy handler has already been called. This patch resets
the wlr_output->data pointer in our destroy handler and
adds a check in the set_gamma handler to verify the output
is actually valid.

Fixes #1270

Reported-by: @Flrian
2023-12-02 15:27:00 +01:00
Johan Malm
fcf21e1464 chase: handle gamma-control-v1 set_gamma events
References:
- https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4046
- https://github.com/swaywm/sway/pull/7494/files

Fixes: #1262
2023-12-01 22:30:17 +00:00
John Lindgren
0a5255f062 output,xwayland: Add support for _NET_WM_STRUT_PARTIAL
Account for space taken up by XWayland panels (as indicated by the
_NET_WM_STRUT_PARTIAL property) in the usable_area calculation.

This makes it possible to use labwc in a "transitional" setup, where it
replaces the X11 window manager and compositor, but most other parts of
a existing X11 desktop environment can still be used via XWayland.

(Some remaining drawbacks of such a setup would be the lack of desktop
icons, and native Wayland clients not showing up in X11-based taskbars.)
2023-11-29 06:48:31 +00:00
John Lindgren
6b8c79748a xwayland: set _NET_WORKAREA property based on usable area
XWayland clients use the _NET_WORKAREA root window property to determine
how much of the screen is not covered by panels/docks. The property is
used for example by Qt to determine areas of the screen that popup menus
should not overlap (see QScreen::availableVirtualGeometry).

Depends on wlroots MR:
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4406

v2: prevent calling wlr_xwayland_set_workareas() too early
v3: fix segfault at exit (server->xwayland == NULL)
2023-11-27 22:08:43 +00:00
John Lindgren
96c85051ae Chase wlroots: add output to scene_output_layout explicitly
Chases: f5917f0247600b65edec1735234d00de57d577a8
scene_output_layout: make output adding explicit
2023-11-27 21:01:53 +00:00
Consolatis
ddc9047a67 Restore nested resize
Chases: 756ecf8ee9f1e75bc7b8297dc84f97c7d699174b
backend/wayland: use request_state when toplevel is resized

Chases: 3ef68a484243555b020200c6f95246d994932c3f
backend/x11: use request_state when window is resized

Ref: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2693

We now delay requested resolution changes by the backend until
the next frame event which causes us to render the new content
on the already enlarged buffer. Before this change, an empty
(black) buffer would have been shown instead before the next
frame event caused a new render of the actual contents.

Keep commiting the new state and then scheduling a frame event
would not help as due to the commit call it would still show an
empty buffer in the meantime.

Just modifying wlr_output->pending wouldn't work either because
wlr_scene_output_commit() *completely* ignores it (and it will
be removed in future wlroots commits). For this reason we move
to wlr_scene_output_build_state() directly because it allows us
to supply the current wlr_output->pending state and thus apply
any resolution change in lockstep with new rendering. Result:
No more flickering in the wayland backend and resizing is again
smooth as butter.

This prevents constant flicker while resizing
when running nested via the wayland backend.

For the X11 backend (can be tested via `WLR_BACKENDS=x11 labwc`),
it is still rather janky but at least doesn't cause endless self-
resizing anymore.
2023-11-27 21:01:53 +00:00
John Lindgren
277f417d8b Chase wlroots: add options argument to wlr_scene_output_commit()
Chases: 214df8eda07d18b032abfcf525c8344e077c0c7e
scene_output: optionally record and report timings
2023-11-27 21:01:53 +00:00
Consolatis
d0b24f73d7 Chase wlroots: wlr_output_layout refactor
Chases 097ea84cda70a71ad8ea5940b3b3d277167424e5
output-layout: improve API
2023-11-27 21:01:53 +00:00
John Lindgren
a036d985d7 common: rename array-size.h to macros.h 2023-10-21 12:37:42 +01:00
Axel Burri
afe92654fd Add output_usable_area_scaled() helper
Preparatory for snap to window edge framework.
2023-10-19 19:09:42 +01:00
John Lindgren
125bab4796 output: fix invisible cursor after wlopm --off && wlopm --on
Use the same fix/workaround as in output_update_for_layout_change() to
make sure that the cursor is also visible after (re-)enabling an output
in handle_output_power_manager_set_mode().
2023-10-11 20:12:34 +02:00
John Lindgren
00ce7a2b5e session-lock: reconfigure for output layout changes
Currently, if the output layout changes while the session is locked,
the lock surfaces may end up wrongly positioned, which looks bad and
may reveal some of the user's workspace underneath.

To prevent this, re-align the scene trees and reconfigure the lock
surfaces when the output layout changes.
2023-10-05 20:10:37 +01:00
Ikko Eltociear Ashimine
3f0cf9c3a8 Fix typo in output.c
specifc -> specific
2023-09-30 08:58:54 +01:00
Johan Malm
8d3b15576b Add ARRAY_SIZE() macro 2023-09-19 22:03:59 +01:00
Consolatis
44645d06c2 src/output.c: destroy workspace OSD on output destroy 2023-05-17 13:56:11 +02:00
Consolatis
e1725e17b2 src/output.c: fix adaptive sync
Fixes #642

Reported-by: @heroin-moose
Tested-by: @heroin-moose
2023-04-30 15:12:10 +01:00
Consus
957dd43af2 output: Make the session lock layer the topmost
Make sure that only the session lock layer is visible to a user. Fixes
the issue with mako notifications being rendered above the swaylock
window.
2023-04-27 18:17:44 +02:00
Johan Malm
d4288415c9 Support ext-session-lock protocol 2023-04-02 23:09:38 +01:00
Consolatis
a0b5a80ce1 Add FocusOutput action
Fixes #806

Suggested-by: @EysseW
Tested-by: @EysseW
2023-03-06 21:58:11 +00:00
John Lindgren
976136299d output: Add output_nearest_to()
Reimplement output_from_cursor_coords() as output_nearest_to_cursor().
2023-02-21 08:46:22 +01:00
John Lindgren
5062c5bea3 view: Add optional output parameter to view_center()
Allows centering the view on a specific output without the workaround of
overwriting view->current.x/y.
2023-02-20 11:50:12 -05:00
John Lindgren
6efc6a9db4 output: Add output_is_usable() helper 2023-02-17 06:59:39 -05:00
Consolatis
dd1a8f01dd src/output.c: only overwrite the automatic layout if necessary
The wlroots wlr_output_layout provides two different modes of operation:
- automatically
- manually

In automatic mode wlroots reacts to new / removed outputs and resolution
changes and then adjusts the output positions within the layout itself.

The manual mode disables this behavior and thus it is the whole
responsibility of the caller (e.g. us relaying whatever wdisplays /
kanshi provides) to ensure that the layout is somewhat sane. E.g. that
it doesn't have any holes between outputs and there are no overlapping
outputs.

The mode is set for each output individually. To use (and keep using)
the automatic mode, outputs have to be added via the _add_auto() variant
(which we do) and they are not allowed to be moved via _move() (which
we currently do and thus break the automatic layout).

To fix that, this patch compares the user (tool) supplied position to the
automatically calculated position and only if they differ we call _move().
2023-01-29 14:36:15 +00:00
Consolatis
4dc99e2f38 cursor: update cursor image on scale change 2023-01-26 22:02:13 +00:00
bi4k8
58382260de ensure cursor is correctly scaled at startup 2023-01-24 05:17:13 +01:00
Consolatis
6c42aced3d Support flicker free boot
Fixes #724
2023-01-23 22:10:22 +01:00
Consolatis
07ee56176d SnapToRegion: Allow for live config updates 2023-01-11 18:52:24 +01:00
Consolatis
eb5c8cfdad SnapToRegion: Add dynamic overlay
Either uses a half transparent single rect if running
hardware accelerated or uses a solid struct multirect
outline if not.
2023-01-11 18:52:24 +01:00
Consolatis
4edd67de17 SnapToRegion: Evacuate tiled views from destroying outputs 2023-01-11 18:52:24 +01:00
Consolatis
67952cd749 SnapToRegion: Wire up output and handle usable_area changes 2023-01-11 18:52:24 +01:00
Consolatis
bc4108fec0 output: Use better arg naming for output_update_all_usable_areas()
This restores the original approach of naming the argument `layout_changed`
which fits much better than `enforce_view_arrange`. Especially when extending
the function to also handle region updates once merged.
2023-01-06 20:39:04 +01:00
John Lindgren
ed31381eb8 output: Add output_update_usable_area/all_usable_areas()
Move the desktop_arrange_all_views() call outside layers_arrange() into
a new function, output_update_usable_area().  The new function currently
does exactly what layers_arrange() used to, but will be expanded in a
later commit.

Add output_update_all_usable_areas(), which is the same as calling
output_update_usable_area() for each output, but only calls
desktop_arrange_all_views() once.

Rebased and slightly modified by @Consolatis
2023-01-06 14:51:46 +01:00