Fix up some issues with focus

This commit is contained in:
Drew DeVault 2015-08-09 12:06:46 -04:00
parent f97a48d5b7
commit bab080cea3
2 changed files with 6 additions and 3 deletions

View file

@ -39,8 +39,7 @@ void handle_view_destroyed(wlc_handle view) {
} }
void handle_view_focus(wlc_handle view, bool focus) { void handle_view_focus(wlc_handle view, bool focus) {
wlc_view_set_state(view, WLC_BIT_ACTIVATED, focus); return;
focus_view(get_swayc_for_handle(view, &root_container));
} }
void handle_view_geometry_request(wlc_handle view, const struct wlc_geometry* geometry) { void handle_view_geometry_request(wlc_handle view, const struct wlc_geometry* geometry) {

View file

@ -161,7 +161,7 @@ void add_view(wlc_handle view_handle) {
view->type = C_VIEW; view->type = C_VIEW;
add_child(parent, view); add_child(parent, view);
wlc_view_focus(view_handle); focus_view(view);
arrange_windows(parent, -1, -1); arrange_windows(parent, -1, -1);
} }
@ -187,6 +187,10 @@ void destroy_view(swayc_t *view) {
free_swayc(view); free_swayc(view);
if (parent->focused == view) {
parent->focused = NULL;
}
if (parent->children->length != 0) { if (parent->children->length != 0) {
focus_view(parent->children->items[0]); focus_view(parent->children->items[0]);
} else { } else {