Commit Graph

39 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
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 Zeni a92e5f8d46 types/wlr_input_device: move output_name field to wlr_pointer and wlr_touch 2022-03-17 13:44:18 -04:00
Simon Zeni cfed039c9a types/wlr_input_device: move init and finish function to private API 2022-03-07 16:37:41 +00:00
Simon Zeni 1bb2631c5c types/wlr_input_device: remove wlr_input_device_destroy 2022-03-07 16:37:41 +00:00
Simon Zeni 10cbb9fbe1 interface/wlr_touch: rework destroy sequence
The destroy callback in wlr_touch_impl has been removed. The function
`wlr_touch_finish` has been introduced to clean up the resources owned by a
wlr_touch.

`wlr_input_device_destroy` no longer destroys the wlr_touch, attempting to
destroy a wlr_touch will result in a no-op.

The field `name` has been added to the wlr_touch_impl to be able to identify
a given wlr_touch device.
2022-03-07 16:37:41 +00:00
Simon Zeni 8d3cb94b41 interface/wlr_tablet_tool: rework destroy sequence
The destroy callback in wlr_tablet_tool_impl has been removed. The function
`wlr_tablet_tool_finish` has been introduced to clean up the resources owned by
a wlr_tablet_tool.

`wlr_input_device_destroy` no longer destroys the wlr_tablet_tool, attempting to
destroy a wlr_tablet_tool will result in a no-op.

The field `name` has been added to the wlr_tablet_tool_impl to be able to
identify a given wlr_tablet_tool device.
2022-03-07 16:37:41 +00:00
Simon Zeni a5b032cb1e interface/wlr_tablet_pad: rework destroy sequence
The destroy callback in wlr_tablet_pad_impl has been removed. The function
`wlr_tablet_pad_finish` has been introduced to clean up the resources owned by a
wlr_tablet_pad.

`wlr_input_device_destroy` no longer destroys the wlr_tablet_pad, attempting to
destroy a wlr_tablet_pad will result in a no-op.

The field `name` has been added to the wlr_tablet_pad_impl to be able to identify
a given wlr_tablet_pad device.
2022-03-07 16:37:41 +00:00
Simon Zeni 0d2be496a8 interface/wlr_switch: rework destroy sequence
The destroy callback in wlr_switch_impl has been removed. The function
`wlr_switch_finish` has been introduced to clean up the resources owned by a
wlr_switch.

`wlr_input_device_destroy` no longer destroys the wlr_switch, attempting to
destroy a wlr_switch will result in a no-op.

The field `name` has been added to the wlr_switch_impl to be able to identify
a given wlr_switch device.
2022-03-07 16:37:41 +00:00
Simon Zeni 51cd3c0726 interface/wlr_pointer: rework destroy sequence
The destroy callback in wlr_pointer_impl has been removed. The function
`wlr_pointer_finish` has been introduced to clean up the resources owned by a
wlr_pointer.

`wlr_input_device_destroy` no longer destroys the wlr_pointer, attempting to
destroy a wlr_pointer will result in a no-op.

The field `name` has been added to the wlr_pointer_impl to be able to identify
a given wlr_pointer device.
2022-03-07 16:37:41 +00:00
Simon Zeni 7dc4a3ecd7 interface/wlr_keyboard: rework destroy sequence
The destroy member in wlr_keyboard_impl has been removed. The function
`wlr_keyboard_finish` has been introduce to clean up the resources owned by a
wlr_keyboard.

`wlr_input_device_destroy` no longer destroys the wlr_keyboard, attempting to
destroy a wlr_keyboard will result in a no-op.

The field `name` has been added to the wlr_keyboard_impl to be able to identify
a given wlr_keyboard device.
2022-03-07 16:37:41 +00:00
Simon Zeni e279266f71 interfaces: remove wlr_input_device_impl 2022-02-22 14:23:46 -05:00
Simon Zeni 130c3bcf63 types/wlr_input_device: call the specialized input device destroy function on destroy
In case the `wlr_input_device` is not owned by a specialized input device, the
function will finish the wlr_input_device and call it's implementation destroy
function if an implementation has been supplied, or simply free it.
2022-02-21 17:11:32 +00:00
Simon Zeni fd80329c53 interfaces/wlr_input_device: introduce wlr_input_device_finish
This function releases the wlr_input_device allocated memory (it's name and
it's output name), and signals its destroy event.
2022-02-21 17:11:32 +00:00
Simon Zeni 71577e351e types/wlr_input_device: default vendor and product id to 0
vendor and product id are set when needed by the libinput backend
2022-02-21 17:11:32 +00: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
Ryan Walklin 4453757fc9 s/lid_switch/switch_device
Rename lid_switch to switch_device to disambiguate lid and tablet mode switches.
2019-03-19 22:45:58 -04:00
Ryan Walklin 2a3c62b4d2 [WIP][DONTMERGE]Add support for libinput_switch input devices
These are used primarily by laptops to signal
the state of the lid (open/closed) and tablet
mode if supported, based on ACPI events.
2018-12-15 14:42:35 +11:00
emersion 2d0c5ec78e
Use _POSIX_C_SOURCE, use shm_open 2018-11-06 08:29:23 +01:00
Markus Ongyerth d9e978e1b3 rename wlr_tablet_tool to wlr_tablet
The previous naming was based on the input-device capability names from
libinput.
With code that uses the libinput_tablet_tool and mapping into tablet-v2,
this is confusing, so the name is changed to follow the names used in
the protocol.
2018-07-14 09:49:58 +02:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
emersion 2551ef8871
input-device: add output_name field, populate it from libinput 2018-04-29 14:30:09 +01:00
Scott Anderson 3c9fc7c68e Add const to x11 and input interfaces 2018-03-06 21:16:18 +13:00
Drew DeVault 1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson 86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13: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 10ecf871f2
Remove wlr_backend.events.{output_remove,device_remove} 2018-02-12 10:36:43 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
Markus Ongyerth 935b6d871e fixes use after free caused by signal lists
A structs throughout the code use implementation specific free
functions.
When those functions are not used, they simply call free() on their
data, but this leaves around wl_signals linked into listeners.
When those listeners try to remove themself from the list, they write
into the now free memory.

This commit adds calls to remove the signals from those lists, so the
listeners can safely call wl_list_remove
2017-09-08 16:02:26 +02:00
Tony Crisci 5c845f14ed handle input device destroy 2017-08-28 10:29:53 -04:00
nyorain f998bb8299 Fix style issues 2017-08-14 17:09:56 +02:00
Dominique Martinet e6ad67911b Refactor out wlr_input_device_state 2017-08-14 16:22:31 +02:00
Drew DeVault f4453d104d Reorganize wlr-common 2017-06-21 12:10:07 -04:00
Drew DeVault fd91244e83 Update everyone to use new headers 2017-06-21 10:27:45 -04:00
Drew DeVault 7a5f35b5bb Reassign ownership of libinput handle 2017-06-13 08:10:36 -04:00
Drew DeVault 0e75d157f5 Initialize keyboards from libinput 2017-06-13 08:10:36 -04:00