mirror of
https://github.com/labwc/labwc.git
synced 2026-03-20 05:34:12 -04:00
xwayland: validate PID before activating unmanaged surface
Check that an unmanaged surface trying to grab focus is actually a child of the topmost mapped view.
This commit is contained in:
parent
64d62a91b6
commit
5744bba849
3 changed files with 18 additions and 3 deletions
|
|
@ -374,6 +374,7 @@ void foreign_toplevel_update_outputs(struct view *view);
|
||||||
void desktop_focus_and_activate_view(struct seat *seat, struct view *view);
|
void desktop_focus_and_activate_view(struct seat *seat, struct view *view);
|
||||||
void desktop_arrange_all_views(struct server *server);
|
void desktop_arrange_all_views(struct server *server);
|
||||||
void desktop_focus_output(struct output *output);
|
void desktop_focus_output(struct output *output);
|
||||||
|
struct view *desktop_topmost_mapped_view(struct server *server);
|
||||||
|
|
||||||
enum lab_cycle_dir {
|
enum lab_cycle_dir {
|
||||||
LAB_CYCLE_DIR_NONE,
|
LAB_CYCLE_DIR_NONE,
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,8 @@ desktop_cycle_view(struct server *server, struct view *start_view,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct view *
|
struct view *
|
||||||
topmost_mapped_view(struct server *server)
|
desktop_topmost_mapped_view(struct server *server)
|
||||||
{
|
{
|
||||||
struct view *view;
|
struct view *view;
|
||||||
struct wl_list *node_list;
|
struct wl_list *node_list;
|
||||||
|
|
@ -242,7 +242,7 @@ desktop_focused_view(struct server *server)
|
||||||
void
|
void
|
||||||
desktop_focus_topmost_mapped_view(struct server *server)
|
desktop_focus_topmost_mapped_view(struct server *server)
|
||||||
{
|
{
|
||||||
struct view *view = topmost_mapped_view(server);
|
struct view *view = desktop_topmost_mapped_view(server);
|
||||||
desktop_focus_and_activate_view(&server->seat, view);
|
desktop_focus_and_activate_view(&server->seat, view);
|
||||||
if (view) {
|
if (view) {
|
||||||
view_move_to_front(view);
|
view_move_to_front(view);
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,20 @@ unmanaged_handle_request_activate(struct wl_listener *listener, void *data)
|
||||||
struct xwayland_unmanaged *unmanaged = xsurface->data;
|
struct xwayland_unmanaged *unmanaged = xsurface->data;
|
||||||
struct server *server = unmanaged->server;
|
struct server *server = unmanaged->server;
|
||||||
struct seat *seat = &server->seat;
|
struct seat *seat = &server->seat;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validate that the unmanaged surface trying to grab focus is actually
|
||||||
|
* a child of the topmost mapped view before granting the request.
|
||||||
|
*/
|
||||||
|
struct view *view = desktop_topmost_mapped_view(server);
|
||||||
|
if (view && view->type == LAB_XWAYLAND_VIEW) {
|
||||||
|
struct wlr_xwayland_surface *surf =
|
||||||
|
wlr_xwayland_surface_from_wlr_surface(view->surface);
|
||||||
|
if (surf && surf->pid != xsurface->pid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
seat_focus_surface(seat, xsurface->surface);
|
seat_focus_surface(seat, xsurface->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue