TOKEN_STRLEN is not actually the strlen() of the token. It's the
size taken by the token included the final zero byte.
Change the name to make this clearer, and remove unnecessary +1's.
The new struct rect_union is designed to make it easier to
efficiently accumulate a list of rectangles, and then operate
on an exact cover of their union.
Using rect_union, the times needed to added t rectangles, and then
compute their exact cover will be O(t), and something between Ω(t) and
O(t^2), depending on the rectangle arrangement. If one tries to do
the same by storing a pixman_region32_t and updating it with
pixman_region32_union_rect(), then total time needed would be between
Ω(t^2) and O(t^3), depending on the input. Without changing the public
API (data structure + rectangle ordering rules) for pixman_region32_t,
it is impossible to improve its worst case time.
0xFFFFFFFF milliseconds is 4,294,967,295 ms so about 50 days.
A little bit too close for comfort.
Use int64_t instead of uint64_t to avoid C's implicit conversion
footguns in computations.
array_realloc will grow the array for the target size like wl_insert_add, but
will also shrink the array if the target size is sufficiently smaller than the
current allocation.
If the display is destroyed before wlr_global_destroy_safe's timer
fires, the struct destroy_global_data is leaked. This shouldn't cause
issues in practice because the timer will never fire, but makes it
harder to spot compositor memory leaks.
When testing Xwayland multi-HiDPI support with Wine + SimCity4
I encountered a 100% CPU lockup from sway. This turned out to be
triggering a bug in the wlroots pointer contraint code.
region_confine() contains multiple recursive calls where arguments
are modified and resubmitted to the function. One of the calls
is however made using the original arguments, if/when this triggers
it results in the same codepath being followed each loop so the
condition always applies.
It makes much more sense if this was intended to apply the clamped
values x,y instead of the original x1,y1, and indeed this fixes the
infinite loop and results in correct behaviour.
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.
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.
Fixes:
FAILED: subprojects/wlroots/libwlroots.so.7.p/util_uuid.c.o
cc -Isubprojects/wlroots/libwlroots.so.7.p -Isubprojects/wlroots -I../subprojects/wlroots -Isubprojects/wlroots/include -I../subprojects/wlroots/include -Isubprojects/wlroots/protocol -I../subprojects/wlroots/protocol -I/usr/local/include -I/usr/local/include/libepoll-shim -I/usr/local/include/libdrm -I/usr/local/include/pixman-1 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -g -DWLR_USE_UNSTABLE -Wundef -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wstrict-prototypes -Wendif-labels -Wstrict-aliasing=2 -Woverflow -Wmissing-prototypes -Wno-missing-braces -Wno-missing-field-initializers -Wno-unused-parameter '-DWLR_REL_SRC_DIR="../subprojects/wlroots/"' -Wno-missing-field-initializers -Wno-missing-braces -DHAS_LIBUUID=0 '-DICONDIR="/usr/local/share/icons"' -fPIC -pthread -D_THREAD_SAFE -MD -MQ subprojects/wlroots/libwlroots.so.7.p/util_uuid.c.o -MF subprojects/wlroots/libwlroots.so.7.p/util_uuid.c.o.d -o subprojects/wlroots/libwlroots.so.7.p/util_uuid.c.o -c ../subprojects/wlroots/util/uuid.c
../subprojects/wlroots/util/uuid.c:28:2: error: implicit declaration of function 'assert' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
assert(strlen(str) + 1 == 37);
^
../subprojects/wlroots/util/uuid.c:28:2: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
../subprojects/wlroots/util/uuid.c:29:25: error: sizeof on array function parameter will return size of 'char *' instead of 'char [static 37]' [-Werror,-Wsizeof-array-argument]
memcpy(out, str, sizeof(out));
^
../subprojects/wlroots/util/uuid.c:15:25: note: declared here
bool generate_uuid(char out[static 37]) {
^
../subprojects/wlroots/util/uuid.c:29:26: error: 'memcpy' call operates on objects of type 'char' while the size is based on a different type 'char *' [-Werror,-Wsizeof-pointer-memaccess]
memcpy(out, str, sizeof(out));
~~~ ^~~
../subprojects/wlroots/util/uuid.c:29:26: note: did you mean to provide an explicit length?
memcpy(out, str, sizeof(out));
Fixes#2616