mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 00:50:42 -05:00
wayland: Preserve the event mask on the root window
A window manager must select the SubstructureRedirect mask on the root window to receive the MapRequest from the X11 clients and manage the windows. Without this event mask set, a window manager won't be able to map any new window. The Wayland selection code in mutter can change/clear the event mask on the requestor window from a XSelectionRequest event when the window is not managed by mutter/gnome-shell. A rogue or simply buggy X11 client may send a XConvertSelection() on the root window and mutter will happily change/clear its own event mask on the root window, effectively turning itself into a regular X11 client unable to map any new X11 window from the other X11 clients. To avoid this, simply check that the requestor window is not the root window prior to change/clear the event mask on that window. https://bugzilla.gnome.org/show_bug.cgi?id=776128
This commit is contained in:
parent
d9fc81e702
commit
06f5b6b3e3
@ -546,6 +546,8 @@ static WaylandSelectionData *
|
|||||||
wayland_selection_data_new (XSelectionRequestEvent *request_event,
|
wayland_selection_data_new (XSelectionRequestEvent *request_event,
|
||||||
MetaWaylandCompositor *compositor)
|
MetaWaylandCompositor *compositor)
|
||||||
{
|
{
|
||||||
|
MetaDisplay *display = meta_get_display ();
|
||||||
|
MetaScreen *screen = display->screen;
|
||||||
MetaWaylandDataDevice *data_device;
|
MetaWaylandDataDevice *data_device;
|
||||||
MetaWaylandDataSource *wayland_source;
|
MetaWaylandDataSource *wayland_source;
|
||||||
MetaSelectionBridge *selection;
|
MetaSelectionBridge *selection;
|
||||||
@ -595,7 +597,8 @@ wayland_selection_data_new (XSelectionRequestEvent *request_event,
|
|||||||
data->window = meta_display_lookup_x_window (meta_get_display (),
|
data->window = meta_display_lookup_x_window (meta_get_display (),
|
||||||
data->request_event.requestor);
|
data->request_event.requestor);
|
||||||
|
|
||||||
if (!data->window)
|
/* Do *not* change the event mask on the root window, bugger! */
|
||||||
|
if (!data->window && data->request_event.requestor != screen->xroot)
|
||||||
{
|
{
|
||||||
/* Not a managed window, set the PropertyChangeMask
|
/* Not a managed window, set the PropertyChangeMask
|
||||||
* for INCR deletion notifications.
|
* for INCR deletion notifications.
|
||||||
@ -628,11 +631,13 @@ reply_selection_request (XSelectionRequestEvent *request_event,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
wayland_selection_data_free (WaylandSelectionData *data)
|
wayland_selection_data_free (WaylandSelectionData *data)
|
||||||
{
|
|
||||||
if (!data->window)
|
|
||||||
{
|
{
|
||||||
MetaDisplay *display = meta_get_display ();
|
MetaDisplay *display = meta_get_display ();
|
||||||
|
MetaScreen *screen = display->screen;
|
||||||
|
|
||||||
|
/* Do *not* change the event mask on the root window, bugger! */
|
||||||
|
if (!data->window && data->request_event.requestor != screen->xroot)
|
||||||
|
{
|
||||||
meta_error_trap_push (display);
|
meta_error_trap_push (display);
|
||||||
XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
||||||
data->request_event.requestor, NoEventMask);
|
data->request_event.requestor, NoEventMask);
|
||||||
|
Loading…
Reference in New Issue
Block a user