Author: pbartok
Date: 2006-03-12 19:36:01 -0500 (Sun, 12 Mar 2006)
New Revision: 57886

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

        * XplatUIX11.cs: Added call to new Keyboard.ResetKeyState to prevent
          the keyboard state from being stuck with keys in 'pressed' state when
          focus is switched away via keyboard
        * X11Keyboard.cs: Added new ResetKeyState method to allow drivers to
          reset the keyboard if no X11 KeyUp events are expected to come
        * X11Structs.cs: Switched type of Visible to bool to match driver



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-03-12 23:30:48 UTC (rev 57885)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-03-13 00:36:01 UTC (rev 57886)
@@ -1,3 +1,12 @@
+2006-03-12  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
+
+       * XplatUIX11.cs: Added call to new Keyboard.ResetKeyState to prevent
+         the keyboard state from being stuck with keys in 'pressed' state when
+         focus is switched away via keyboard
+       * X11Keyboard.cs: Added new ResetKeyState method to allow drivers to
+         reset the keyboard if no X11 KeyUp events are expected to come
+       * X11Structs.cs: Switched type of Visible to bool to match driver
+
 2006-03-12  Peter Dennis Bartok  <[EMAIL PROTECTED]>
 
        * TextControl.cs:

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs   
2006-03-12 23:30:48 UTC (rev 57885)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs   
2006-03-13 00:36:01 UTC (rev 57886)
@@ -31,6 +31,7 @@
 //  - There is a lot of potential for optimmization in here
 // 
 using System;
+using System.Collections;
 using System.Text;
 using System.Runtime.InteropServices;
 
@@ -70,6 +71,23 @@
                        }
                }
 
+               public bool ResetKeyState(IntPtr hwnd, ref MSG msg) {
+                       // FIXME - keep defining events/msg and return true 
until we've 'restored' all
+                       // pending keypresses
+                       if ((key_state_table [(int) VirtualKeys.VK_SHIFT] & 
0x80) != 0) {
+                               key_state_table [(int) VirtualKeys.VK_SHIFT] &= 
 unchecked((byte)~0x80);
+                       }
+
+                       if ((key_state_table [(int) VirtualKeys.VK_CONTROL] & 
0x80) != 0) {
+                               key_state_table [(int) VirtualKeys.VK_CONTROL] 
&=  unchecked((byte)~0x80);
+                       }
+
+                       if ((key_state_table [(int) VirtualKeys.VK_MENU] & 
0x80) != 0) {
+                               key_state_table [(int) VirtualKeys.VK_MENU] &=  
unchecked((byte)~0x80);
+                       }
+                       return false;
+               }
+
                public void KeyEvent (IntPtr hwnd, XEvent xevent, ref MSG msg)
                {
                        XKeySym keysym;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs    
2006-03-12 23:30:48 UTC (rev 57885)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs    
2006-03-13 00:36:01 UTC (rev 57886)
@@ -1422,7 +1422,7 @@
                internal int    Y;                              // Y position 
of the caret
                internal int    Width;                          // Width of the 
caret; if no image used
                internal int    Height;                         // Height of 
the caret, if no image used
-               internal int    Visible;                        // Counter for 
visible/hidden
+               internal bool   Visible;                        // Is caret 
visible?
                internal bool   On;                             // Caret blink 
display state: On/Off
                internal IntPtr gc;                             // Graphics 
context
                internal bool   Paused;                         // Don't update 
right now

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-03-12 23:30:48 UTC (rev 57885)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-03-13 00:36:01 UTC (rev 57886)
@@ -3020,6 +3020,10 @@
                                                goto ProcessNextMessage;
                                        }
 
+                                       while 
(Keyboard.ResetKeyState(FocusWindow, ref msg)) {
+                                               SendMessage(FocusWindow, 
msg.message, msg.wParam, msg.lParam);
+                                       }
+
                                        SendMessage(FocusWindow, 
Msg.WM_KILLFOCUS, IntPtr.Zero, IntPtr.Zero);
                                        goto ProcessNextMessage;
                                }

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

Reply via email to