Author: lluis
Date: 2007-03-28 11:05:52 -0500 (Wed, 28 Mar 2007)
New Revision: 75083

Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/libstetic/wrapper/Container.cs
   trunk/stetic/libstetic/wrapper/Widget.cs
Log:
* libstetic/wrapper/Container.cs, libstetic/wrapper/Widget.cs: When
  selecting a widget, avoid setting the focus to the parent
  container, since it may end changing the selection. Fixes bug
  #81014. 

Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2007-03-28 15:58:40 UTC (rev 75082)
+++ trunk/stetic/ChangeLog      2007-03-28 16:05:52 UTC (rev 75083)
@@ -1,5 +1,12 @@
 2007-03-28  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
+       * libstetic/wrapper/Container.cs, libstetic/wrapper/Widget.cs: When
+         selecting a widget, avoid setting the focus to the parent
+         container, since it may end changing the selection. Fixes bug
+         #81014. 
+
+2007-03-28  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
        * libstetic/wrapper/objects.xml: Removed properties already inherited
          from Gtk.Button.
 

Modified: trunk/stetic/libstetic/wrapper/Container.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Container.cs 2007-03-28 15:58:40 UTC (rev 
75082)
+++ trunk/stetic/libstetic/wrapper/Container.cs 2007-03-28 16:05:52 UTC (rev 
75083)
@@ -964,26 +964,22 @@
                        
                        selection = widget;
                        if (win != null) {
-                               if (widget != null && widget.CanFocus)
-                                       win.Focus = widget;
-                               else if (widget != null) {
-                                       // Remove the focus from the window. In 
this way we ensure
-                                       // that the current selected widget 
will lose the focus,
-                                       // even if the new selection is not 
focusable.
-                                       Gtk.Widget w = widget.Parent;
-                                       while (w != null && !w.CanFocus) {
-                                               w = w.Parent;
-                                       }
-                                       Widget wr = Widget.Lookup (w);
-                                       
-                                       if (wr != null) {
-                                               // This flags avoids calling 
Select() again
-                                               // when the focusIn event is 
received.
-                                               wr.settingFocus = true;
+                               if (widget != null) {
+                                       if (widget.CanFocus)
+                                               win.Focus = widget;
+                                       else {
+                                               // Look for a focusable parent 
container
+                                               Widget wr = GetTopLevel ();
+                                               Gtk.Widget w = wr.Wrapped;
+                                               while (w != null && !w.CanFocus)
+                                                       w = w.Parent;
+
+                                               // If the widget is not 
focusable,
+                                               // remove the focus from the 
window. In this way we ensure
+                                               // that the current selected 
widget will lose the focus,
+                                               // even if the new selection is 
not focusable.
                                                win.Focus = w;
-                                               wr.settingFocus = false;
-                                       } else
-                                               win.Focus = w;
+                                       }
                                } else {
                                        if (designer != null)
                                                designer.ResetSelection (null);

Modified: trunk/stetic/libstetic/wrapper/Widget.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Widget.cs    2007-03-28 15:58:40 UTC (rev 
75082)
+++ trunk/stetic/libstetic/wrapper/Widget.cs    2007-03-28 16:05:52 UTC (rev 
75083)
@@ -12,7 +12,6 @@
                
                string oldName;
                string oldMemberName;
-               internal bool settingFocus;
                bool hexpandable, vexpandable;
                bool generatePublic = true;
 
@@ -115,9 +114,6 @@
                
                void OnFocusIn (object s, Gtk.FocusInEventArgs a)
                {
-                       if (settingFocus)
-                               return;
-
                        if (!Unselectable)
                                Select ();
                        else if (ParentWrapper != null)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to