mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
seat: refactor seat_focus_surface()
This commit is contained in:
parent
50bcfa00f3
commit
e400700a4a
4 changed files with 11 additions and 8 deletions
|
|
@ -235,10 +235,12 @@ struct view *desktop_view_at(struct server *server, double lx, double ly,
|
||||||
double *sy, int *view_area);
|
double *sy, int *view_area);
|
||||||
|
|
||||||
void cursor_init(struct seat *seat);
|
void cursor_init(struct seat *seat);
|
||||||
|
|
||||||
void keyboard_init(struct seat *seat);
|
void keyboard_init(struct seat *seat);
|
||||||
|
|
||||||
void seat_init(struct server *server);
|
void seat_init(struct server *server);
|
||||||
void seat_finish(struct server *server);
|
void seat_finish(struct server *server);
|
||||||
void seat_focus_surface(struct wlr_surface *surface);
|
void seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface);
|
||||||
struct wlr_surface *seat_focused_surface(void);
|
struct wlr_surface *seat_focused_surface(void);
|
||||||
|
|
||||||
void interactive_begin(struct view *view, enum cursor_mode mode,
|
void interactive_begin(struct view *view, enum cursor_mode mode,
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ void
|
||||||
desktop_focus_view(struct view *view)
|
desktop_focus_view(struct view *view)
|
||||||
{
|
{
|
||||||
if (!view) {
|
if (!view) {
|
||||||
seat_focus_surface(NULL);
|
seat_focus_surface(view->server->seat.seat, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (view->minimized) {
|
if (view->minimized) {
|
||||||
|
|
|
||||||
|
|
@ -118,15 +118,14 @@ seat_finish(struct server *server)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
seat_focus_surface(struct wlr_surface *surface)
|
seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface)
|
||||||
{
|
{
|
||||||
struct wlr_seat *wlr_seat = current_seat->seat;
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
wlr_seat_keyboard_notify_clear_focus(wlr_seat);
|
wlr_seat_keyboard_notify_clear_focus(seat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_keyboard *kb = ¤t_seat->keyboard_group->keyboard;
|
struct wlr_keyboard *kb = ¤t_seat->keyboard_group->keyboard;
|
||||||
wlr_seat_keyboard_notify_enter(wlr_seat, surface, kb->keycodes,
|
wlr_seat_keyboard_notify_enter(seat, surface, kb->keycodes,
|
||||||
kb->num_keycodes, &kb->modifiers);
|
kb->num_keycodes, &kb->modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ unmanaged_handle_map(struct wl_listener *listener, void *data)
|
||||||
unmanaged->ly = xsurface->y;
|
unmanaged->ly = xsurface->y;
|
||||||
|
|
||||||
if (wlr_xwayland_or_surface_wants_focus(xsurface)) {
|
if (wlr_xwayland_or_surface_wants_focus(xsurface)) {
|
||||||
seat_focus_surface(xsurface->surface);
|
struct wlr_seat *seat = unmanaged->server->seat.seat;
|
||||||
|
seat_focus_surface(seat, xsurface->surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,7 +60,8 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
|
||||||
if (!wlr_xwayland_or_surface_wants_focus(prev)) {
|
if (!wlr_xwayland_or_surface_wants_focus(prev)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
seat_focus_surface(prev->surface);
|
struct wlr_seat *seat = unmanaged->server->seat.seat;
|
||||||
|
seat_focus_surface(seat, prev->surface);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue