cage: center cursor only on initial startup

With Cage now supporting hotplugging of outputs, we shouldn't warp the
cursor to the center of every new output. Rather, we should warp it only
on the initial startup.
This commit is contained in:
Jente Hidskes 2020-01-18 11:57:16 +01:00
parent e3f9959519
commit cc1f975c44
No known key found for this signature in database
GPG key ID: 04BE5A29F32D91EA
2 changed files with 6 additions and 4 deletions

4
cage.c
View file

@ -397,6 +397,10 @@ main(int argc, char *argv[])
goto end;
}
/* Place the cursor in the center of the output layout. */
struct wlr_box *layout_box = wlr_output_layout_get_box(server.output_layout, NULL);
wlr_cursor_warp(server.seat->cursor, NULL, layout_box->width / 2, layout_box->height / 2);
wl_display_run(server.wl_display);
#if CAGE_HAS_XWAYLAND

View file

@ -365,12 +365,10 @@ handle_new_output(struct wl_listener *listener, void *data)
wlr_output->scale);
}
/* Place the cursor in the center of the screen. */
wlr_cursor_warp(server->seat->cursor, NULL, wlr_output->width / 2, wlr_output->height / 2);
wlr_output_damage_add_whole(output->damage);
wlr_output_enable(wlr_output, true);
wlr_output_commit(wlr_output);
wlr_output_damage_add_whole(output->damage);
}
void