reintroduce transactional window ordering on Sonoma (#336)

This commit is contained in:
Felix Kratz 2023-10-06 19:29:36 +02:00
parent 0d4b45c710
commit 8bc95526d8
2 changed files with 28 additions and 14 deletions

View file

@ -1,21 +1,23 @@
CFLAGS = -std=c99 -Wall -Ofast -ffast-math -fvisibility=hidden -fno-common
LIBS = -framework Carbon \
-framework AppKit \
-framework CoreAudio \
-framework CoreWLAN \
-framework CoreVideo \
-framework IOKit \
-F/System/Library/PrivateFrameworks \
-framework SkyLight \
-framework DisplayServices \
-framework MediaRemote
-framework AppKit \
-framework CoreAudio \
-framework CoreWLAN \
-framework CoreVideo \
-framework IOKit \
-F/System/Library/PrivateFrameworks \
-framework SkyLight \
-framework DisplayServices \
-framework MediaRemote
ODIR = bin
SRC = src
_OBJ = alias.o background.o bar_item.o custom_events.o event.o graph.o \
image.o mouse.o shadow.o font.o text.o message.o mouse.o bar.o color.o \
window.o bar_manager.o display.o group.o mach.o popup.o \
animation.o workspace.om volume.o slider.o power.o wifi.om media.om \
image.o mouse.o shadow.o font.o text.o message.o mouse.o bar.o color.o \
window.o bar_manager.o display.o group.o mach.o popup.o \
animation.o workspace.om volume.o slider.o power.o wifi.om media.om \
hotload.o
OBJ = $(patsubst %, $(ODIR)/%, $(_OBJ))

View file

@ -110,7 +110,7 @@ void window_move(struct window* window, CGPoint point) {
windows_freeze();
SLSTransactionMoveWindowWithGroup(g_transaction, window->id, point);
} else {
// Big Sur and Previous
// Big Sur and previous
SLSMoveWindow(g_connection, window->id, &point);
CFNumberRef number = CFNumberCreate(NULL,
kCFNumberSInt32Type,
@ -130,11 +130,13 @@ bool window_apply_frame(struct window* window, bool forced) {
CFTypeRef frame_region = window_create_region(window, window->frame);
if (__builtin_available(macOS 13.0, *)) {
// Ventura and later
SLSSetWindowShape(g_connection, window->id,
g_nirvana.x,
g_nirvana.y,
frame_region);
} else {
// Monterey and previous
if (window->parent) {
SLSOrderWindow(g_connection, window->id, 0, window->parent->id);
}
@ -195,7 +197,17 @@ void window_order(struct window* window, struct window* parent, int mode) {
windows_freeze();
window->parent = parent;
if (mode != W_OUT) window->order_mode = mode;
SLSOrderWindow(g_connection, window->id, mode, parent ? parent->id : 0);
if (__builtin_available(macOS 14.0, *)) {
// Sonoma and later
SLSTransactionOrderWindow(g_transaction,
window->id,
mode,
parent ? parent->id : 0);
} else {
// Ventura and previous
SLSOrderWindow(g_connection, window->id, mode, parent ? parent->id : 0);
}
}
void window_assign_mouse_tracking_area(struct window* window, CGRect rect) {