Commit Graph

31 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
Guido Günther b032161785 input-method: Simplify resetting of input state
We have current and pending state and the code uses struct
assignments between them and resets and frees in multiple places.

Introduce a reset() function so we can unify that.
2023-12-18 16:21:48 +01:00
pastel raschke 3bf9000a52 input-method-v2: validate commit serial 2023-12-18 11:15:51 +01:00
pastel raschke 6ee5bd9eee input-method-v2: free current strings on commit 2023-12-18 11:14:41 +01:00
Simon Ser 81f5607ad9 input-method-v2: drop unnecessary variable and cast 2023-12-18 11:14:08 +01:00
Kirill Primak 0de3659698 Drop wl_client and user data assertions in bind handlers
A client can never be NULL and user data assertions aren't really
useful there.
2023-10-10 20:10:00 +03:00
Alexander Orzechowski 1b0694b794 treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical 2023-10-03 01:51:07 -04:00
Kirill Primak 7df11ada5e Unmap wlr_surface before making its role object inert 2023-07-26 20:39:03 +00:00
Kirill Primak f4eaab12a0 input-method-v2: don't remove inert role resource 2023-07-10 10:03:24 +02:00
Simon Ser 8a5b5e6f28 compositor: listen to role_resource destroy signal
Call wlr_surface_destroy_role_object() when the role_resource is
destroyed.
2023-06-23 14:33:26 +02:00
Simon Ser 89cb484220 compositor: replace role_data with role_resource
This increases type safety, makes it more obvious that role_data
must represent the role object, and will allow for automatic
cleanup when the resource is destroyed.
2023-06-23 14:23:27 +02:00
Simon Ser 00f1870d35 input-method-v2: add popup_surface_from_resource()
This checks the resource type before casting its user data pointer.
2023-06-23 14:14:36 +02:00
Kirill Primak 0f67580aab compositor: introduce wlr_surface_set_role_object() 2023-06-23 11:54:05 +00:00
Väinö Mäkelä 16948c7369 input-method: Handle inert seats 2023-06-03 10:43:12 +00:00
Kirill Primak 743da5c0ae input-method: use unified map logic 2023-06-02 17:26:18 +00:00
Simon Ser 49cb85ad72 input-method-v2: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:13:30 +01:00
Kirill Primak 099b9de752 compositor: drop role object NULL checks in handlers
Instead, move the check to the caller.
2022-11-06 17:00:00 +03:00
Kirill Primak 75af6a0a39 input-method: use role object destroy handler 2022-11-06 17:00:00 +03:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Kenny Levinsen 668b2740ff Set mapped before firing map/unmap events
This allows whatever the user calls from the signal handlers to react to observe
the new state rather than the old, e.g. that a surface is no longer mapped in
the unmap handler.
2022-08-06 00:19:38 +02:00
Simon Zeni eae8952e17 types/wlr_keyboard: remove destroy event
The destroy event from the base wlr_input_device must be used
2022-03-11 20:02:21 +00:00
Tadeo Kondrak 5091118bed input_method_v2: improve mapping detection
Detect NULL commits before the surface is actually committed, allowing
the surface to be properly damaged on unmap.
2022-01-16 09:08:39 -07:00
Kirill Primak 617eb4fb93 surface: deprecate wlr_surface.h 2022-01-13 10:06:41 +00:00
Isaac Freund e326b76959
text-input/input-method: handle strdup() failure 2021-11-07 21:01:24 +01:00
Tadeo Kondrak 30d3c76817 Implement input_method_v2 popups 2021-09-22 09:42:14 +02:00
Simon Ser 372a52ecc0
input-method: send modifiers in set_keyboard
Otherwise the client might have an outdated modifiers state. The same is
done in wlr_seat_keyboard [1].

[1]: 8348fc3ef8/types/seat/wlr_seat_keyboard.c (L163)
2020-11-06 19:14:55 +01:00
xdavidwu 595f324f8b input-method: implement keyboard grabs 2020-07-08 11:21:57 +02: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
Sebastian Krzyszkowiak 913cac1835 wlr_input_method_v2: Remove input method's resource from the list on destroy
It's added to manager->input_methods list in manager_get_input_method, but
wasn't removed anywhere, leading to possible use-after-free in
wlr_input_method_manager_v2_destroy.
2019-08-09 08:05:55 +09:00
emersion de8d87f5ae
input-method-v2: initialize destroy signal 2018-10-28 12:23:47 +01:00
Dorota Czaplejewicz cec7471119 wlroots: add basic support for zwp_input_method_v2
Implemented basic input method functionality. Not included: popups, grabbing.
2018-10-09 09:56:46 +00:00