[gtk+] wayland: Clean up function to find the input seat



commit f6b3f0bfc791e117b60b2c8407ea38ff4d887407
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu May 15 17:14:26 2014 -0400

    wayland: Clean up function to find the input seat

 gdk/wayland/gdkwindow-wayland.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index aaab00a..9d04aec 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -993,7 +993,6 @@ gdk_wayland_window_create_xdg_popup (GdkWindow            *window,
 static struct wl_seat *
 find_grab_input_seat (GdkWindow *window, GdkWindow *transient_for)
 {
-  struct wl_seat *grab_input_seat = NULL;
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
   GdkWindowImplWayland *tmp_impl;
 
@@ -1001,20 +1000,20 @@ find_grab_input_seat (GdkWindow *window, GdkWindow *transient_for)
    * the popup window setup - so this relies on GTK+ taking the
    * grab before showing the popup window.
    */
-  grab_input_seat = impl->grab_input_seat;
+  if (impl->grab_input_seat)
+    return impl->grab_input_seat;
 
-  tmp_impl = GDK_WINDOW_IMPL_WAYLAND (transient_for->impl);
-  while (!grab_input_seat)
+  while (transient_for)
     {
-      grab_input_seat = tmp_impl->grab_input_seat;
+      tmp_impl = GDK_WINDOW_IMPL_WAYLAND (transient_for->impl);
 
-      if (tmp_impl->transient_for)
-        tmp_impl = GDK_WINDOW_IMPL_WAYLAND (tmp_impl->transient_for->impl);
-      else
-        break;
+      if (tmp_impl->grab_input_seat)
+        return tmp_impl->grab_input_seat;
+
+      transient_for = tmp_impl->transient_for;
     }
 
-  return grab_input_seat;
+  return NULL;
 }
 
 static void


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