[winforms] undo accidental removal of a line
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms.CarbonInternal / KeyboardHandler.cs
index 8feda4682978b24097ee4e59311fde13ed8629c3..edc2416b9a9639fb87bbeb999211751a8b0dc7b3 100644 (file)
@@ -55,6 +55,8 @@ namespace System.Windows.Forms.CarbonInternal {
 
                internal static bool translate_modifier = false;
 
+               internal string ComposedString;
+
                static KeyboardHandler () {
                        // our key filter table is a 256 byte array - if the corresponding byte 
                        // is set the key should be filtered from WM_CHAR (apple pushes unicode events
@@ -96,7 +98,7 @@ namespace System.Windows.Forms.CarbonInternal {
 50, 65, 66, 67, 68, 187, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 
 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 219, 220, 221, 54, 189, 
 192, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 
-80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127
+80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 0x2e
 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 
 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 
 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 
@@ -196,11 +198,17 @@ namespace System.Windows.Forms.CarbonInternal {
                        Marshal.FreeHGlobal (buffer);
 
                        if (key_filter_table [bdata [0]] == 0x00) {
-                               // TODO: We support 2byte/4byte unicode? how does this get packed
-                               msg.message = Msg.WM_CHAR;
-                               msg.wParam = (IntPtr) bdata [0];
-                               msg.lParam = IntPtr.Zero;
-                               msg.hwnd = XplatUICarbon.FocusWindow;
+                               if (size == 1) {
+                                       msg.message = Msg.WM_CHAR;
+                                       msg.wParam = BitConverter.IsLittleEndian ? (IntPtr) bdata [0] : (IntPtr) bdata [size-1];
+                                       msg.lParam = IntPtr.Zero;
+                                       msg.hwnd = XplatUICarbon.FocusWindow;
+                               } else {
+                                       msg.message = Msg.WM_IME_COMPOSITION;
+                                       Encoding enc = BitConverter.IsLittleEndian ? Encoding.Unicode : Encoding.BigEndianUnicode;
+                                       ComposedString = enc.GetString (bdata);
+                                       msg.hwnd = XplatUICarbon.FocusWindow;
+                               }
                        }
                }