rootston: focus newly-created surfaces

Whenever a new surface is created, we have to update the cursor focus,
even if there's no input event. So, we generate one motion event, and
reuse the code to update the proper cursor focus. We need to do this
for all surface roles - toplevels, popups, subsurfaces.

Fixes #1162
This commit is contained in:
Ilia Bozhinov 2018-07-29 20:02:00 +03:00
parent f1b65b34a6
commit 2e6eb097b6
8 changed files with 37 additions and 11 deletions

View file

@ -291,7 +291,10 @@ static void handle_map(struct wl_listener *listener, void *data) {
static void handle_unmap(struct wl_listener *listener, void *data) {
struct roots_layer_surface *layer = wl_container_of(
listener, layer, unmap);
struct wlr_output *wlr_output = layer->layer_surface->output;
struct roots_output *output = wlr_output->data;
unmap(layer->layer_surface);
input_update_cursor_focus(output->desktop->server->input);
}
static void popup_handle_map(struct wl_listener *listener, void *data) {
@ -303,6 +306,7 @@ static void popup_handle_map(struct wl_listener *listener, void *data) {
int oy = popup->wlr_popup->geometry.y + layer->geo.y;
output_damage_whole_local_surface(output, popup->wlr_popup->base->surface,
ox, oy, 0);
input_update_cursor_focus(output->desktop->server->input);
}
static void popup_handle_unmap(struct wl_listener *listener, void *data) {