[gtk+] x11: Use gdk_x11_window_foreign_new_for_display() unconditionally



commit c2a5d715d5cded5eeb0f284208d49c9e8773ed1b
Author: Benjamin Otte <otte redhat com>
Date:   Tue Feb 1 16:36:23 2011 +0100

    x11: Use gdk_x11_window_foreign_new_for_display() unconditionally
    
    gdk_x11_window_lookup_window() calls are done by this function alreayd,
    so no need to do them manually.

 gdk/x11/gdkdnd-x11.c |   36 +++++++++---------------------------
 1 files changed, 9 insertions(+), 27 deletions(-)
---
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index ee557c6..665941a 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -1729,17 +1729,11 @@ motif_drag_context_new (GdkWindow *dest_window,
   context->protocol = GDK_DRAG_PROTO_MOTIF;
   context->is_source = FALSE;
 
-  context->source_window = gdk_x11_window_lookup_for_display (display, source_window);
-  if (context->source_window)
-    g_object_ref (context->source_window);
-  else
+  context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
+  if (!context->source_window)
     {
-      context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
-      if (!context->source_window)
-        {
-          g_object_unref (context_x11);
-          return NULL;
-        }
+      g_object_unref (context_x11);
+      return NULL;
     }
 
   context->dest_window = dest_window;
@@ -2899,17 +2893,11 @@ xdnd_enter_filter (GdkXEvent *xev,
   device_manager = gdk_display_get_device_manager (display);
   gdk_drag_context_set_device (context, gdk_device_manager_get_client_pointer (device_manager));
 
-  context->source_window = gdk_x11_window_lookup_for_display (display, source_window);
-  if (context->source_window)
-    g_object_ref (context->source_window);
-  else
+  context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
+  if (!context->source_window)
     {
-      context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
-      if (!context->source_window)
-        {
-          g_object_unref (context);
-          return GDK_FILTER_REMOVE;
-        }
+      g_object_unref (context);
+      return GDK_FILTER_REMOVE;
     }
   context->dest_window = event->any.window;
   g_object_ref (context->dest_window);
@@ -3332,13 +3320,7 @@ gdk_x11_drag_context_find_window (GdkDragContext  *context,
                                                       &context_x11->version);
 
       if (recipient != None)
-        {
-          dest_window = gdk_x11_window_lookup_for_display (display, recipient);
-          if (dest_window)
-            g_object_ref (dest_window);
-          else
-            dest_window = gdk_x11_window_foreign_new_for_display (display, recipient);
-        }
+        dest_window = gdk_x11_window_foreign_new_for_display (display, recipient);
       else
         dest_window = NULL;
     }



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