diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-10-05 14:38:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-05 14:38:49 -0400 |
commit | e5276e9d703b992393332431925041b7fc55b44b (patch) | |
tree | 1bd0a29d823fe2f634b7c2908d02915baf3a65e7 | |
parent | d74a6d254fd1934ca6ca9439b66ea65e6b389822 (diff) | |
parent | 1b1346462e90b9e4e2be592feba000d616224317 (diff) |
Merge pull request #209 from versusvoid/fix-null-view-focus
Fix focusing null view
-rw-r--r-- | rootston/cursor.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c index aad6751e..eec8eb5d 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -128,6 +128,12 @@ static void set_view_focus(struct roots_input *input, if (input->active_view == view) { return; } + input->active_view = view; + input->mode = ROOTS_CURSOR_PASSTHROUGH; + if (!view) { + return; + } + size_t index = 0; for (size_t i = 0; i < desktop->views->length; ++i) { struct roots_view *_view = desktop->views->items[i]; @@ -136,8 +142,6 @@ static void set_view_focus(struct roots_input *input, index = i; } } - input->active_view = view; - input->mode = ROOTS_CURSOR_PASSTHROUGH; // TODO: list_swap list_del(desktop->views, index); list_add(desktop->views, view); @@ -219,8 +223,7 @@ static void do_cursor_button_press(struct roots_input *input, int i; switch (state) { case WLR_BUTTON_RELEASED: - input->active_view = NULL; - input->mode = ROOTS_CURSOR_PASSTHROUGH; + set_view_focus(input, desktop, NULL); break; case WLR_BUTTON_PRESSED: i = input->input_events_idx; |