Activate new views

master
emersion 7 years ago
parent e66e18f4de
commit 518ef46ef2
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -132,4 +132,7 @@ void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view, uint32_t edges);
void set_view_focus(struct roots_input *input, struct roots_desktop *desktop,
struct roots_view *view);
#endif

@ -83,5 +83,6 @@ void view_activate(struct roots_view *view, bool active);
void view_resize(struct roots_view *view, uint32_t width, uint32_t height);
void view_close(struct roots_view *view);
bool view_center(struct roots_view *view);
bool view_initialize(struct roots_view *view);
#endif

@ -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;
}
}

@ -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;

@ -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);
}
}

@ -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);
}
}

Loading…
Cancel
Save