diff --git a/CHANGELOG.md b/CHANGELOG.md index 60e65d9e..600bbd7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Re-construct application switched and window created events in the correct order when the window is moved through a rule upon creation [#564](https://github.com/koekeishiya/yabai/issues/564) - Improve interaction between *window_topmost* and windows that enter native-fullscreen mode [#566](https://github.com/koekeishiya/yabai/issues/566) - Properly set focused window id cache upon window detection at first space activation [#567](https://github.com/koekeishiya/yabai/issues/567) -- Blacklist Übersicht process from being monitored and managed [#535](https://github.com/koekeishiya/yabai/issues/535) +- Don't modify the properties of AXUnknown and AXPopover windows [#535](https://github.com/koekeishiya/yabai/issues/535) ## [3.1.2] - 2020-06-09 ### Changed diff --git a/src/event.c b/src/event.c index fb8a31bf..94d23f83 100644 --- a/src/event.c +++ b/src/event.c @@ -333,49 +333,8 @@ static EVENT_CALLBACK(EVENT_HANDLER_WINDOW_CREATED) struct application *application = window_manager_find_application(&g_window_manager, window_pid); if (!application) return EVENT_FAILURE; - struct window *window = window_create(application, CFRetain(context), window_id); - if (window_is_popover(window) || window_is_unknown(window)) { - debug("%s: ignoring window %s %d\n", __FUNCTION__, window->application->name, window->id); - window_manager_make_floating(&g_window_manager, window, true); - window_manager_remove_lost_focused_event(&g_window_manager, window->id); - window_destroy(window); - return EVENT_FAILURE; - } - - window_manager_set_window_opacity(&g_window_manager, window, g_window_manager.normal_window_opacity); - window_manager_purify_window(&g_window_manager, window); - - if (!window_observe(window)) { - debug("%s: could not observe %s %d\n", __FUNCTION__, window->application->name, window->id); - window_manager_make_floating(&g_window_manager, window, true); - window_manager_remove_lost_focused_event(&g_window_manager, window->id); - window_unobserve(window); - window_destroy(window); - return EVENT_FAILURE; - } - - if (window_manager_find_lost_focused_event(&g_window_manager, window->id)) { - struct event *event = event_create(&g_event_loop, WINDOW_FOCUSED, (void *)(intptr_t) window->id); - event_loop_post(&g_event_loop, event); - window_manager_remove_lost_focused_event(&g_window_manager, window->id); - } - - debug("%s: %s %d\n", __FUNCTION__, window->application->name, window->id); - window_manager_add_window(&g_window_manager, window); - window_manager_apply_rules_to_window(&g_space_manager, &g_window_manager, window); - - if ((!application->is_hidden) && (!window->is_minimized) && (!window->is_fullscreen) && (!window->rule_manage)) { - if (window->rule_fullscreen) { - window->rule_fullscreen = false; - } else if ((!window_level_is_standard(window)) || - (!window_is_standard(window)) || - (!window_can_move(window)) || - (window_is_sticky(window)) || - (!window_can_resize(window) && window_is_undersized(window))) { - window_manager_make_floating(&g_window_manager, window, true); - window->is_floating = true; - } - } + struct window *window = window_manager_create_and_add_window(&g_space_manager, &g_window_manager, application, CFRetain(context), window_id); + if (!window) return EVENT_FAILURE; if (window_manager_should_manage_window(window) && !window_manager_find_managed_window(&g_window_manager, window)) { struct view *view = space_manager_tile_window_on_space(&g_space_manager, window, g_space_manager.current_space_id); diff --git a/src/process_manager.c b/src/process_manager.c index 30a35b91..dfb13801 100644 --- a/src/process_manager.c +++ b/src/process_manager.c @@ -68,11 +68,6 @@ static bool process_is_observable(struct process *process) return false; } - if (string_equals(process->name, "Übersicht")) { - debug("%s: %s (%d) is blacklisted! ignoring..\n", __FUNCTION__, process->name, process->pid); - return false; - } - return true; } diff --git a/src/window_manager.c b/src/window_manager.c index 0450f3e5..ce3560da 100644 --- a/src/window_manager.c +++ b/src/window_manager.c @@ -1,5 +1,6 @@ #include "window_manager.h" +extern struct event_loop g_event_loop; extern struct process_manager g_process_manager; extern struct mouse_state g_mouse_state; extern char g_sa_socket_file[MAXLEN]; @@ -1038,6 +1039,62 @@ struct window **window_manager_find_application_windows(struct window_manager *w return result; } +struct window *window_manager_create_and_add_window(struct space_manager *sm, struct window_manager *wm, struct application *application, AXUIElementRef window_ref, uint32_t window_id) +{ + struct window *window = window_create(application, window_ref, window_id); + + if (window_is_unknown(window)) { + debug("%s: ignoring AXUnknown window %s %d\n", __FUNCTION__, window->application->name, window->id); + window_manager_remove_lost_focused_event(wm, window->id); + window_destroy(window); + return NULL; + } + + if (window_is_popover(window)) { + debug("%s: ignoring AXPopover window %s %d\n", __FUNCTION__, window->application->name, window->id); + window_manager_remove_lost_focused_event(wm, window->id); + window_destroy(window); + return NULL; + } + + window_manager_purify_window(wm, window); + window_manager_set_window_opacity(wm, window, wm->normal_window_opacity); + + if (!window_observe(window)) { + debug("%s: could not observe %s %d\n", __FUNCTION__, window->application->name, window->id); + window_manager_make_floating(wm, window, true); + window_manager_remove_lost_focused_event(wm, window->id); + window_unobserve(window); + window_destroy(window); + return NULL; + } + + if (window_manager_find_lost_focused_event(wm, window->id)) { + struct event *event = event_create(&g_event_loop, WINDOW_FOCUSED, (void *)(intptr_t) window->id); + event_loop_post(&g_event_loop, event); + window_manager_remove_lost_focused_event(wm, window->id); + } + + debug("%s: %s %d\n", __FUNCTION__, window->application->name, window->id); + window_manager_add_window(wm, window); + window_manager_apply_rules_to_window(sm, wm, window); + + if ((!application->is_hidden) && (!window->is_minimized) && (!window->is_fullscreen) && (!window->rule_manage)) { + if (window->rule_fullscreen) { + window->rule_fullscreen = false; + } else if ((!window_level_is_standard(window)) || + (!window_is_standard(window)) || + (!window_can_move(window)) || + (window_is_sticky(window)) || + (!window_can_resize(window) && window_is_undersized(window))) { + window_manager_make_floating(wm, window, true); + window->is_floating = true; + } + } + + return window; +} + void window_manager_add_application_windows(struct space_manager *sm, struct window_manager *wm, struct application *application) { CFArrayRef window_list_ref = application_window_list(application); @@ -1048,42 +1105,7 @@ void window_manager_add_application_windows(struct space_manager *sm, struct win AXUIElementRef window_ref = CFArrayGetValueAtIndex(window_list_ref, i); uint32_t window_id = ax_window_id(window_ref); if (!window_id || window_manager_find_window(wm, window_id)) continue; - - struct window *window = window_create(application, CFRetain(window_ref), window_id); - if (window_is_popover(window) || window_is_unknown(window)) { - debug("%s: ignoring window %s %d\n", __FUNCTION__, window->application->name, window->id); - window_manager_make_floating(wm, window, true); - window_destroy(window); - continue; - } - - window_manager_set_window_opacity(wm, window, wm->normal_window_opacity); - window_manager_purify_window(wm, window); - - if (!window_observe(window)) { - debug("%s: could not observe %s %d\n", __FUNCTION__, window->application->name, window->id); - window_manager_make_floating(wm, window, true); - window_unobserve(window); - window_destroy(window); - continue; - } - - debug("%s: %s %d\n", __FUNCTION__, window->application->name, window->id); - window_manager_add_window(wm, window); - window_manager_apply_rules_to_window(sm, wm, window); - - if ((!application->is_hidden) && (!window->is_minimized) && (!window->is_fullscreen) && (!window->rule_manage)) { - if (window->rule_fullscreen) { - window->rule_fullscreen = false; - } else if ((!window_level_is_standard(window)) || - (!window_is_standard(window)) || - (!window_can_move(window)) || - (window_is_sticky(window)) || - (!window_can_resize(window) && window_is_undersized(window))) { - window_manager_make_floating(wm, window, true); - window->is_floating = true; - } - } + window_manager_create_and_add_window(sm, wm, application, CFRetain(window_ref), window_id); } CFRelease(window_list_ref); diff --git a/src/window_manager.h b/src/window_manager.h index 90d13607..aa033573 100644 --- a/src/window_manager.h +++ b/src/window_manager.h @@ -158,6 +158,7 @@ enum window_op_error window_manager_minimize_window(struct window *window); enum window_op_error window_manager_deminimize_window(struct window *window); bool window_manager_close_window(struct window *window); void window_manager_send_window_to_space(struct space_manager *sm, struct window_manager *wm, struct window *window, uint64_t sid, bool moved_by_rule); +struct window *window_manager_create_and_add_window(struct space_manager *sm, struct window_manager *wm, struct application *application, AXUIElementRef window_ref, uint32_t window_id); void window_manager_add_application_windows(struct space_manager *sm, struct window_manager *wm, struct application *application); enum window_op_error window_manager_apply_grid(struct space_manager *sm, struct window_manager *wm, struct window *window, unsigned r, unsigned c, unsigned x, unsigned y, unsigned w, unsigned h); void window_manager_purify_window(struct window_manager *wm, struct window *window);