diff options
author | emersion <contact@emersion.fr> | 2017-10-08 18:19:05 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-10-08 18:19:05 +0200 |
commit | 518ef46ef2c15bdfd2a1e0274fe2bf628639a310 (patch) | |
tree | 8db05bf590f1e459b7879a4d57a5da8ef631fb54 /rootston | |
parent | e66e18f4de6996a5c8d923668834096b61b60110 (diff) |
Activate new views
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/cursor.c | 7 | ||||
-rw-r--r-- | rootston/desktop.c | 10 | ||||
-rw-r--r-- | rootston/wl_shell.c | 5 | ||||
-rw-r--r-- | rootston/xdg_shell_v6.c | 5 |
4 files changed, 15 insertions, 12 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c index 8eb22459..605920cc 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -123,8 +123,8 @@ void cursor_update_position(struct roots_input *input, uint32_t time) { } } -static void set_view_focus(struct roots_input *input, - struct roots_desktop *desktop, struct roots_view *view) { +void set_view_focus(struct roots_input *input, struct roots_desktop *desktop, + struct roots_view *view) { if (input->active_view == view) { return; } @@ -140,8 +140,7 @@ static void set_view_focus(struct roots_input *input, struct roots_view *_view = desktop->views->items[i]; if (_view != view) { view_activate(_view, false); - } - if (view == _view) { + } else { index = i; } } diff --git a/rootston/desktop.c b/rootston/desktop.c index ee813130..75030ad2 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -103,6 +103,16 @@ bool view_center(struct roots_view *view) { return true; } +bool view_initialize(struct roots_view *view) { + bool centered = view_center(view); + if (centered) { + struct roots_input *input = view->desktop->server->input; + set_view_focus(input, view->desktop, view); + wlr_seat_keyboard_notify_enter(input->wl_seat, view->wlr_surface); + } + return centered; +} + static struct wlr_subsurface *subsurface_at(struct wlr_surface *surface, double sx, double sy, double *sub_x, double *sub_y) { struct wlr_subsurface *subsurface; diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c index 81c41f76..eb977367 100644 --- a/rootston/wl_shell.c +++ b/rootston/wl_shell.c @@ -56,10 +56,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { if (view->wl_shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL && !roots_surface->initialized) { - bool centered = view_center(view); - if (centered) { - roots_surface->initialized = true; - } + roots_surface->initialized = view_initialize(view); } } diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 2471b3ee..44acab4e 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -73,10 +73,7 @@ static void handle_commit(struct wl_listener *listener, void *data) { struct roots_view *view = roots_xdg_surface->view; if (!roots_xdg_surface->initialized) { - bool centered = view_center(view); - if (centered) { - roots_xdg_surface->initialized = true; - } + roots_xdg_surface->initialized = view_initialize(view); } } |