Commit Graph

81 Commits

Author SHA1 Message Date
Simon Ser 11e3c376e7 output-layout: fix missing global for outputs with a custom mode
Before we were populating wlr_output.current_mode with a generated
fixed mode when a custom mode was committed in the DRM backend. But
that's no longer the case: now a custom mode behaves the same under
the DRM backend and other backends.

wlr_output_layout was still assuming that an output without a
current_mode was disabled. Fix that assumption.

Fixes: 5567aefb1c ("backend/drm: Don't add pollute fixed modes list with custom modes")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3743
2023-12-21 11:28:58 +01: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
Simon Ser 6a7463bb8e output-layout: take wl_display in constructor
The output layout creates and destroys wl_output globals. We will
soon need the wl_display to do so.
2023-11-23 11:39:25 +00:00
Alexander Orzechowski 5fb0007e02 output_event_commit: Remove committed and buffer
The newly introduced state struct can be used to retrieve this.
2023-10-06 10:06:01 +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 91f813ffb7 output_layout: return wlr_output_layout_output when adding output
This will be used for the scene-graph integration.
2023-08-22 11:53:25 +02:00
Simon Ser 7a9f8d8d6b Use struct initializers instead of memset()
This is a bit more type-safe.
2023-07-07 17:31:11 +02:00
Kirill Primak 843b874f22 output-layout: improve closest point for no outputs case
Without outputs, all points are equally invalid anyway, but for e.g.
cursor warping it makes more sense to preserve the original position.
2023-01-21 12:48:43 +00:00
Kirill Primak 097ea84cda output-layout: improve API
- wlr_output_layout_add{,_auto}() now return a bool indicating whether
  the function has succeeded.
- wlr_output_layout_move() is removed.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1083
2022-12-05 18:21:04 +00:00
Kirill Primak 27ea18cc33 output-layout: remove wlr_output_layout_output_state
wlroots uses "// private state" comments to denote structure fields
which shouldn't be accessed by compositors, so let's drop
wlr_output_layout_output_state and inline its fields into
wlr_output_layout_output; this also simplifies layout output creation.
2022-12-05 18:21:04 +00:00
Simon Ser 4287f70dc3 output-layout: stop listening for output mode events
These will go away.
2022-12-01 20:05:04 +00:00
Kirill Primak 26e1812ab3 output-layout: improve wlr_output_layout_output_in_direction()
Now the function checks if the reference output belongs to the layout,
and returns NULL if it doesn't.
2022-08-30 19:26:23 +03:00
Kirill Primak 2ea80eb115 output-layout: avoid uninitialized wlr_box fields 2022-08-30 19:26:23 +03:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Sebastian Krzyszkowiak 13fcdba75c wlr_output_layout_contains_point: handle outputs that aren't in the layout
Instead of crashing, return `false` when the specified output isn't part
of the layout, as we can be sure that it doesn't contain the specified
point.
2022-03-11 06:49:49 +00:00
Kirill Primak 49fa060442 output-layout: remove useless types/fields 2022-01-31 10:32:47 +00:00
Kirill Primak 498f30aad1 output-layout: make wlr_output_layout_get_box() take a box as parameter
Closes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/812
2022-01-31 10:32:47 +00:00
John Lindgren bff5b2c559 Insert new outputs at the end of the list
This prevents auto-configuring a new output from changing the
position of existing outputs.

(v2: simplify insert-at-end logic)
2021-11-29 13:14:31 +00:00
Kirill Primak 111d4eafd7 util/addon: find both by owner and impl
This allows to have multiple addons of different types with the same
owner.
2021-08-11 18:12:57 +02:00
Kirill Primak debd6c5f0b wlr_output_layout: use wlr_addons 2021-08-10 19:15:48 +02:00
Simon Zeni e192d87731 move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
Simon Ser aab43b3c76 output-layout: stop listening to scale/transform events
Instead, listen to the commit event only.
2021-01-15 10:18:56 +01:00
Simon Ser 16e5e9541b Add -Wmissing-prototypes
This requires functions without a prototype definition to be static.
This allows to detect dead code, export less symbols and put shared
functions in headers.
2019-11-20 02:05:03 +00:00
Ilia Bozhinov 480a31ea4e wlr_box: properly calculate closest point for non-positive area boxes
If box->width/height is <= 0, the box doesn't contain any points, and so
there is no closest point. wlr_box_closest_point should return NAN in this
case.

In addition, we need to handle empty boxes in a few other
output-layout-related places, because outputs can have size 0x0 when
they are created or destroyed.
2019-10-11 23:43:13 +03:00
Antonin Décimo 217cf18a4b Avoid loss of a fractional part 2019-08-12 09:37:21 +09:00
emersion 1515c56cae output: remove lx, ly
Fixes https://github.com/swaywm/wlroots/issues/1610
2019-04-13 08:31:30 -06:00
Brian Ashworth aa5c369910 wlr_output_layout_get_box: handle empty layout
If there were no outputs in the output layout,
wlr_output_layout_get_box would return the box:

{
  .x = INT_MIN,
  .y = INT_MIN,
  .width = INT_MIN - INT_MAX,
  .height = INT_MIN - INT_MAX
}

which results in an integer underflow for both the width and height.

This changes the logic to have the box be all zeroes, since an empty
output layout does not have a width or height and the location of
something without a size is irrelevant so this just uses the origin.
2019-03-08 09:45:22 +01:00
Timidger 9af0c5338f
Standardize the wlr_box input paramaters
Fixes #1094
2018-12-21 13:56:10 -05:00
emersion dfdbc1f870
output-layout, cursor: fix duplicate cursors
wlr_cursor: make sure the output doesn't have a cursor before
creating a new one

wlr_output_layout: don't emit the "add" event when the output is
already in the layout
2018-10-19 14:50:35 +02:00
emersion 9f76263404 output-layout: don't expose outputs without a mode 2018-09-17 15:22:33 +02:00
Armin Preiml 5617d2bd60 introduce wlr_output_layout_farthest_output
Similar to wlr_output_layout_adjacent_output but will return the
one that is the farthest away from the reference in given direction.
2018-08-25 09:14:55 +02:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Genki Sky d1cf9acbd5 cleanup: Use void for zero-parameter functions
Signed-off-by: Genki Sky <sky@genki.is>
2018-05-30 20:19:16 -04:00
emersion 625a7a48dc
Don't use the wlr_ prefix for static functions 2018-04-25 23:51:00 +01:00
Tony Crisci 5a47da1ea6 annotate wlr-output-layout coord variables 2018-04-01 00:17:27 -04:00
Tony Crisci bf5ae85683 return early when no dest_x/y in output layout closest point 2018-03-28 18:40:55 -04:00
Tony Crisci bbd0e23fa7 xdg-positioner constraint detection 2018-03-26 23:48:32 -04:00
emersion aa2b62fbff
output-layout: fix output global not destroyed 2018-03-01 17:53:15 +01:00
Drew DeVault 1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Drew DeVault 09cfa39392
Merge pull request #632 from acrisci/output-layout-adjacent
add wlr_output_layout_adjacent_output
2018-02-19 18:00:32 -05:00
Scott Anderson 86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
Drew DeVault c951000198 Remove XXX comment 2018-02-18 11:21:08 -05:00
Tony Crisci 9933b7ad95 fix direction determination 2018-02-17 17:54:57 -05:00
Tony Crisci 85871cb666 add wlr_output_layout_adjacent_output 2018-02-14 14:10:31 -05:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion 36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
Vincent Vanlaer 8dcb2f2d6b Prevent cursor from getting stuck at infinity 2018-02-04 22:40:24 +01:00
Markus Ongyerth 3cf7225cec decouples outputenable state and wl_output global
This decouples wlr_output_enable and the wl_global.
The previously internal functions wlr_output_(destroy/create)_global are
exposed and used automatically in the wlr_output_layout to create/tear
down the global.
The compositor can handle them itself if it wants to, but I think this
is the right moment to create/destroy the wl_output when the
wlr_output_layout is used.
2018-01-23 17:40:12 +01:00
emersion 33c427a6aa
output_layout: disabled outputs are just like enabled outputs 2018-01-07 18:40:58 +01:00