struct wlr_box grab_box;
uint32_t resize_edges;
- /* SSD state */
/*
* Currently focused view. Updated with each "focus change"
* event. This view is drawn with "active" SSD coloring.
*/
struct view *focused_view;
+ /*
+ * Most recently raised view. Used to avoid unnecessarily
+ * raising the same view over and over.
+ */
+ struct view *last_raised_view;
+
struct ssd_hover_state *ssd_hover_state;
/* Tree for all non-layer xdg/xwayland-shell surfaces */
void
view_impl_unmap(struct view *view)
{
- struct seat *seat = &view->server->seat;
- if (seat->seat->keyboard_state.focused_surface == view->surface) {
- desktop_focus_topmost_view(view->server);
+ struct server *server = view->server;
+ if (view == server->focused_view) {
+ desktop_focus_topmost_view(server);
+ }
+ if (view == server->last_raised_view) {
+ server->last_raised_view = NULL;
}
}
if (view->impl->move_to_front) {
view->impl->move_to_front(view);
}
+ view->server->last_raised_view = view;
}
static void
if (view->impl->move_to_back) {
view->impl->move_to_back(view);
}
+ if (view == view->server->last_raised_view) {
+ view->server->last_raised_view = NULL;
+ }
}
/*
view_move_to_front(struct view *view)
{
assert(view);
+ /*
+ * This function is called often, generally on every mouse
+ * button press (more often for focus-follows-mouse). Avoid
+ * unnecessarily raising the same view over and over, or
+ * attempting to raise a root view above its own sub-view.
+ */
+ struct view *last = view->server->last_raised_view;
+ if (view == last || (last && view == view_get_root(last))) {
+ return;
+ }
+
struct view *root = view_get_root(view);
assert(root);
need_cursor_update = true;
}
+ if (server->last_raised_view == view) {
+ server->last_raised_view = NULL;
+ }
+
if (server->seat.pressed.view == view) {
seat_reset_pressed(&server->seat);
}