]> Pileus Git - ~andy/gtk/commitdiff
GtkIMContextSimple: avoid gdk_window_get_user_data
authorRyan Lortie <desrt@desrt.ca>
Wed, 20 Oct 2010 21:58:20 +0000 (23:58 +0200)
committerRyan Lortie <desrt@desrt.ca>
Wed, 20 Oct 2010 21:58:20 +0000 (23:58 +0200)
We lookup a widget to call a function on GtkWidget that ends up just
performing an operation directly on the GdkWindow again anyway
(beeping).  There's already fallback code at the point of the call that
does exactly that anyway, so just do that all of the time.

gtk/gtkimcontextsimple.c

index fac41e75943879444b83ea2cae2e3e26f9db1c53..d9c70e5b670cc9af030ea2647bce524802d63999 100644 (file)
@@ -692,26 +692,15 @@ check_hex (GtkIMContextSimple *context_simple,
 static void
 beep_window (GdkWindow *window)
 {
-  GtkWidget *widget;
+  GdkScreen *screen = gdk_window_get_screen (GDK_DRAWABLE (window));
+  gboolean   beep;
 
-  gdk_window_get_user_data (window, (gpointer) &widget);
+  g_object_get (gtk_settings_get_for_screen (screen),
+                "gtk-error-bell", &beep,
+                NULL);
 
-  if (GTK_IS_WIDGET (widget))
-    {
-      gtk_widget_error_bell (widget);
-    }
-  else
-    {
-      GdkScreen *screen = gdk_window_get_screen (GDK_DRAWABLE (window));
-      gboolean   beep;
-
-      g_object_get (gtk_settings_get_for_screen (screen),
-                    "gtk-error-bell", &beep,
-                    NULL);
-
-      if (beep)
-        gdk_window_beep (window);
-    }
+  if (beep)
+    gdk_window_beep (window);
 }
 
 static gboolean