Author: gnorton
Date: 2007-11-21 22:11:22 -0500 (Wed, 21 Nov 2007)
New Revision: 90120
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ControlHandler.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/EventHandler.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/KeyboardHandler.cs
Log:
2007-11-21 Geoff Norton <[EMAIL PROTECTED]>
* ControlHandler.cs: Allow custom HIView to get keyboard focus.
* Enums.cs: Remove some unused Enums.
* EventHandler.cs: Make controls listen to kEventControlGetFocusPart
* KeyboardHandler.cs: Get the focus control from Carbon before
returning control from the function
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ChangeLog
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ChangeLog
2007-11-22 02:57:31 UTC (rev 90119)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ChangeLog
2007-11-22 03:11:22 UTC (rev 90120)
@@ -1,3 +1,10 @@
+2007-11-21 Geoff Norton <[EMAIL PROTECTED]>
+
+ * ControlHandler.cs: Allow custom HIView to get keyboard focus.
+ * Enums.cs: Remove some unused Enums.
+ * EventHandler.cs: Make controls listen to kEventControlGetFocusPart
+ * KeyboardHandler.cs: Get the focus control from Carbon before
returning control from the function
+
2007-11-15 Geoff Norton <[EMAIL PROTECTED]>
* EventHandler.cs: The new event handler dispatcher for the Carbon port.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ControlHandler.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ControlHandler.cs
2007-11-22 02:57:31 UTC (rev 90119)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/ControlHandler.cs
2007-11-22 03:11:22 UTC (rev 90120)
@@ -87,10 +87,12 @@
internal const uint kEventParamDirectObject = 757935405;
internal const uint kEventParamMouseButton = 1835168878;
internal const uint kEventParamMouseLocation = 1835822947;
+ internal const uint kEventParamControlPart = 1668313716;
internal const uint typeControlRef = 1668575852;
internal const uint typeCGContextRef = 1668183160;
internal const uint typeMouseButton = 1835168878;
internal const uint typeQDPoint = 1363439732;
+ internal const uint typeControlPartCode = 1668313716;
internal ControlHandler (XplatUICarbon driver) : base (driver)
{}
@@ -191,8 +193,14 @@
Driver.mouse_position.X = (int) point.x;
Driver.mouse_position.Y = (int) point.y;
+ SetKeyboardFocus (GetControlOwner
(hwnd.Handle), hwnd.Handle, 1);
return true;
}
+ case kEventControlGetFocusPart: {
+ short pcode = 0;
+ SetEventParameter (eventref,
kEventParamControlPart, typeControlPartCode, (uint)Marshal.SizeOf (typeof
(short)), ref pcode);
+ return false;
+ }
}
return false;
}
@@ -294,35 +302,20 @@
}
}
-/*
-
-
-
- case Constants.kEventControlSetFocusPart: {
- // This handles setting focus
- short pcode = 1;
- GetEventParameter (inEvent,
Constants.EventParamName.kEventParamControlPart,
Constants.EventParamType.typeControlPartCode, IntPtr.Zero, (uint)Marshal.SizeOf
(typeof (short)), IntPtr.Zero, ref pcode);
- switch (pcode) {
- case 0:
- case -1:
- case -2:
- pcode = 0;
- break;
- }
- SetEventParameter (inEvent,
Constants.EventParamName.kEventParamControlPart,
Constants.EventParamType.typeControlPartCode, (uint)Marshal.SizeOf (typeof
(short)), ref pcode);
- return 0;
- }
- }
- return -9874;
- }
-*/
[DllImport
("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
static extern int GetEventParameter (IntPtr eventref, uint
name, uint type, IntPtr outtype, uint size, IntPtr outsize, ref IntPtr data);
[DllImport
("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
static extern int GetEventParameter (IntPtr eventref, uint
name, uint type, IntPtr outtype, uint size, IntPtr outsize, ref ushort data);
[DllImport
("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
static extern int GetEventParameter (IntPtr eventref, uint
name, uint type, IntPtr outtype, uint size, IntPtr outsize, ref QDPoint data);
+ [DllImport
("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int SetEventParameter (IntPtr eventref, uint
name, uint type, uint size, ref short data);
+ [DllImport
("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern void SetKeyboardFocus (IntPtr window, IntPtr
handle, short part);
+ [DllImport
("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern IntPtr GetControlOwner (IntPtr handle);
+
[DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
static extern int HIViewGetBounds (IntPtr handle, ref HIRect
rect);
[DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs
2007-11-22 02:57:31 UTC (rev 90119)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs
2007-11-22 03:11:22 UTC (rev 90120)
@@ -26,14 +26,6 @@
using System;
namespace System.Windows.Forms.CarbonInternal {
- internal enum EventParamName : uint {
- kEventParamControlPart = 1668313716,
- }
-
- internal enum EventParamType : uint {
- typeControlPartCode = 1668313716,
- }
-
internal enum WindowClass : uint {
kAlertWindowClass = 1,
kMovableAlertWindowClass = 2,
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/EventHandler.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/EventHandler.cs
2007-11-22 02:57:31 UTC (rev 90119)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/EventHandler.cs
2007-11-22 03:11:22 UTC (rev 90120)
@@ -55,6 +55,7 @@
internal static EventTypeSpec [] ControlEvents = new
EventTypeSpec [] {
new
EventTypeSpec (kEventClassControl, ControlHandler.kEventControlSetFocusPart),
+ new
EventTypeSpec (kEventClassControl, ControlHandler.kEventControlGetFocusPart),
new
EventTypeSpec (kEventClassControl, ControlHandler.kEventControlClick),
new
EventTypeSpec (kEventClassControl,
ControlHandler.kEventControlContextualMenuClick),
new
EventTypeSpec (kEventClassControl, ControlHandler.kEventControlTrack),
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/KeyboardHandler.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/KeyboardHandler.cs
2007-11-22 02:57:31 UTC (rev 90119)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/KeyboardHandler.cs
2007-11-22 03:11:22 UTC (rev 90120)
@@ -83,17 +83,11 @@
public bool ProcessEvent (IntPtr eventref, IntPtr handle, uint
kind, ref MSG msg) {
- Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
int vkey = -1;
bool result = true;
byte charCode = 0x0;
UInt32 new_modifiers = 0;
- if (hwnd == null)
- return false;
-
- msg.hwnd = hwnd.Handle;
-
GetEventParameter (eventref,
kEventParamKeyMacCharCodes, typeChar, IntPtr.Zero, (uint)Marshal.SizeOf (typeof
(byte)), IntPtr.Zero, ref charCode);
GetEventParameter (eventref, kEventParamKeyModifiers,
typeUInt32, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (UInt32)), IntPtr.Zero,
ref new_modifiers);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches