[mutter/wip/carlosg/x11-selection-allow-clear: 2/3] x11: Generalize x11 selection owner checks



commit 36dd0fbdeaf93ded4487864b610400f36ce990b1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Apr 20 16:47:49 2020 +0200

    x11: Generalize x11 selection owner checks
    
    Shuffle things so the x11 selection can check the current owner directly,
    instead of its type.

 src/x11/meta-x11-selection.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/x11/meta-x11-selection.c b/src/x11/meta-x11-selection.c
index b2d524f35..4f628d1f7 100644
--- a/src/x11/meta-x11-selection.c
+++ b/src/x11/meta-x11-selection.c
@@ -297,8 +297,8 @@ source_new_cb (GObject      *object,
   source = meta_selection_source_x11_new_finish (res, &error);
   if (source)
     {
-      meta_selection_set_owner (selection, selection_type, source);
       g_set_object (&x11_display->selection.owners[selection_type], source);
+      meta_selection_set_owner (selection, selection_type, source);
       g_object_unref (source);
     }
   else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -382,7 +382,7 @@ notify_selection_owner (MetaX11Display      *x11_display,
 {
   Display *xdisplay = x11_display->xdisplay;
 
-  if (new_owner && !META_IS_SELECTION_SOURCE_X11 (new_owner))
+  if (new_owner && new_owner != x11_display->selection.owners[selection_type])
     {
       if (x11_display->selection.cancellables[selection_type])
         {


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