Commit Graph

16 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
Alexander Orzechowski 1b0694b794 treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical 2023-10-03 01:51:07 -04:00
Simon Ser fe06e5f49a Use wl_container_of() instead of casts
This slightly improves type safety.

The culprits were found with:

    git grep -E '\([a-z0-9_ ]+ \*\)\W?[a-z]'
2023-07-11 20:16:17 +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
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Simon Ser 6c350799b2 Zero-initialize structs in init functions
Ensures there is no field left to its previous undefined value after
calling an init function.
2022-04-28 10:09:50 +02:00
Simon Ser ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
emersion 790f0c52a1
De-duplicate data source MIME types 2019-01-30 22:10:52 +01:00
emersion 909b3b16f3
data-device: add wlr_data_offer.type 2019-01-24 12:18:40 +01:00
emersion 84f278eca1
data-device: remove data_source_send_offer 2019-01-24 12:12:55 +01:00
emersion 1150ff13ce
data-device: make sources inert, rename cancel to destroy 2019-01-24 12:12:55 +01:00
emersion 5d26da9d15
data-device: allow multiple devices for the same seat
This commit makes it possible for a single client to have multiple data devices
for the same seat. This fixes issues with Firefox.

This mainly removes wlr_data_source.offer. We make sure we create one data
offer per device. We now make the offer inert when the source is destroyed.

Fixes the second half of https://github.com/swaywm/wlroots/issues/1041
2018-11-26 12:35:48 +01:00
emersion 2d0c5ec78e
Use _POSIX_C_SOURCE, use shm_open 2018-11-06 08:29:23 +01:00
emersion f44003f04b data-device: remove wlr_data_source.seat_client
Since the source doesn't always come from a client, this field
doesn't make sense. It is replaced by a new "finalized" field in
wlr_client_data_source. This is used to make sure set_actions is
not sent after start_drag has been sent.

A check in data_offer_choose_action has been removed: if an offer
has been sent then start_drag has been called, no need to check.

I also wanted to add a check for wl_data_source.offer, but it
turns out (1) this isn't in the spec (2) it breaks GTK+.

This is some preliminary work for Firefox on Wayland compatibility.
2018-10-07 16:01:57 +02:00
emersion 5d37b14116
data-device: make sure resources are correctly destroyed 2018-05-03 20:22:51 +01:00
emersion 1e563e7ecf
data-device: split into multiple files 2018-05-02 18:04:10 +01:00