|
|
|
@ -82,16 +82,21 @@ static void handle_output_focused(wlc_handle output, bool focus) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool handle_view_created(wlc_handle handle) {
|
|
|
|
|
swayc_t *container = get_focused_container(&root_container);
|
|
|
|
|
swayc_t *view = new_view(container, handle);
|
|
|
|
|
unfocus_all(&root_container);
|
|
|
|
|
swayc_t *focused = get_focused_container(&root_container);
|
|
|
|
|
swayc_t *view = new_view(focused, handle);
|
|
|
|
|
if (view) {
|
|
|
|
|
unfocus_all(&root_container);
|
|
|
|
|
focus_view(view);
|
|
|
|
|
arrange_windows(view->parent, -1, -1);
|
|
|
|
|
} else { //Unmanaged view
|
|
|
|
|
wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true);
|
|
|
|
|
wlc_view_focus(handle);
|
|
|
|
|
}
|
|
|
|
|
if (wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) {
|
|
|
|
|
unfocus_all(&root_container);
|
|
|
|
|
focus_view(focused);
|
|
|
|
|
arrange_windows(focused, -1, -1);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -189,21 +194,24 @@ static bool handle_pointer_motion(wlc_handle view, uint32_t time, const struct w
|
|
|
|
|
if (!config->focus_follows_mouse) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
swayc_t *c = find_container(&root_container, pointer_test, (void *)origin);
|
|
|
|
|
swayc_t *focused = get_focused_container(&root_container);
|
|
|
|
|
if (!(wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN)) {
|
|
|
|
|
swayc_t *c = find_container(&root_container, pointer_test, (void *)origin);
|
|
|
|
|
if (c && c != focused) {
|
|
|
|
|
sway_log(L_DEBUG, "Switching focus to %p", c);
|
|
|
|
|
unfocus_all(&root_container);
|
|
|
|
|
focus_view(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers,
|
|
|
|
|
uint32_t button, enum wlc_button_state state) {
|
|
|
|
|
if (state == WLC_BUTTON_STATE_PRESSED) {
|
|
|
|
|
swayc_t *c = find_container(&root_container, pointer_test, &mouse_origin);
|
|
|
|
|
swayc_t *focused = get_focused_container(&root_container);
|
|
|
|
|
if (state == WLC_BUTTON_STATE_PRESSED
|
|
|
|
|
&& !(wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN)) {
|
|
|
|
|
swayc_t *c = find_container(&root_container, pointer_test, &mouse_origin);
|
|
|
|
|
if (c && c != focused) {
|
|
|
|
|
sway_log(L_DEBUG, "Switching focus to %p", c);
|
|
|
|
|
unfocus_all(&root_container);
|
|
|
|
|