multiseat: somewhat working

This commit is contained in:
Tony Crisci 2017-11-07 15:56:11 -05:00
parent 2280928bb2
commit 09c6092423
18 changed files with 521 additions and 219 deletions

View file

@ -14,15 +14,19 @@
#include <wlr/util/log.h>
#include <server-decoration-protocol.h>
#include "rootston/server.h"
#include "rootston/server.h"
#include "rootston/seat.h"
// TODO replace me with a signal
void view_destroy(struct roots_view *view) {
struct roots_desktop *desktop = view->desktop;
struct roots_input *input = desktop->server->input;
if (input->active_view == view) {
input->active_view = NULL;
input->mode = ROOTS_CURSOR_PASSTHROUGH;
struct roots_seat *seat;
wl_list_for_each(seat, &input->seats, link) {
if (seat->focus == view) {
seat->focus = NULL;
seat->cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
}
}
for (size_t i = 0; i < desktop->views->length; ++i) {
@ -89,15 +93,9 @@ bool view_center(struct roots_view *view) {
view_get_size(view, &size);
struct roots_desktop *desktop = view->desktop;
struct wlr_cursor *cursor = desktop->server->input->cursor;
struct wlr_output *output =
wlr_output_layout_output_at(desktop->layout, cursor->x, cursor->y);
if (!output) {
output = wlr_output_layout_get_center_output(desktop->layout);
}
wlr_output_layout_get_center_output(desktop->layout);
if (!output) {
// empty layout
return false;
@ -121,19 +119,15 @@ void view_setup(struct roots_view *view) {
view_center(view);
struct roots_input *input = view->desktop->server->input;
set_view_focus(input, view->desktop, view);
// TODO what seat gets focus? the one with the last input event?
struct roots_seat *seat;
wl_list_for_each(seat, &input->seats, link) {
roots_seat_focus_view(seat, view);
}
}
void view_teardown(struct roots_view *view) {
struct wlr_list *views = view->desktop->views;
if (views->length < 2 || views->items[views->length-1] != view) {
return;
}
struct roots_view *prev_view = views->items[views->length-2];
struct roots_input *input = prev_view->desktop->server->input;
set_view_focus(input, prev_view->desktop, prev_view);
wlr_seat_keyboard_notify_enter(input->wl_seat, prev_view->wlr_surface);
// TODO replace me with a signal
}
struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,