Commit Graph

9 Commits

Author SHA1 Message Date
Simon Ser 842093bb84 Define _POSIX_C_SOURCE globally
Stop trying to maintain a per-file _POSIX_C_SOURCE. Instead,
require POSIX.1-2008 globally. A lot of core source files depend
on that already.

Some care must be taken on a few select files where we need a bit
more than POSIX. Some files need XSI extensions (_XOPEN_SOURCE) and
some files need BSD extensions (_DEFAULT_SOURCE). In both cases,
these feature test macros imply _POSIX_C_SOURCE. Make sure to not
define both these macros and _POSIX_C_SOURCE explicitly to avoid
POSIX requirement conflicts (e.g. _POSIX_C_SOURCE says POSIX.1-2001
but _XOPEN_SOURCE says POSIX.1-2008).

Additionally, there is one special case in render/vulkan/vulkan.c.
That file needs major()/minor(), and these are system-specific.
On FreeBSD, _POSIX_C_SOURCE hides system-specific symbols so we need
to make sure it's not defined for this file. On Linux, we can
explicitly include <sys/sysmacros.h> and ensure that apart from
symbols defined there the file only uses POSIX toys.
2024-02-15 15:41:12 +01:00
Paul Cercueil 220df2aa0f
Add more POSIX compliance macros to fix uClibc support
- Add POSIX 1993.09 compliance macro in source files that use
  "struct timespec";
- Add POSIX 2001.12 compliance macro in source files that use
  "struct sigaction" and the SA_SIGINFO macro, or the fchmod()
  function;
- Add POSIX 2008.09 compliance macro in source files that use the
  getline() function.

These compliance macros are enough for wlroots to compile with the
git-master version of uClibc-ng.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2024-02-12 17:41:45 +01:00
Kirill Primak c63f3659c5 layer-shell: use unified map logic 2023-06-02 17:26:18 +00:00
Johan Malm 338e0a3976 scene/layer_shell_v1.c: remove redundant comment 2022-11-29 18:01:57 +00:00
Johan Malm 8e80432a72 scene/layer_shell_v1.c: set exclusive zone correctly
...when only one edge is anchored.

The layer-shell protocol specifies that a positive exclusive-zone value is
'meaningful' if the surface is anchored to either:

1. one edge
2. one edge and both perpendicular edges.

For example, if you wish to position a layer-shell client along the top
edge and make it exclusive, you should be able to either set anchor=TOP or
anchor=TOP|LEFT|RIGHT. It appears that many panels/bars use the latter
approach (anchor to an edge and also both perpendicular edges) which is
probably why this has not been reported previously.

This patch adds support for the first case and thereby makes exclusive
zone behaviour consistent with the protocol and also with sway's extant
layer-shell implementation.
2022-11-29 18:01:57 +00:00
Kenny Levinsen 3baf2a6bcf scene/layer_shell: Ignore unmapped exclusion zone
Only the exclusion zone for mapped layer shell surfaces should be respected. In
particular, a layer shell surface that was mapped with an exclusion zone but is
now unmapped should not adjust the usable area.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3471
2022-08-06 00:23:44 +02:00
Johan Malm d57d2e0e36 scene/layer_shell_v1.c: fix bug in width/height calculations
...in wlr_scene_layer_surface_v1_configure()

Reproduce bug with waybar by setting `"margin": 5,`
in ~/.config/waybar/config. It will result in the right edge of the panel
extending outside the edge of the output.

The bug can also be reproduced with gtk-layer-demo by anchoring
left/right/top/bottom and setting respective margins

Relates-to: https://github.com/labwc/labwc/issues/382
2022-06-08 20:13:55 +00:00
Alexander Orzechowski ccd0f85c2a wlr_scene: Only allow parenting on a wlr_scene_tree 2022-05-31 09:14:28 +00:00
Kenny Levinsen 1e3662ce57 scene: Add layer_shell_v1 helper
This helper behaves similar to the xdg_shell helper, and additionally
provides a little assistance for positioning and exclusive_zone
management.
2022-02-01 13:31:26 +01:00