aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-08-09 12:06:46 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-08-09 12:06:46 -0400
commitbab080cea3d28dad387760d93db55cc711980d9a (patch)
tree38ff188dbe199c4e45af3b6bb4c95ff6c768e466
parentImplement focus_follows_mouse (diff)
downloadsway-bab080cea3d28dad387760d93db55cc711980d9a.tar.gz
sway-bab080cea3d28dad387760d93db55cc711980d9a.tar.zst
sway-bab080cea3d28dad387760d93db55cc711980d9a.zip
Fix up some issues with focus
-rw-r--r--sway/handlers.c3
-rw-r--r--sway/layout.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 0c0fb85f..70d044b6 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -39,8 +39,7 @@ void handle_view_destroyed(wlc_handle view) {
39} 39}
40 40
41void handle_view_focus(wlc_handle view, bool focus) { 41void handle_view_focus(wlc_handle view, bool focus) {
42 wlc_view_set_state(view, WLC_BIT_ACTIVATED, focus); 42 return;
43 focus_view(get_swayc_for_handle(view, &root_container));
44} 43}
45 44
46void handle_view_geometry_request(wlc_handle view, const struct wlc_geometry* geometry) { 45void handle_view_geometry_request(wlc_handle view, const struct wlc_geometry* geometry) {
diff --git a/sway/layout.c b/sway/layout.c
index 996be387..68d7cf7e 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -161,7 +161,7 @@ void add_view(wlc_handle view_handle) {
161 view->type = C_VIEW; 161 view->type = C_VIEW;
162 add_child(parent, view); 162 add_child(parent, view);
163 163
164 wlc_view_focus(view_handle); 164 focus_view(view);
165 165
166 arrange_windows(parent, -1, -1); 166 arrange_windows(parent, -1, -1);
167} 167}
@@ -187,6 +187,10 @@ void destroy_view(swayc_t *view) {
187 187
188 free_swayc(view); 188 free_swayc(view);
189 189
190 if (parent->focused == view) {
191 parent->focused = NULL;
192 }
193
190 if (parent->children->length != 0) { 194 if (parent->children->length != 0) {
191 focus_view(parent->children->items[0]); 195 focus_view(parent->children->items[0]);
192 } else { 196 } else {