diff --git a/src/border.c b/src/border.c index 0b4c791f..f31a6a06 100644 --- a/src/border.c +++ b/src/border.c @@ -208,7 +208,7 @@ void border_create(struct window *window) sls_window_disable_shadow(window->border.id); SLSSetWindowResolution(g_connection, window->border.id, g_window_manager.border_resolution); SLSSetWindowOpacity(g_connection, window->border.id, 0); - SLSSetWindowLevel(g_connection, window->border.id, window_level(window)); + SLSSetWindowLevel(g_connection, window->border.id, window_level(window->id)); if (g_window_manager.border_blur) { SLSSetWindowBackgroundBlurRadiusStyle(g_connection, window->border.id, 24, 1); diff --git a/src/event_loop.c b/src/event_loop.c index 309cc6a1..059a9783 100644 --- a/src/event_loop.c +++ b/src/event_loop.c @@ -752,9 +752,7 @@ static EVENT_HANDLER(SLS_WINDOW_ORDER_CHANGED) struct border *border = &window->border; if (border->id && border_should_order_in(window)) { - int window_level = 0; - SLSGetWindowLevel(g_connection, window_id, &window_level); - SLSSetWindowLevel(g_connection, border->id, window_level); + SLSSetWindowLevel(g_connection, border->id, window_level(window_id)); SLSOrderWindow(g_connection, border->id, -1, window_id); } } @@ -1214,8 +1212,8 @@ static EVENT_HANDLER(MOUSE_MOVED) struct window *sub_window = window_manager_find_window(&g_window_manager, wid); if (!sub_window) continue; - if (!window_check_flag(sub_window, WINDOW_FLOAT)) continue; - if (window_level(sub_window) != g_layer_below_window_level) continue; + if (!window_check_flag(sub_window, WINDOW_FLOAT)) continue; + if (window_level(sub_window->id) != g_layer_below_window_level) continue; if (CGRectContainsRect(window->frame, sub_window->frame)) { occludes_window = true; diff --git a/src/view.c b/src/view.c index 7f93b79d..46aea938 100644 --- a/src/view.c +++ b/src/view.c @@ -17,7 +17,7 @@ void insert_feedback_show(struct window_node *node) sls_window_disable_shadow(node->feedback_window.id); SLSSetWindowResolution(g_connection, node->feedback_window.id, 2.0f); SLSSetWindowOpacity(g_connection, node->feedback_window.id, 0); - SLSSetWindowLevel(g_connection, node->feedback_window.id, g_layer_above_window_level); + SLSSetWindowLevel(g_connection, node->feedback_window.id, g_layer_below_window_level); node->feedback_window.context = SLWindowContextCreate(g_connection, node->feedback_window.id, 0); CGContextSetLineWidth(node->feedback_window.context, g_window_manager.border_width); CGContextSetRGBFillColor(node->feedback_window.context, diff --git a/src/window.c b/src/window.c index a160edd8..4e7a0b68 100644 --- a/src/window.c +++ b/src/window.c @@ -127,7 +127,7 @@ void window_serialize(FILE *rsp, struct window *window) uint64_t sid = window_space(window); int space = space_manager_mission_control_index(sid); int display = display_arrangement(space_display_id(sid)); - int level = window_level(window); + int level = window_level(window->id); const char *layer = window_layer(level); bool is_minimized = window_is_minimized(window); bool visible = !is_minimized && !window->application->is_hidden && (window_check_flag(window, WINDOW_STICKY) || space_is_visible(sid)); @@ -341,12 +341,12 @@ float window_opacity(struct window *window) return alpha; } -int window_level(struct window *window) +int window_level(uint32_t wid) { int level = 0; if (workspace_is_macos_ventura() || workspace_is_macos_sonoma()) { - CFArrayRef window_ref = cfarray_of_cfnumbers(&window->id, sizeof(uint32_t), 1, kCFNumberSInt32Type); + CFArrayRef window_ref = cfarray_of_cfnumbers(&wid, sizeof(uint32_t), 1, kCFNumberSInt32Type); CFTypeRef query = SLSWindowQueryWindows(g_connection, window_ref, 1); if (!query) goto err2; @@ -364,7 +364,7 @@ int window_level(struct window *window) err2: CFRelease(window_ref); } else { - SLSGetWindowLevel(g_connection, window->id, &level); + SLSGetWindowLevel(g_connection, wid, &level); } return level; @@ -429,7 +429,7 @@ char *window_subrole_ts(struct window *window) bool window_level_is_standard(struct window *window) { - int level = window_level(window); + int level = window_level(window->id); if (level == g_layer_below_window_level) return true; if (level == g_layer_normal_window_level) return true; if (level == g_layer_above_window_level) return true; diff --git a/src/window.h b/src/window.h index b256d69a..73f791fe 100644 --- a/src/window.h +++ b/src/window.h @@ -77,7 +77,7 @@ char *window_title_ts(struct window *window); CGPoint window_ax_origin(struct window *window); CGRect window_ax_frame(struct window *window); float window_opacity(struct window *window); -int window_level(struct window *window); +int window_level(uint32_t wid); uint64_t window_tags(struct window *window); CFStringRef window_role(struct window *window); char *window_role_ts(struct window *window); diff --git a/src/window_manager.c b/src/window_manager.c index b94722fb..245c54e9 100644 --- a/src/window_manager.c +++ b/src/window_manager.c @@ -676,7 +676,7 @@ void window_manager_animate_window_list_async(struct window_capture *window_list window_manager_destroy_window_proxy(context->animation_connection, &existing_animation->proxy); } else { - SLSGetWindowLevel(context->animation_connection, context->animation_list[i].wid, &context->animation_list[i].proxy.level); + context->animation_list[i].proxy.level = window_level(context->animation_list[i].wid); SLSGetWindowBounds(context->animation_connection, context->animation_list[i].wid, &context->animation_list[i].proxy.frame); context->animation_list[i].proxy.image = SLSHWCaptureWindowList(context->animation_connection, &context->animation_list[i].wid, 1, (1 << 11) | (1 << 8)); window_manager_create_window_proxy(context->animation_connection, &context->animation_list[i].proxy);