Skip to content

rootston: Update cursors on set focus

Dominique Martinet requested to merge github/fork/martinetd/cursors_focus into master

Setting focus can change the views ordering so all cursors need to be updated to reflect such changes e.g. edges are different.

This is a bigger issue than I thought it'd be. I've just hooked in roots_seat_set_focus and call roots_cursor_update_position at the end for all seats, but that's just shoving the dust under the rug - multiseat and cursor as we do them is difficult. For example what if a seat user moves a window just under another cursor?

As a bonus question, I don't like calling clock_gettime and timespec_to_msec. Technically I think we could get a time from the event most of the time, e.g. for next_window we have the keyboard event that triggered the key binding all the way up the stack, should I bother and bubble it down? The problem with this approach is there are two places calling roots_seat_set_focus without an event->time_msec handy - view_initial_focus and seat_view_destroy, which makes two places calling clock_gettime instead of one...

test plan:

  • Go to edge of a view with another view below and alt-tab, check cursor changes both times
  • Place an edge somewhere in the middle where a new view would pop and check the new view correctly updates cursor when it appears
  • Check fullscreening a view and unfullscreening updates cursor (just noticed it doesn't work right now)
  • Check 2nd seat's cursor gets updated when resizing a window under it
  • . . .but not if the resized view is below another

Fixes #678 (closed).

Merge request reports