Commit Graph

19 Commits

Author SHA1 Message Date
Simon Ser 4377b55292 util/global: remove wl_display arg from wlr_global_destroy_safe
Since [1], we can get the wl_display directly from the wl_global.

[1]: 2b22160fb6
2021-12-14 13:13:50 +00:00
Simon Ser 55ca93469c util/shm: add allocate_shm_file_pair
This function behaves like allocate_shm_file, except it also
returns a read-only FD. This is useful to share the same segment
of memory with many Wayland clients.
2021-09-05 22:06:25 +02:00
Simon Ser a6ed4ae308 util/array: add array_remove_at 2021-07-01 10:35:39 -04:00
Ryan Farley b29ac8fbac util/uuid: replace with util/token, remove libuuid
Use 128-bit hexadecimal string tokens generated with /dev/urandom
instead of UUIDs for xdg-foreign handles, removing the libuuid
dependency. Update readme and CI. Closes #2830.

build: remove xdg-foreign feature

With no external dependencies required, there's no reason not to always
build it. Remove WLR_HAS_XDG_FOREIGN as well.
2021-04-11 19:09:36 +02:00
Ilia Bozhinov bf4e2e0eac util: add support for generating UUIDs
Co-authored-by: Jason Francis <cycl0ps@tuta.io>
2021-01-05 20:32:56 +01:00
Simon Ser f0c1b32120 util/time: add timespec_from_nsec 2020-12-18 10:37:08 +01:00
Tudor Brindus 363bf44a35 util/time: move `timespec_sub` to time utilities 2020-06-06 00:09:19 +02:00
Tudor Brindus c9c31f803e util/time: de-duplicate `timespec_to_msec` 2020-06-06 00:09:19 +02:00
Tudor Brindus dc13bb827d util: fix and move `get_current_time_msec` into a util file
This commit makes `get_current_time_msec` correctly return milliseconds
as opposed to microseconds. It also considers the value of `tv_sec`, so
we don't lose occasionally go back in time by one second. Finally, the
function is moved into `util/time.cc` so that it can be reused elsewhere
without having to consider these pitfalls.
2020-06-06 00:09:19 +02:00
Simon Ser 29726e6816 util: add wlr_output_destroy_safe
This adds a generic helper to destory transient globals.

See [1]. This patch depends on [2] and [3].

[1]: https://gitlab.freedesktop.org/wayland/wayland/issues/10
[2]: https://gitlab.freedesktop.org/wayland/wayland/merge_requests/28
[3]: https://gitlab.freedesktop.org/wayland/wayland/merge_requests/30
2020-02-17 20:52:37 +01: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
Ashkan Kiani 06a13203dd Use a set to track pointer button state.
In addition to `button_count`, we keep track of the current buttons
pressed just as in `wlr_keyboard`.

Add `set_add` and `set_remove` to assist with this. These functions can
only be used with values greater than 0 (such as the button/key masks
for keyboards and pointers).

Partially addresses:
- https://github.com/swaywm/wlroots/issues/1716
- https://github.com/swaywm/wlroots/issues/1593
2019-06-16 00:59:53 +03:00
emersion 346ec21c4c
util: use shm_open for in-memory files
shm_open is a POSIX function creating an in-memory file. Using it simplifies
the code and removes the dependency on XDG_RUNTIME_DIR. The only downside is
that we need to generate a random name for the shm file.
2018-10-28 22:39:54 +01:00
Markus Ongyerth 74ca2f8fcf Another round of feedback from acrisci 2018-07-14 09:52:34 +02: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
Moritz cef6d75491 Moved os-compatibility and added header
* Moved os-compatibility.c to util
* Added header under util
* Removed static since it isn't needed (i think so)
* Adjusted meson.build to include lib_wlr

Improved some codestyle

* Added guard to os-compatibility.h
* Fixed typo in include statment

Adjusted Guard

* Changed guard to _WLR_UTIL_OS_COMPATIBILITY
2017-11-30 18:01:13 +01:00