Skip to content

Commit

Permalink
#162 ignore windows that report a main role of AXPopover
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Jul 28, 2019
1 parent caf5db7 commit 633077b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Resolve a potential multi-threaded issue due to "undefined behaviour" regarding x86 instruction ordering [#153](https://github.com/koekeishiya/yabai/issues/153)
- Fix space padding and gap underflow when modified with a relative value [#141](https://github.com/koekeishiya/yabai/issues/141)
- window_* signals no longer pass the application pid [#154](https://github.com/koekeishiya/yabai/issues/154)
- ignore all windows that report a main role of AXPopover [#162](https://github.com/koekeishiya/yabai/issues/162)

## [1.1.2] - 2019-07-15
### Changed
Expand Down
9 changes: 9 additions & 0 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,15 @@ static EVENT_CALLBACK(EVENT_HANDLER_WINDOW_CREATED)
if (!application) return EVENT_FAILURE;

struct window *window = window_create(application, CFRetain(context), window_id);
if (window_is_popover(window)) {
debug("%s: ignoring popover window %s %d\n", __FUNCTION__, window->application->name, window->id);
window_manager_make_children_floating(&g_window_manager, window, true);
window_manager_make_floating(&g_window_manager, window->id, true);
window_manager_remove_lost_focused_event(&g_window_manager, window->id);
window_destroy(window);
return EVENT_FAILURE;
}

window_manager_apply_rules_to_window(&g_space_manager, &g_window_manager, window);
window_manager_set_window_opacity(&g_window_manager, window, g_window_manager.normal_window_opacity);
window_manager_purify_window(&g_window_manager, window);
Expand Down
11 changes: 11 additions & 0 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,17 @@ bool window_is_dialog(struct window *window)
return standard_win;
}

bool window_is_popover(struct window *window)
{
CFStringRef role = window_role(window);
if (!role) return false;

bool result = CFEqual(role, kAXPopoverRole);
CFRelease(role);

return result;
}

struct window *window_create(struct application *application, AXUIElementRef window_ref, uint32_t window_id)
{
struct window *window = malloc(sizeof(struct window));
Expand Down
1 change: 1 addition & 0 deletions src/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ bool window_is_fullscreen(struct window *window);
bool window_is_sticky(struct window *window);
bool window_is_standard(struct window *window);
bool window_is_dialog(struct window *window);
bool window_is_popover(struct window *window);
bool window_observe(struct window *window);
void window_unobserve(struct window *window);
struct window *window_create(struct application *application, AXUIElementRef window_ref, uint32_t window_id);
Expand Down
8 changes: 8 additions & 0 deletions src/window_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,14 @@ void window_manager_add_application_windows(struct space_manager *sm, struct win
continue;
}

if (window_is_popover(window)) {
debug("%s: ignoring popover window %s %d\n", __FUNCTION__, window->application->name, window->id);
window_manager_make_children_floating(wm, window, true);
window_manager_make_floating(wm, window->id, true);
window_destroy(window);
continue;
}

window_manager_apply_rules_to_window(sm, wm, window);
window_manager_set_window_opacity(wm, window, wm->normal_window_opacity);
window_manager_purify_window(wm, window);
Expand Down

0 comments on commit 633077b

Please sign in to comment.