Author: pbartok
Date: 2006-06-01 12:48:02 -0400 (Thu, 01 Jun 2006)
New Revision: 61379

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
2006-06-01  Peter Dennis Bartok  <[EMAIL PROTECTED]> 

        * XplatUIX11.cs (SetFocus): Make sure we can handle re-entrancy due to
          SendMessage directly calling window procedures, which in turn might
          call SetFocus()



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-01 15:55:36 UTC (rev 61378)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-01 16:48:02 UTC (rev 61379)
@@ -1,3 +1,9 @@
+2006-06-01  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
+
+       * XplatUIX11.cs (SetFocus): Make sure we can handle re-entrancy due to
+         SendMessage directly calling window procedures, which in turn might
+         call SetFocus()
+
 2006-06-01  Peter Dennis Bartok  <[EMAIL PROTECTED]>
 
        * Control.cs: Don't handle WM_SETFOCUS if the same window already

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-06-01 15:55:36 UTC (rev 61378)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-06-01 16:48:02 UTC (rev 61379)
@@ -4083,6 +4083,7 @@
 
                internal override void SetFocus(IntPtr handle) {
                        Hwnd    hwnd;
+                       IntPtr  prev_focus_window;
 
                        hwnd = Hwnd.ObjectFromHandle(handle);
 
@@ -4090,12 +4091,14 @@
                                return;
                        }
 
-                       if (FocusWindow != IntPtr.Zero) {
-                               SendMessage(FocusWindow, Msg.WM_KILLFOCUS, 
hwnd.client_window, IntPtr.Zero);
-                       }
-                       SendMessage(hwnd.client_window, Msg.WM_SETFOCUS, 
FocusWindow, IntPtr.Zero);
+                       prev_focus_window = FocusWindow;
                        FocusWindow = hwnd.client_window;
 
+                       if (prev_focus_window != IntPtr.Zero) {
+                               SendMessage(prev_focus_window, 
Msg.WM_KILLFOCUS, FocusWindow, IntPtr.Zero);
+                       }
+                       SendMessage(FocusWindow, Msg.WM_SETFOCUS, 
prev_focus_window, IntPtr.Zero);
+
                        //XSetInputFocus(DisplayHandle, 
Hwnd.ObjectFromHandle(handle).client_window, RevertTo.None, IntPtr.Zero);
                }
 

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

Reply via email to