[Mono-winforms-list] Patch implementing XplatUIWin32.KeyboardSpeed/KeyboardDelay

Sergey Volk sergey.volk at gmail.com
Tue Feb 13 10:50:54 EST 2007


Hi, Here is a patch implemeting KeyboardSpeed/KeyboardDelay properties for
XplatUIWin32 class.
Also it fixes returning driver.KeyboardSpeed instead of
driver.KeyboardDelayfrom
XplatUI.KeyboardDelay property in XplatUI.cs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20070213/54143c3b/attachment.html 
-------------- next part --------------
Index: System.Windows.Forms/XplatUI.cs
===================================================================
--- System.Windows.Forms/XplatUI.cs	(revision 72542)
+++ System.Windows.Forms/XplatUI.cs	(working copy)
@@ -165,7 +165,7 @@
 
 		static public int KeyboardDelay {
 			get {
-				return driver.KeyboardSpeed;
+				return driver.KeyboardDelay;
 			}
 		}
 
Index: System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- System.Windows.Forms/XplatUIWin32.cs	(revision 72542)
+++ System.Windows.Forms/XplatUIWin32.cs	(working copy)
@@ -102,6 +102,8 @@
 		}
 
 		internal enum SPIAction {
+			SPI_GETKEYBOARDSPEED	= 0x000A,
+			SPI_GETKEYBOARDDELAY	= 0x0016,
 			SPI_GETWORKAREA		= 0x0030,
 			SPI_GETMOUSEHOVERWIDTH	= 0x0062,
 			SPI_GETMOUSEHOVERHEIGHT	= 0x0064,
@@ -2610,24 +2612,24 @@
 
 		internal override int KeyboardSpeed {
 			get {
-				Console.WriteLine ("KeyboardSpeed: need to query Windows");
-
+				int speed = 0;
+				Win32SystemParametersInfo(SPIAction.SPI_GETKEYBOARDSPEED, 0, ref speed, 0);
 				//
 				// Return values range from 0 to 31 which map to 2.5 to 30 repetitions per second.
 				//
-				return 0;
+				return speed;
 			}
 		}
 
 		internal override int KeyboardDelay {
 			get {
-				Console.WriteLine ("KeyboardDelay: need to query Windows");
-
+				int delay = 1;
+				Win32SystemParametersInfo(SPIAction.SPI_GETKEYBOARDDELAY, 0, ref delay, 0);
 				//
 				// Return values must range from 0 to 4, 0 meaning 250ms,
 				// and 4 meaning 1000 ms.
 				//
-				return 1;
+				return delay;
 			}
 		}
 


More information about the Mono-winforms-list mailing list