[gnome-shell] st: Ignore filtered selection events not meant to our clipboard window



commit a22e9ce9cde93742320c015fc20af46b6f547b1b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 7 23:46:27 2016 +0200

    st: Ignore filtered selection events not meant to our clipboard window
    
    Other windows like the mutter Xwayland selection bridges might deal with
    the clipboard, which would result in events visible on st-clipboard event
    filters.
    
    In order to avoid unintended results, ignore events that are not meant for
    the clipboard window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760745

 src/st/st-clipboard.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/st/st-clipboard.c b/src/st/st-clipboard.c
index 556721d..d5b1395 100644
--- a/src/st/st-clipboard.c
+++ b/src/st/st-clipboard.c
@@ -117,6 +117,7 @@ st_clipboard_provider (GdkXEvent *xevent_p,
   GdkDisplay *display = gdk_display_get_default ();
 
   if (xev->type != SelectionRequest ||
+      xev->xany.window != clipboard->priv->clipboard_window ||
       !clipboard->priv->clipboard_text)
     return GDK_FILTER_CONTINUE;
 
@@ -233,13 +234,15 @@ st_clipboard_x11_event_filter (GdkXEvent *xevent_p,
 {
   XEvent *xev = (XEvent *) xevent_p;
   EventFilterData *filter_data = user_data;
+  StClipboardPrivate *priv = filter_data->clipboard->priv;
   Atom actual_type;
   int actual_format, result;
   unsigned long nitems, bytes_after;
   unsigned char *data = NULL;
   GdkDisplay *display = gdk_display_get_default ();
 
-  if(xev->type != SelectionNotify)
+  if(xev->type != SelectionNotify ||
+     xev->xany.window != priv->clipboard_window)
     return GDK_FILTER_CONTINUE;
 
   if (xev->xselection.property == None)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]