Commit Graph

27 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
Väinö Mäkelä a2f94b500c virtual-keyboard: Handle inert seats 2023-06-03 10:43:12 +00:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Isaac Freund 91943a68a6 wlr_input_device: remove anon union field
This union is unnecessary since the recent input device refactor and can
now be replaced by wlr_*_from_input_device() functions.
2022-06-21 18:42:07 +00:00
Simon Zeni 9a17200446 types/wlr_keyboard: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni 45c8771735 types/wlr_virtual_keyboard_v1: remove destroy event
The destroy event from the keyboard base wlr_input_device must be used
2022-03-11 20:02:21 +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 cdb3e80b39 types/wlr_virtual_keyboard_v1: fix wlr_keyboard destroy sequence 2022-02-28 22:02:57 +00:00
Simon Zeni e279266f71 interfaces: remove wlr_input_device_impl 2022-02-22 14:23:46 -05:00
Simon Zeni a1978b1299 types/wlr_keyboard: add base wlr_input_device
wlr_keyboard owns its base wlr_input_device. It will be initialized when the
keyboard is initialized, and finished when the keyboard is destroyed.
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
Yuya Nishihara 8008d21f5b virtual_keyboard: Emulate key release events on destroy
According to libinput, release events are generated when device is unplugged,
and libinput copies this behavior for device removal. Let's do the same for
our virtual keyboard.

8f846a41fa

This is another attempt to fix #2034 and the following sway issue:

https://github.com/swaywm/sway/issues/6254

Note that we have other key repeating issues in sway, which aren't addressed
by this patch. Since the virtual keyboard itself isn't destroyed when the
keyboard grab is destroyed, we'll probably need some trick to reset the state
of the corresponding virtual keyboard when the grab is released.

https://github.com/swaywm/sway/issues/6095
https://github.com/swaywm/sway/issues/6193
2021-05-07 11:18:19 +02:00
Daniel De Graaf c236f60bb6 wlr_virtual_keyboard: fix fd leak 2020-08-09 21:13:06 +02:00
xdavidwu 61e2ebac90 virtual-keyboard: add wlr_input_device_get_virtual_keyboard 2020-07-08 11:21:57 +02:00
Dorota Czaplejewicz fadd4706ed virtual_keyboard: Accept keycode 0 2019-11-27 16:49:12 +01:00
Simon Ser 5cde35923c Simplify globals implementation by removing destructors
Some globals are static and it doesn't make sense to destroy them before
the wl_display. For instance, wl_compositor should be created before the
display is started and shouldn't be destroyed.

For these globals, we can simplify the code by removing the destructor
and stop keeping track of wl_resources (these will be destroyed with the
wl_display by libwayland).
2019-11-25 09:01:46 -05:00
amingin b1b93c2c7e Fixes crash of compositor when unvalidated keycode 0 is passed (#1833)
* Fixes crash of compositor when unvalidated keycode 0 is passed from virtual keyboard

* Style fix
2019-09-27 13:11:30 +03:00
Dorota Czaplejewicz 0b1f9439ba virtual_keyboard: Require keymap before accepting keycodes 2019-06-24 17:16:37 +03:00
Brian Ashworth 6dfe238ff1 zwp_virtual-keyboard: fix mmap error handling
If mmap fails, it will return MAP_FAILED not NULL. Since the error
handling was incorrectly checking for NULL, MAP_FAILED was being passed
to xkb_keymap_new_from_string, on mmap failure, causing a segfault.
This just fixes the error checking.
2019-05-31 07:58:31 +03:00
Alexander Bakker 221d412824 Init the new destroy signals added by #1200 2018-08-27 18:21:36 +02:00
Alexander Bakker 20db29779e Add destroy signals to types that are destroyed by wl_display_destroy 2018-08-26 23:23:12 +02:00
Dorota Czaplejewicz 6db9c4b746 wlr_virtual_keyboard: use wlr_input_device_destroy 2018-08-22 14:43:29 +01:00
emersion f86f1daf9a Fix build on FreeBSD 2018-08-16 10:54:45 +01:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
emersion f580112dca
virtual-keyboard: fix wlr_virtual_keyboard_manager_v1_destroy 2018-05-30 09:25:46 +01:00
Dorota Czaplejewicz 5334ee8bfd virtual-keyboard: add support for the virtual-keyboard-v1 protocol 2018-05-28 10:05:55 +02:00