seat: use focus_change event to update focused/active view

- Connect to wlr_seat_keyboard_state's focus_change event.
- Add view_from_wlr_surface(), which does what the name says.
- Use focus_change event along with view_from_wlr_surface() to update
  server->focused_view and set SSD states via view_set_activated().
- Eliminate desktop_focused_view() since server->focused_view should be
  reliably up-to-date now.
- Eliminate view_focus/defocus() since we can now just call
  seat_focus_surface() directly.
This commit is contained in:
John Lindgren 2023-09-27 18:24:35 -04:00 committed by Johan Malm
parent bb5d272dc9
commit 4028a9482f
9 changed files with 77 additions and 100 deletions

View file

@ -186,6 +186,12 @@ enum lab_view_criteria {
LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER = 1 << 2,
};
/**
* view_from_wlr_surface() - returns the view associated with a
* wlr_surface, or NULL if the surface has no associated view.
*/
struct view *view_from_wlr_surface(struct wlr_surface *surface);
/**
* for_each_view() - iterate over all views which match criteria
* @view: Iterator.
@ -257,8 +263,7 @@ bool view_isfocusable(struct view *view);
bool view_inhibits_keybinds(struct view *view);
void view_toggle_keybinds(struct view *view);
void view_focus(struct view *view);
void view_defocus(struct view *view);
void view_set_activated(struct view *view, bool activated);
void view_set_output(struct view *view, struct output *output);
void view_close(struct view *view);