[mutter] xwayland: Refactor XFixesSelectionNotifyEvent handler



commit b449ba942a5e220c2e6972bf769733b488abf95d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu May 28 12:07:49 2015 +0200

    xwayland: Refactor XFixesSelectionNotifyEvent handler
    
    Prepare it for more selection atoms (i.e. XdndSelection) to come.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738312

 src/wayland/meta-xwayland-selection.c |   52 ++++++++++++++++----------------
 1 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index d7a5e69..a3d68a7 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -765,42 +765,42 @@ meta_xwayland_selection_handle_xfixes_selection_notify (MetaWaylandCompositor *c
   if (!selection)
     return FALSE;
 
-  if (event->owner == None)
+  if (selection->selection_atom == gdk_x11_get_xatom_by_name ("CLIPBOARD"))
     {
-      if (selection->source && selection->owner != selection->window)
+      if (event->owner == None)
         {
-          /* An X client went away, clear the selection */
-          if (selection->selection_atom == gdk_x11_get_xatom_by_name ("CLIPBOARD"))
+          if (selection->source && selection->owner != selection->window)
             {
+              /* An X client went away, clear the selection */
               meta_wayland_data_device_set_selection (&compositor->seat->data_device, NULL,
                                                       wl_display_next_serial (compositor->wayland_display));
+              selection->source = NULL;
             }
-          selection->source = NULL;
-        }
 
-      selection->owner = None;
-    }
-  else
-    {
-      selection->owner = event->owner;
-
-      if (selection->owner == selection->window)
-        {
-          /* This our own selection window */
-          selection->timestamp = event->timestamp;
-          return TRUE;
+          selection->owner = None;
         }
+      else
+        {
+          selection->owner = event->owner;
 
-      g_clear_pointer (&selection->x11_selection,
-                       (GDestroyNotify) x11_selection_data_free);
+          if (selection->owner == selection->window)
+            {
+              /* This our own selection window */
+              selection->timestamp = event->timestamp;
+              return TRUE;
+            }
+
+          g_clear_pointer (&selection->x11_selection,
+                           (GDestroyNotify) x11_selection_data_free);
 
-      XConvertSelection (xdisplay,
-                         event->selection,
-                         gdk_x11_get_xatom_by_name ("TARGETS"),
-                         gdk_x11_get_xatom_by_name ("_META_SELECTION"),
-                         selection->window,
-                         selection->timestamp);
-      XFlush (xdisplay);
+          XConvertSelection (xdisplay,
+                             event->selection,
+                             gdk_x11_get_xatom_by_name ("TARGETS"),
+                             gdk_x11_get_xatom_by_name ("_META_SELECTION"),
+                             selection->window,
+                             selection->timestamp);
+          XFlush (xdisplay);
+        }
     }
 
   return TRUE;


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