Commit graph

138 commits

Author SHA1 Message Date
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
yuanye
d82d8117f7 src/output.c: Release layer tree when releasing output
Split off from PR #622 and slightly modified by @Consolatis
2023-01-03 19:46:31 +00:00
Consolatis
de8042bff5 src/output.c: prevent crash with no outputs available 2023-01-03 19:46:31 +00:00
Johan Malm
f01071e72c layer: remove wl_list layers[] from struct output
...and just use `struct wlr_scene_tree *layer_tree[]`
2022-12-29 23:18:08 +01:00
bi4k8
39bea30cd5 don't NULL-check output when it can't be
`output` here is the `pos` argument of `wl_list_for_each`, which means
it is always assigned a return value of `wl_container_of`; this in
turn means that it is never NULL.

checking against NULL here just confuses static analysis and readers
2022-12-08 19:24:02 +00:00
John Lindgren
f08e931a29 include: Break out view.h from labwc.h
IMHO it encourages better design (by making dependencies more obvious)
to have source file/header file pairs like view.c/view.h, rather than a
monolithic header like labwc.h with everything in it.

I don't think we need to break up all of labwc.h at once, but maybe we
can start pulling it apart bit by bit as it's convenient.

Also:

- Move "struct border" to ssd.h so that view.h can use it without pulling
  in all of labwc.h.
- Add a missing required #include within scaled_font_buffer.h (forward
  declaration of "struct font" is not enough).
2022-11-21 21:42:37 +00:00
Johan Malm
2a9a378176 output: test adaptive sync
Required by https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3637
See also swaywm/sway@07bfeb2

Fixes #516
2022-11-15 21:58:18 +00:00
Johan Malm
e45e2c7e60 Fix coding style 2022-11-03 23:01:52 +01:00
Johan Malm
d424514e24 Fix minor coding-style violations
...based on https://github.com/johanmalm/checkpatch.pl
2022-09-22 22:39:44 +01:00
John Lindgren
7233495c3a output: Call do_output_layout_change() at end of new_output_notify().
This fixes an issue with the wlr_output_cursor not being properly
initialized on new outputs, because wlr_output_layout.events.change
is triggered too soon, before the wlr_output_cursor exists.
2022-09-21 07:33:00 +02:00
John Lindgren
a54d378e6c common: Add znew/znew_n() macros 2022-09-18 15:25:19 -04:00
John Lindgren
cb40cdc36c common: Add additional memory utilities (xzalloc() etc.) 2022-09-17 10:57:30 -04:00
Consolatis
36b2a93a69 Disconnect view from destroying output
Fixes #497

Reported-by @Flrian
2022-08-24 20:24:19 +01:00
yizixiao
46fb3c3dec func output_destroy_notify add free 2022-08-17 14:09:36 +02:00
Consolatis
ceca6afefc src/output.c: Always react to new output configuration
Without this fix we will never react to output configuration changes
via wlr-randr and friends.

If output_config_apply() commits the new config, handle_output_layout_change()
is called but doesn't do anything because the config is still pending.

This patch moves the code into its own function do_output_layout_change()
which additionally gets called after all output configs are committed.

The original handler is turned into a wrapper around do_output_layout_change().

Reported-by @heroin-moose
2022-07-09 09:37:48 +01:00
Consolatis
f4aa6118e9 src/layers.c: Adjust views based on usable_area changes 2022-06-30 20:41:54 +01:00
Joshua Ashton
505b1edb98 Allow leasing desktop displays
Apps such as Gamescope eventually want to offer a DRM lease option to use planes and handle all of getting to the screen themselves.

This implements logic to allow leasing of desktop displays
2022-06-16 20:42:17 +01:00
Consolatis
2ed7a10779 Chase wlroots: every scene_node parent is now a tree
Chases wlroots ccd0f85c2a36308e35b153c7f9653abac7659af3
wlr_scene: Only allow parenting on a wlr_scene_tree
2022-06-07 07:13:37 +01:00
Consolatis
3f65a2ff77 Chase wlroots: wlr_scene is now a tree node
Chases wlroots 9eb71146ae56c509ee33c7e8a662549592aad870
wlr_scene: Refactor wlr_scene (the root element) to encase a wlr_scene_tree
2022-06-07 07:13:37 +01:00
Consolatis
e75af14d3d src/output.c: Make sure we are always using the correct scene_node
Also make sure we are only applying layout specific changes
once the output specific ones were committed successfully.

Fixes #312
Reported-By: @fakeczg
2022-05-02 09:54:01 +01:00
Johan Malm
48c9e6fda0 osd: show alt-tab switcher center-aligned on all outputs
Fixes issue #283
2022-04-20 17:45:10 +01:00
Johan Malm
5b34c81768 Fix trivial coding style breaches 2022-04-04 20:53:36 +01:00
Joshua Ashton
57a937bdf2 output: Implement drm_lease_v1
Needed for VR to work properly.
2022-03-28 21:13:51 +01:00
Johan Malm
5fd5024ca6 output: fix incorrect call to private wlroots function
Use wlr_output_test() instead of output_ensure_buffer() which is not a
public function and only compiled when linking statically to wlroots.

Also wlr_output_rollback() on failed test.

Fixes issue #273
2022-03-15 21:30:25 +00:00
bi4k8
c23397f362 support wlr-output-power-management 2022-03-08 20:07:51 +00:00
Johan Malm
19f3a6ef83 output: attach node-descriptors to node-trees 2022-03-03 18:20:16 +00:00
Johan Malm
6fd400b493 layers: put popups in separate node-tree
This allows popups to be rendered above views and other layers. Without
this, the popups of a layer-shell application in the bottom layer would
render below views, which does not seem right. For example, consider the
case of a panel with right-click popups.
2022-03-03 17:56:38 +00:00
Johan Malm
d3918eec0a layers: only define LAB_NR_LAYERS locally where needed 2022-03-02 20:39:46 +00:00
Johan Malm
98d5fd483d layers: s/arrange_layers/layers_arrange/
Because we like to start public function names with the name of the
file.

Move prototype from labwc.h to layers.h
2022-03-02 20:29:29 +00:00
Johan Malm
04580fa825 layers: arrange layers on output-layout change 2022-03-02 20:26:09 +00:00
Johan Malm
bd9ac3478a Remove src/damage.c 2022-03-01 20:54:52 +00:00
Johan Malm
f26b61137d layers.h: define LAB_NR_LAYERS (4) 2022-02-23 21:47:01 +00:00
Johan Malm
688abf7db1 Handle layers under the scene-graph API
This excludes popups.
2022-02-23 21:47:01 +00:00
Johan Malm
b79744e7b0 Chase wlroots master
We need it for wlr_scene_layer_surface_v1_create()
2022-02-23 21:47:01 +00:00
Johan Malm
532656ad5b Use wlroots scene-graph API
Move xdg-shell and xwayland-shell surfaces to new API

Also render alt-tab on-screen-display by converting cairo-surface to
wlr_buffer
2022-02-23 21:46:48 +00:00
Johan Malm
588f233151 output: render overlay lay popups
This enables sfwbar popups and fixes issue #239

https://github.com/LBCrion/sfwbar
2022-02-13 09:45:42 +00:00
ARDiDo
7c437eac2f OSD: Use separate OSD texture for each output 2022-02-09 21:57:32 +00:00
ARDiDo
049b84409e OSD: Scale OSD to the largest output scale 2022-02-09 21:57:32 +00:00
Consolatis
7ecae4afce Move is_button() into src/ssd.c and make it public 2022-01-30 21:23:15 +00:00
Consolatis
3658c2bfb3 src/output.c: fix debug flag for full frame damage 2022-01-28 07:33:46 +00:00
Consolatis
b7b1e8064f Add WindowMenu button 2022-01-26 06:17:41 +00:00
Consolatis
759b26b5c1 Add window menu 2022-01-26 06:17:41 +00:00
Liam Middlebrook
875b258602 output: Add option to preview the contents of the current cycle_view
Add the 'cycleViewPreview.core' option to rc.xml to enable previews of
the selected view when cycling between windows. Default this option to
be disabled to match current behavior.
2022-01-23 16:02:54 +00:00
John Lindgren
a837fefc80 Adjust views to account for output layout changes
labwc currently doesn't handle output layout changes very well:

 - Windows can end up "lost" completely offscreen
 - Maximized/fullscreen windows can end up spanning multiple outputs

Currently, new_output_notify() and output_destroy_notify() contain logic
to update the cursor and force a repaint when outputs are added or
removed.  This logic in fact needs to run on any output layout change,
so consolidate it into a new function, output_update_for_layout_change().

Then add a second new function, view_adjust_for_layout_change(), which
adjusts window placement to account for the new layout.

The behavior is roughly as follows:

 - Normal windows that end up offscreen are centered on the closest
   output (making use of the existing view_center() logic)
 - Maximized windows are re-maximized on the closest output.  Logic is
   also added to the unmaximize step to check that the original
   unmaximized position is still on-screen.
 - Fullscreen windows are re-fullscreened on the same output if
   possible; otherwise they are un-fullscreened.

Minimized windows don't require any special handling.  Their placement
is adjusted just the same, but invisible to the user until they are
later unminimized.

There is some positioning glitch still with un-fullscreening a window
whose output has been disconnected/disabled; it can end up in an
unexpected position (but at least has the correct size and decoration).
I don't think this is due to a bug in my change per se, but perhaps the
change has exposed a bug elsewhere.

Fixes: #177
2022-01-01 16:20:13 +00:00
John Lindgren
2ce961a0bd Check the return value of wlr_output_layout_get() for NULL
wlr_output_layout_get() seems to return NULL for disabled outputs.

Fixes: #174
2021-12-24 21:08:32 +00:00
ARDiDo
7d68eeb5eb cursor: scale xcursor for all output scales 2021-12-17 10:20:57 -05:00
John Lindgren
4d92391246 Fix graphical artifacts after adding/removing outputs
When an output is added or removed, the position of the other
outputs can also change, resulting in windows moving between them.
We need to redraw all the outputs (not just the new one) to prevent
stale/corrupted screen contents.
2021-11-28 08:32:45 +00:00
John Lindgren
816a61b2fa Fix invisible cursor at startup 2021-11-27 14:31:23 -05:00
Johan Malm
d50c2f2eac Fix minor style violations 2021-11-26 19:27:50 +00:00
John Lindgren
687993370f Enable new outputs (before setting mode)
Fixes the following error with wlroots-git 0.14.0.r391.g585a908a-1:

    [DEBUG] [types/output/output.c:603] Tried to modeset a disabled output
2021-11-26 16:13:58 +00:00