[caribou: 15/23] Fix widget type check



commit 2e42f22a485e2b17a63b9f9946d025cc707ade86
Author: Dan Winship <danw gnome org>
Date:   Fri Aug 5 12:42:33 2011 -0400

    Fix widget type check
    
    Check that the widget is either a Gtk.Editable (eg, a Gtk.Entry) or a
    Gtk.TextView, and check that it's not read-only as well.

 modules/gtk3/caribou-gtk-module.vala |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala
index bbbac05..12429fb 100644
--- a/modules/gtk3/caribou-gtk-module.vala
+++ b/modules/gtk3/caribou-gtk-module.vala
@@ -67,7 +67,10 @@ namespace Caribou {
             uint32 timestamp = Gdk.X11Display.get_user_time (display);
 #endif
 
-            if (widget != null && (widget is Gtk.Entry || widget is Gtk.TextView) && widget is Gtk.Editable) {
+            if ((widget is Gtk.Editable &&
+                 ((Gtk.Editable) widget).get_editable ()) ||
+                (widget is Gtk.TextView &&
+                 ((Gtk.TextView) widget).get_editable ())) {
                 Gdk.Window current_window = widget.get_window ();
                 int x = 0, y = 0, w = 0, h = 0;
                 if (current_window != null)



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