diff --git a/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj b/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj index 540e70cee0..07a9ab56ed 100644 --- a/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj +++ b/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj @@ -52,6 +52,7 @@ + diff --git a/src/Gtk/Avalonia.Gtk/Input/GtkKeyboardDevice.cs b/src/Gtk/Avalonia.Gtk/Input/GtkKeyboardDevice.cs index 4e88dcda9a..a97a6190f1 100644 --- a/src/Gtk/Avalonia.Gtk/Input/GtkKeyboardDevice.cs +++ b/src/Gtk/Avalonia.Gtk/Input/GtkKeyboardDevice.cs @@ -8,218 +8,11 @@ using System.Reflection; using System.Text; using Avalonia.Input; + namespace Avalonia.Gtk { public class GtkKeyboardDevice : KeyboardDevice { - private static readonly Dictionary KeyDic = new Dictionary - { - { Gdk.Key.Cancel, Key.Cancel }, - { Gdk.Key.BackSpace, Key.Back }, - { Gdk.Key.Tab, Key.Tab }, - { Gdk.Key.Linefeed, Key.LineFeed }, - { Gdk.Key.Clear, Key.Clear }, - { Gdk.Key.Return, Key.Return }, - { Gdk.Key.Pause, Key.Pause }, - //{ Gdk.Key.?, Key.CapsLock } - //{ Gdk.Key.?, Key.HangulMode } - //{ Gdk.Key.?, Key.JunjaMode } - //{ Gdk.Key.?, Key.FinalMode } - //{ Gdk.Key.?, Key.KanjiMode } - { Gdk.Key.Escape, Key.Escape }, - //{ Gdk.Key.?, Key.ImeConvert } - //{ Gdk.Key.?, Key.ImeNonConvert } - //{ Gdk.Key.?, Key.ImeAccept } - //{ Gdk.Key.?, Key.ImeModeChange } - { Gdk.Key.space, Key.Space }, - { Gdk.Key.Prior, Key.Prior }, - //{ Gdk.Key.?, Key.PageDown } - { Gdk.Key.End, Key.End }, - { Gdk.Key.Home, Key.Home }, - { Gdk.Key.Left, Key.Left }, - { Gdk.Key.Up, Key.Up }, - { Gdk.Key.Right, Key.Right }, - { Gdk.Key.Down, Key.Down }, - { Gdk.Key.Select, Key.Select }, - { Gdk.Key.Print, Key.Print }, - { Gdk.Key.Execute, Key.Execute }, - //{ Gdk.Key.?, Key.Snapshot } - { Gdk.Key.Insert, Key.Insert }, - { Gdk.Key.Delete, Key.Delete }, - { Gdk.Key.Help, Key.Help }, - //{ Gdk.Key.?, Key.D0 } - //{ Gdk.Key.?, Key.D1 } - //{ Gdk.Key.?, Key.D2 } - //{ Gdk.Key.?, Key.D3 } - //{ Gdk.Key.?, Key.D4 } - //{ Gdk.Key.?, Key.D5 } - //{ Gdk.Key.?, Key.D6 } - //{ Gdk.Key.?, Key.D7 } - //{ Gdk.Key.?, Key.D8 } - //{ Gdk.Key.?, Key.D9 } - { Gdk.Key.A, Key.A }, - { Gdk.Key.B, Key.B }, - { Gdk.Key.C, Key.C }, - { Gdk.Key.D, Key.D }, - { Gdk.Key.E, Key.E }, - { Gdk.Key.F, Key.F }, - { Gdk.Key.G, Key.G }, - { Gdk.Key.H, Key.H }, - { Gdk.Key.I, Key.I }, - { Gdk.Key.J, Key.J }, - { Gdk.Key.K, Key.K }, - { Gdk.Key.L, Key.L }, - { Gdk.Key.M, Key.M }, - { Gdk.Key.N, Key.N }, - { Gdk.Key.O, Key.O }, - { Gdk.Key.P, Key.P }, - { Gdk.Key.Q, Key.Q }, - { Gdk.Key.R, Key.R }, - { Gdk.Key.S, Key.S }, - { Gdk.Key.T, Key.T }, - { Gdk.Key.U, Key.U }, - { Gdk.Key.V, Key.V }, - { Gdk.Key.W, Key.W }, - { Gdk.Key.X, Key.X }, - { Gdk.Key.Y, Key.Y }, - { Gdk.Key.Z, Key.Z }, - { Gdk.Key.a, Key.A }, - { Gdk.Key.b, Key.B }, - { Gdk.Key.c, Key.C }, - { Gdk.Key.d, Key.D }, - { Gdk.Key.e, Key.E }, - { Gdk.Key.f, Key.F }, - { Gdk.Key.g, Key.G }, - { Gdk.Key.h, Key.H }, - { Gdk.Key.i, Key.I }, - { Gdk.Key.j, Key.J }, - { Gdk.Key.k, Key.K }, - { Gdk.Key.l, Key.L }, - { Gdk.Key.m, Key.M }, - { Gdk.Key.n, Key.N }, - { Gdk.Key.o, Key.O }, - { Gdk.Key.p, Key.P }, - { Gdk.Key.q, Key.Q }, - { Gdk.Key.r, Key.R }, - { Gdk.Key.s, Key.S }, - { Gdk.Key.t, Key.T }, - { Gdk.Key.u, Key.U }, - { Gdk.Key.v, Key.V }, - { Gdk.Key.w, Key.W }, - { Gdk.Key.x, Key.X }, - { Gdk.Key.y, Key.Y }, - { Gdk.Key.z, Key.Z }, - //{ Gdk.Key.?, Key.LWin } - //{ Gdk.Key.?, Key.RWin } - //{ Gdk.Key.?, Key.Apps } - //{ Gdk.Key.?, Key.Sleep } - //{ Gdk.Key.?, Key.NumPad0 } - //{ Gdk.Key.?, Key.NumPad1 } - //{ Gdk.Key.?, Key.NumPad2 } - //{ Gdk.Key.?, Key.NumPad3 } - //{ Gdk.Key.?, Key.NumPad4 } - //{ Gdk.Key.?, Key.NumPad5 } - //{ Gdk.Key.?, Key.NumPad6 } - //{ Gdk.Key.?, Key.NumPad7 } - //{ Gdk.Key.?, Key.NumPad8 } - //{ Gdk.Key.?, Key.NumPad9 } - { Gdk.Key.multiply, Key.Multiply }, - //{ Gdk.Key.?, Key.Add } - //{ Gdk.Key.?, Key.Separator } - //{ Gdk.Key.?, Key.Subtract } - //{ Gdk.Key.?, Key.Decimal } - //{ Gdk.Key.?, Key.Divide } - { Gdk.Key.F1, Key.F1 }, - { Gdk.Key.F2, Key.F2 }, - { Gdk.Key.F3, Key.F3 }, - { Gdk.Key.F4, Key.F4 }, - { Gdk.Key.F5, Key.F5 }, - { Gdk.Key.F6, Key.F6 }, - { Gdk.Key.F7, Key.F7 }, - { Gdk.Key.F8, Key.F8 }, - { Gdk.Key.F9, Key.F9 }, - { Gdk.Key.F10, Key.F10 }, - { Gdk.Key.F11, Key.F11 }, - { Gdk.Key.F12, Key.F12 }, - { Gdk.Key.L3, Key.F13 }, - { Gdk.Key.F14, Key.F14 }, - { Gdk.Key.L5, Key.F15 }, - { Gdk.Key.F16, Key.F16 }, - { Gdk.Key.F17, Key.F17 }, - { Gdk.Key.L8, Key.F18 }, - { Gdk.Key.L9, Key.F19 }, - { Gdk.Key.L10, Key.F20 }, - { Gdk.Key.R1, Key.F21 }, - { Gdk.Key.R2, Key.F22 }, - { Gdk.Key.F23, Key.F23 }, - { Gdk.Key.R4, Key.F24 }, - //{ Gdk.Key.?, Key.NumLock } - //{ Gdk.Key.?, Key.Scroll } - //{ Gdk.Key.?, Key.LeftShift } - //{ Gdk.Key.?, Key.RightShift } - //{ Gdk.Key.?, Key.LeftCtrl } - //{ Gdk.Key.?, Key.RightCtrl } - //{ Gdk.Key.?, Key.LeftAlt } - //{ Gdk.Key.?, Key.RightAlt } - //{ Gdk.Key.?, Key.BrowserBack } - //{ Gdk.Key.?, Key.BrowserForward } - //{ Gdk.Key.?, Key.BrowserRefresh } - //{ Gdk.Key.?, Key.BrowserStop } - //{ Gdk.Key.?, Key.BrowserSearch } - //{ Gdk.Key.?, Key.BrowserFavorites } - //{ Gdk.Key.?, Key.BrowserHome } - //{ Gdk.Key.?, Key.VolumeMute } - //{ Gdk.Key.?, Key.VolumeDown } - //{ Gdk.Key.?, Key.VolumeUp } - //{ Gdk.Key.?, Key.MediaNextTrack } - //{ Gdk.Key.?, Key.MediaPreviousTrack } - //{ Gdk.Key.?, Key.MediaStop } - //{ Gdk.Key.?, Key.MediaPlayPause } - //{ Gdk.Key.?, Key.LaunchMail } - //{ Gdk.Key.?, Key.SelectMedia } - //{ Gdk.Key.?, Key.LaunchApplication1 } - //{ Gdk.Key.?, Key.LaunchApplication2 } - //{ Gdk.Key.?, Key.OemSemicolon } - //{ Gdk.Key.?, Key.OemPlus } - //{ Gdk.Key.?, Key.OemComma } - //{ Gdk.Key.?, Key.OemMinus } - //{ Gdk.Key.?, Key.OemPeriod } - //{ Gdk.Key.?, Key.Oem2 } - //{ Gdk.Key.?, Key.OemTilde } - //{ Gdk.Key.?, Key.AbntC1 } - //{ Gdk.Key.?, Key.AbntC2 } - //{ Gdk.Key.?, Key.Oem4 } - //{ Gdk.Key.?, Key.OemPipe } - //{ Gdk.Key.?, Key.OemCloseBrackets } - //{ Gdk.Key.?, Key.Oem7 } - //{ Gdk.Key.?, Key.Oem8 } - //{ Gdk.Key.?, Key.Oem102 } - //{ Gdk.Key.?, Key.ImeProcessed } - //{ Gdk.Key.?, Key.System } - //{ Gdk.Key.?, Key.OemAttn } - //{ Gdk.Key.?, Key.OemFinish } - //{ Gdk.Key.?, Key.DbeHiragana } - //{ Gdk.Key.?, Key.OemAuto } - //{ Gdk.Key.?, Key.DbeDbcsChar } - //{ Gdk.Key.?, Key.OemBackTab } - //{ Gdk.Key.?, Key.Attn } - //{ Gdk.Key.?, Key.DbeEnterWordRegisterMode } - //{ Gdk.Key.?, Key.DbeEnterImeConfigureMode } - //{ Gdk.Key.?, Key.EraseEof } - //{ Gdk.Key.?, Key.Play } - //{ Gdk.Key.?, Key.Zoom } - //{ Gdk.Key.?, Key.NoName } - //{ Gdk.Key.?, Key.DbeEnterDialogConversionMode } - //{ Gdk.Key.?, Key.OemClear } - //{ Gdk.Key.?, Key.DeadCharProcessed } - }; - public new static GtkKeyboardDevice Instance { get; } = new GtkKeyboardDevice(); - - public static Key ConvertKey(Gdk.Key key) - { - Key result; - return KeyDic.TryGetValue(key, out result) ? result : Key.None; - } } } \ No newline at end of file diff --git a/src/Gtk/Avalonia.Gtk/KeyTransform.cs b/src/Gtk/Avalonia.Gtk/KeyTransform.cs new file mode 100644 index 0000000000..77de8d18a3 --- /dev/null +++ b/src/Gtk/Avalonia.Gtk/KeyTransform.cs @@ -0,0 +1,224 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Avalonia.Input; +#if GTK3_PINVOKE +using Avalonia.Gtk3; +#else +using GdkKey = Gdk.Key; +#endif +namespace Avalonia.Gtk.Common +{ + static class KeyTransform + { + private static readonly Dictionary KeyDic = new Dictionary + { + { GdkKey.Cancel, Key.Cancel }, + { GdkKey.BackSpace, Key.Back }, + { GdkKey.Tab, Key.Tab }, + { GdkKey.Linefeed, Key.LineFeed }, + { GdkKey.Clear, Key.Clear }, + { GdkKey.Return, Key.Return }, + { GdkKey.Pause, Key.Pause }, + //{ GdkKey.?, Key.CapsLock } + //{ GdkKey.?, Key.HangulMode } + //{ GdkKey.?, Key.JunjaMode } + //{ GdkKey.?, Key.FinalMode } + //{ GdkKey.?, Key.KanjiMode } + { GdkKey.Escape, Key.Escape }, + //{ GdkKey.?, Key.ImeConvert } + //{ GdkKey.?, Key.ImeNonConvert } + //{ GdkKey.?, Key.ImeAccept } + //{ GdkKey.?, Key.ImeModeChange } + { GdkKey.space, Key.Space }, + { GdkKey.Prior, Key.Prior }, + //{ GdkKey.?, Key.PageDown } + { GdkKey.End, Key.End }, + { GdkKey.Home, Key.Home }, + { GdkKey.Left, Key.Left }, + { GdkKey.Up, Key.Up }, + { GdkKey.Right, Key.Right }, + { GdkKey.Down, Key.Down }, + { GdkKey.Select, Key.Select }, + { GdkKey.Print, Key.Print }, + { GdkKey.Execute, Key.Execute }, + //{ GdkKey.?, Key.Snapshot } + { GdkKey.Insert, Key.Insert }, + { GdkKey.Delete, Key.Delete }, + { GdkKey.Help, Key.Help }, + //{ GdkKey.?, Key.D0 } + //{ GdkKey.?, Key.D1 } + //{ GdkKey.?, Key.D2 } + //{ GdkKey.?, Key.D3 } + //{ GdkKey.?, Key.D4 } + //{ GdkKey.?, Key.D5 } + //{ GdkKey.?, Key.D6 } + //{ GdkKey.?, Key.D7 } + //{ GdkKey.?, Key.D8 } + //{ GdkKey.?, Key.D9 } + { GdkKey.A, Key.A }, + { GdkKey.B, Key.B }, + { GdkKey.C, Key.C }, + { GdkKey.D, Key.D }, + { GdkKey.E, Key.E }, + { GdkKey.F, Key.F }, + { GdkKey.G, Key.G }, + { GdkKey.H, Key.H }, + { GdkKey.I, Key.I }, + { GdkKey.J, Key.J }, + { GdkKey.K, Key.K }, + { GdkKey.L, Key.L }, + { GdkKey.M, Key.M }, + { GdkKey.N, Key.N }, + { GdkKey.O, Key.O }, + { GdkKey.P, Key.P }, + { GdkKey.Q, Key.Q }, + { GdkKey.R, Key.R }, + { GdkKey.S, Key.S }, + { GdkKey.T, Key.T }, + { GdkKey.U, Key.U }, + { GdkKey.V, Key.V }, + { GdkKey.W, Key.W }, + { GdkKey.X, Key.X }, + { GdkKey.Y, Key.Y }, + { GdkKey.Z, Key.Z }, + { GdkKey.a, Key.A }, + { GdkKey.b, Key.B }, + { GdkKey.c, Key.C }, + { GdkKey.d, Key.D }, + { GdkKey.e, Key.E }, + { GdkKey.f, Key.F }, + { GdkKey.g, Key.G }, + { GdkKey.h, Key.H }, + { GdkKey.i, Key.I }, + { GdkKey.j, Key.J }, + { GdkKey.k, Key.K }, + { GdkKey.l, Key.L }, + { GdkKey.m, Key.M }, + { GdkKey.n, Key.N }, + { GdkKey.o, Key.O }, + { GdkKey.p, Key.P }, + { GdkKey.q, Key.Q }, + { GdkKey.r, Key.R }, + { GdkKey.s, Key.S }, + { GdkKey.t, Key.T }, + { GdkKey.u, Key.U }, + { GdkKey.v, Key.V }, + { GdkKey.w, Key.W }, + { GdkKey.x, Key.X }, + { GdkKey.y, Key.Y }, + { GdkKey.z, Key.Z }, + //{ GdkKey.?, Key.LWin } + //{ GdkKey.?, Key.RWin } + //{ GdkKey.?, Key.Apps } + //{ GdkKey.?, Key.Sleep } + //{ GdkKey.?, Key.NumPad0 } + //{ GdkKey.?, Key.NumPad1 } + //{ GdkKey.?, Key.NumPad2 } + //{ GdkKey.?, Key.NumPad3 } + //{ GdkKey.?, Key.NumPad4 } + //{ GdkKey.?, Key.NumPad5 } + //{ GdkKey.?, Key.NumPad6 } + //{ GdkKey.?, Key.NumPad7 } + //{ GdkKey.?, Key.NumPad8 } + //{ GdkKey.?, Key.NumPad9 } + { GdkKey.multiply, Key.Multiply }, + //{ GdkKey.?, Key.Add } + //{ GdkKey.?, Key.Separator } + //{ GdkKey.?, Key.Subtract } + //{ GdkKey.?, Key.Decimal } + //{ GdkKey.?, Key.Divide } + { GdkKey.F1, Key.F1 }, + { GdkKey.F2, Key.F2 }, + { GdkKey.F3, Key.F3 }, + { GdkKey.F4, Key.F4 }, + { GdkKey.F5, Key.F5 }, + { GdkKey.F6, Key.F6 }, + { GdkKey.F7, Key.F7 }, + { GdkKey.F8, Key.F8 }, + { GdkKey.F9, Key.F9 }, + { GdkKey.F10, Key.F10 }, + { GdkKey.F11, Key.F11 }, + { GdkKey.F12, Key.F12 }, + { GdkKey.L3, Key.F13 }, + { GdkKey.F14, Key.F14 }, + { GdkKey.L5, Key.F15 }, + { GdkKey.F16, Key.F16 }, + { GdkKey.F17, Key.F17 }, + { GdkKey.L8, Key.F18 }, + { GdkKey.L9, Key.F19 }, + { GdkKey.L10, Key.F20 }, + { GdkKey.R1, Key.F21 }, + { GdkKey.R2, Key.F22 }, + { GdkKey.F23, Key.F23 }, + { GdkKey.R4, Key.F24 }, + //{ GdkKey.?, Key.NumLock } + //{ GdkKey.?, Key.Scroll } + //{ GdkKey.?, Key.LeftShift } + //{ GdkKey.?, Key.RightShift } + //{ GdkKey.?, Key.LeftCtrl } + //{ GdkKey.?, Key.RightCtrl } + //{ GdkKey.?, Key.LeftAlt } + //{ GdkKey.?, Key.RightAlt } + //{ GdkKey.?, Key.BrowserBack } + //{ GdkKey.?, Key.BrowserForward } + //{ GdkKey.?, Key.BrowserRefresh } + //{ GdkKey.?, Key.BrowserStop } + //{ GdkKey.?, Key.BrowserSearch } + //{ GdkKey.?, Key.BrowserFavorites } + //{ GdkKey.?, Key.BrowserHome } + //{ GdkKey.?, Key.VolumeMute } + //{ GdkKey.?, Key.VolumeDown } + //{ GdkKey.?, Key.VolumeUp } + //{ GdkKey.?, Key.MediaNextTrack } + //{ GdkKey.?, Key.MediaPreviousTrack } + //{ GdkKey.?, Key.MediaStop } + //{ GdkKey.?, Key.MediaPlayPause } + //{ GdkKey.?, Key.LaunchMail } + //{ GdkKey.?, Key.SelectMedia } + //{ GdkKey.?, Key.LaunchApplication1 } + //{ GdkKey.?, Key.LaunchApplication2 } + //{ GdkKey.?, Key.OemSemicolon } + //{ GdkKey.?, Key.OemPlus } + //{ GdkKey.?, Key.OemComma } + //{ GdkKey.?, Key.OemMinus } + //{ GdkKey.?, Key.OemPeriod } + //{ GdkKey.?, Key.Oem2 } + //{ GdkKey.?, Key.OemTilde } + //{ GdkKey.?, Key.AbntC1 } + //{ GdkKey.?, Key.AbntC2 } + //{ GdkKey.?, Key.Oem4 } + //{ GdkKey.?, Key.OemPipe } + //{ GdkKey.?, Key.OemCloseBrackets } + //{ GdkKey.?, Key.Oem7 } + //{ GdkKey.?, Key.Oem8 } + //{ GdkKey.?, Key.Oem102 } + //{ GdkKey.?, Key.ImeProcessed } + //{ GdkKey.?, Key.System } + //{ GdkKey.?, Key.OemAttn } + //{ GdkKey.?, Key.OemFinish } + //{ GdkKey.?, Key.DbeHiragana } + //{ GdkKey.?, Key.OemAuto } + //{ GdkKey.?, Key.DbeDbcsChar } + //{ GdkKey.?, Key.OemBackTab } + //{ GdkKey.?, Key.Attn } + //{ GdkKey.?, Key.DbeEnterWordRegisterMode } + //{ GdkKey.?, Key.DbeEnterImeConfigureMode } + //{ GdkKey.?, Key.EraseEof } + //{ GdkKey.?, Key.Play } + //{ GdkKey.?, Key.Zoom } + //{ GdkKey.?, Key.NoName } + //{ GdkKey.?, Key.DbeEnterDialogConversionMode } + //{ GdkKey.?, Key.OemClear } + //{ GdkKey.?, Key.DeadCharProcessed } + }; + + public static Key ConvertKey(GdkKey key) + { + Key result; + return KeyDic.TryGetValue(key, out result) ? result : Key.None; + } + } +} diff --git a/src/Gtk/Avalonia.Gtk/WindowImplBase.cs b/src/Gtk/Avalonia.Gtk/WindowImplBase.cs index db4b5e9dde..4d7552aa72 100644 --- a/src/Gtk/Avalonia.Gtk/WindowImplBase.cs +++ b/src/Gtk/Avalonia.Gtk/WindowImplBase.cs @@ -267,7 +267,7 @@ namespace Avalonia.Gtk GtkKeyboardDevice.Instance, evnt.Time, evnt.Type == EventType.KeyPress ? RawKeyEventType.KeyDown : RawKeyEventType.KeyUp, - GtkKeyboardDevice.ConvertKey(evnt.Key), GetModifierKeys(evnt.State)); + Common.KeyTransform.ConvertKey(evnt.Key), GetModifierKeys(evnt.State)); Input(e); } diff --git a/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj b/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj index 06fc40458e..dd35532830 100644 --- a/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj +++ b/src/Gtk/Avalonia.Gtk3/Avalonia.Gtk3.csproj @@ -22,7 +22,7 @@ full false bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;GTK3_PINVOKE prompt 4 true @@ -31,7 +31,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;GTK3_PINVOKE prompt 4 true @@ -41,7 +41,11 @@ + + KeyTransform.cs + + diff --git a/src/Gtk/Avalonia.Gtk3/GdkKey.cs b/src/Gtk/Avalonia.Gtk3/GdkKey.cs new file mode 100644 index 0000000000..b4a0f31b92 --- /dev/null +++ b/src/Gtk/Avalonia.Gtk3/GdkKey.cs @@ -0,0 +1,1347 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Avalonia.Gtk3 +{ + enum GdkKey + { + space = 32, + exclam = 33, + quotedbl = 34, + numbersign = 35, + dollar = 36, + percent = 37, + ampersand = 38, + apostrophe = 39, + quoteright = 39, + parenleft = 40, + parenright = 41, + asterisk = 42, + plus = 43, + comma = 44, + minus = 45, + period = 46, + slash = 47, + Key_0 = 48, + Key_1 = 49, + Key_2 = 50, + Key_3 = 51, + Key_4 = 52, + Key_5 = 53, + Key_6 = 54, + Key_7 = 55, + Key_8 = 56, + Key_9 = 57, + colon = 58, + semicolon = 59, + less = 60, + equal = 61, + greater = 62, + question = 63, + at = 64, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + bracketleft = 91, + backslash = 92, + bracketright = 93, + asciicircum = 94, + underscore = 95, + grave = 96, + quoteleft = 96, + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + braceleft = 123, + bar = 124, + braceright = 125, + asciitilde = 126, + nobreakspace = 160, + exclamdown = 161, + cent = 162, + sterling = 163, + currency = 164, + yen = 165, + brokenbar = 166, + section = 167, + diaeresis = 168, + copyright = 169, + ordfeminine = 170, + guillemotleft = 171, + notsign = 172, + hyphen = 173, + registered = 174, + macron = 175, + degree = 176, + plusminus = 177, + twosuperior = 178, + threesuperior = 179, + acute = 180, + mu = 181, + paragraph = 182, + periodcentered = 183, + cedilla = 184, + onesuperior = 185, + masculine = 186, + guillemotright = 187, + onequarter = 188, + onehalf = 189, + threequarters = 190, + questiondown = 191, + Agrave = 192, + Aacute = 193, + Acircumflex = 194, + Atilde = 195, + Adiaeresis = 196, + Aring = 197, + AE = 198, + Ccedilla = 199, + Egrave = 200, + Eacute = 201, + Ecircumflex = 202, + Ediaeresis = 203, + Igrave = 204, + Iacute = 205, + Icircumflex = 206, + Idiaeresis = 207, + ETH = 208, + Eth = 208, + Ntilde = 209, + Ograve = 210, + Oacute = 211, + Ocircumflex = 212, + Otilde = 213, + Odiaeresis = 214, + multiply = 215, + Ooblique = 216, + Ugrave = 217, + Uacute = 218, + Ucircumflex = 219, + Udiaeresis = 220, + Yacute = 221, + THORN = 222, + Thorn = 222, + ssharp = 223, + agrave = 224, + aacute = 225, + acircumflex = 226, + atilde = 227, + adiaeresis = 228, + aring = 229, + ae = 230, + ccedilla = 231, + egrave = 232, + eacute = 233, + ecircumflex = 234, + ediaeresis = 235, + igrave = 236, + iacute = 237, + icircumflex = 238, + idiaeresis = 239, + eth = 240, + ntilde = 241, + ograve = 242, + oacute = 243, + ocircumflex = 244, + otilde = 245, + odiaeresis = 246, + division = 247, + oslash = 248, + ugrave = 249, + uacute = 250, + ucircumflex = 251, + udiaeresis = 252, + yacute = 253, + thorn = 254, + ydiaeresis = 255, + Aogonek = 417, + breve = 418, + Lstroke = 419, + Lcaron = 421, + Sacute = 422, + Scaron = 425, + Scedilla = 426, + Tcaron = 427, + Zacute = 428, + Zcaron = 430, + Zabovedot = 431, + aogonek = 433, + ogonek = 434, + lstroke = 435, + lcaron = 437, + sacute = 438, + caron = 439, + scaron = 441, + scedilla = 442, + tcaron = 443, + zacute = 444, + doubleacute = 445, + zcaron = 446, + zabovedot = 447, + Racute = 448, + Abreve = 451, + Lacute = 453, + Cacute = 454, + Ccaron = 456, + Eogonek = 458, + Ecaron = 460, + Dcaron = 463, + Dstroke = 464, + Nacute = 465, + Ncaron = 466, + Odoubleacute = 469, + Rcaron = 472, + Uring = 473, + Udoubleacute = 475, + Tcedilla = 478, + racute = 480, + abreve = 483, + lacute = 485, + cacute = 486, + ccaron = 488, + eogonek = 490, + ecaron = 492, + dcaron = 495, + dstroke = 496, + nacute = 497, + ncaron = 498, + odoubleacute = 501, + rcaron = 504, + uring = 505, + udoubleacute = 507, + tcedilla = 510, + abovedot = 511, + Hstroke = 673, + Hcircumflex = 678, + Iabovedot = 681, + Gbreve = 683, + Jcircumflex = 684, + hstroke = 689, + hcircumflex = 694, + idotless = 697, + gbreve = 699, + jcircumflex = 700, + Cabovedot = 709, + Ccircumflex = 710, + Gabovedot = 725, + Gcircumflex = 728, + Ubreve = 733, + Scircumflex = 734, + cabovedot = 741, + ccircumflex = 742, + gabovedot = 757, + gcircumflex = 760, + ubreve = 765, + scircumflex = 766, + kappa = 930, + kra = 930, + Rcedilla = 931, + Itilde = 933, + Lcedilla = 934, + Emacron = 938, + Gcedilla = 939, + Tslash = 940, + rcedilla = 947, + itilde = 949, + lcedilla = 950, + emacron = 954, + gcedilla = 955, + tslash = 956, + ENG = 957, + eng = 959, + Amacron = 960, + Iogonek = 967, + Eabovedot = 972, + Imacron = 975, + Ncedilla = 977, + Omacron = 978, + Kcedilla = 979, + Uogonek = 985, + Utilde = 989, + Umacron = 990, + amacron = 992, + iogonek = 999, + eabovedot = 1004, + imacron = 1007, + ncedilla = 1009, + omacron = 1010, + kcedilla = 1011, + uogonek = 1017, + utilde = 1021, + umacron = 1022, + overline = 1150, + kana_fullstop = 1185, + kana_openingbracket = 1186, + kana_closingbracket = 1187, + kana_comma = 1188, + kana_conjunctive = 1189, + kana_middledot = 1189, + kana_WO = 1190, + kana_a = 1191, + kana_i = 1192, + kana_u = 1193, + kana_e = 1194, + kana_o = 1195, + kana_ya = 1196, + kana_yu = 1197, + kana_yo = 1198, + kana_tsu = 1199, + kana_tu = 1199, + prolongedsound = 1200, + kana_A = 1201, + kana_I = 1202, + kana_U = 1203, + kana_E = 1204, + kana_O = 1205, + kana_KA = 1206, + kana_KI = 1207, + kana_KU = 1208, + kana_KE = 1209, + kana_KO = 1210, + kana_SA = 1211, + kana_SHI = 1212, + kana_SU = 1213, + kana_SE = 1214, + kana_SO = 1215, + kana_TA = 1216, + kana_CHI = 1217, + kana_TI = 1217, + kana_TSU = 1218, + kana_TU = 1218, + kana_TE = 1219, + kana_TO = 1220, + kana_NA = 1221, + kana_NI = 1222, + kana_NU = 1223, + kana_NE = 1224, + kana_NO = 1225, + kana_HA = 1226, + kana_HI = 1227, + kana_FU = 1228, + kana_HU = 1228, + kana_HE = 1229, + kana_HO = 1230, + kana_MA = 1231, + kana_MI = 1232, + kana_MU = 1233, + kana_ME = 1234, + kana_MO = 1235, + kana_YA = 1236, + kana_YU = 1237, + kana_YO = 1238, + kana_RA = 1239, + kana_RI = 1240, + kana_RU = 1241, + kana_RE = 1242, + kana_RO = 1243, + kana_WA = 1244, + kana_N = 1245, + voicedsound = 1246, + semivoicedsound = 1247, + Arabic_comma = 1452, + Arabic_semicolon = 1467, + Arabic_question_mark = 1471, + Arabic_hamza = 1473, + Arabic_maddaonalef = 1474, + Arabic_hamzaonalef = 1475, + Arabic_hamzaonwaw = 1476, + Arabic_hamzaunderalef = 1477, + Arabic_hamzaonyeh = 1478, + Arabic_alef = 1479, + Arabic_beh = 1480, + Arabic_tehmarbuta = 1481, + Arabic_teh = 1482, + Arabic_theh = 1483, + Arabic_jeem = 1484, + Arabic_hah = 1485, + Arabic_khah = 1486, + Arabic_dal = 1487, + Arabic_thal = 1488, + Arabic_ra = 1489, + Arabic_zain = 1490, + Arabic_seen = 1491, + Arabic_sheen = 1492, + Arabic_sad = 1493, + Arabic_dad = 1494, + Arabic_tah = 1495, + Arabic_zah = 1496, + Arabic_ain = 1497, + Arabic_ghain = 1498, + Arabic_tatweel = 1504, + Arabic_feh = 1505, + Arabic_qaf = 1506, + Arabic_kaf = 1507, + Arabic_lam = 1508, + Arabic_meem = 1509, + Arabic_noon = 1510, + Arabic_ha = 1511, + Arabic_heh = 1511, + Arabic_waw = 1512, + Arabic_alefmaksura = 1513, + Arabic_yeh = 1514, + Arabic_fathatan = 1515, + Arabic_dammatan = 1516, + Arabic_kasratan = 1517, + Arabic_fatha = 1518, + Arabic_damma = 1519, + Arabic_kasra = 1520, + Arabic_shadda = 1521, + Arabic_sukun = 1522, + Serbian_dje = 1697, + Macedonia_gje = 1698, + Cyrillic_io = 1699, + Ukrainian_ie = 1700, + Ukranian_je = 1700, + Macedonia_dse = 1701, + Ukrainian_i = 1702, + Ukranian_i = 1702, + Ukrainian_yi = 1703, + Ukranian_yi = 1703, + Cyrillic_je = 1704, + Serbian_je = 1704, + Cyrillic_lje = 1705, + Serbian_lje = 1705, + Cyrillic_nje = 1706, + Serbian_nje = 1706, + Serbian_tshe = 1707, + Macedonia_kje = 1708, + Byelorussian_shortu = 1710, + Cyrillic_dzhe = 1711, + Serbian_dze = 1711, + numerosign = 1712, + Serbian_DJE = 1713, + Macedonia_GJE = 1714, + Cyrillic_IO = 1715, + Ukrainian_IE = 1716, + Ukranian_JE = 1716, + Macedonia_DSE = 1717, + Ukrainian_I = 1718, + Ukranian_I = 1718, + Ukrainian_YI = 1719, + Ukranian_YI = 1719, + Cyrillic_JE = 1720, + Serbian_JE = 1720, + Cyrillic_LJE = 1721, + Serbian_LJE = 1721, + Cyrillic_NJE = 1722, + Serbian_NJE = 1722, + Serbian_TSHE = 1723, + Macedonia_KJE = 1724, + Byelorussian_SHORTU = 1726, + Cyrillic_DZHE = 1727, + Serbian_DZE = 1727, + Cyrillic_yu = 1728, + Cyrillic_a = 1729, + Cyrillic_be = 1730, + Cyrillic_tse = 1731, + Cyrillic_de = 1732, + Cyrillic_ie = 1733, + Cyrillic_ef = 1734, + Cyrillic_ghe = 1735, + Cyrillic_ha = 1736, + Cyrillic_i = 1737, + Cyrillic_shorti = 1738, + Cyrillic_ka = 1739, + Cyrillic_el = 1740, + Cyrillic_em = 1741, + Cyrillic_en = 1742, + Cyrillic_o = 1743, + Cyrillic_pe = 1744, + Cyrillic_ya = 1745, + Cyrillic_er = 1746, + Cyrillic_es = 1747, + Cyrillic_te = 1748, + Cyrillic_u = 1749, + Cyrillic_zhe = 1750, + Cyrillic_ve = 1751, + Cyrillic_softsign = 1752, + Cyrillic_yeru = 1753, + Cyrillic_ze = 1754, + Cyrillic_sha = 1755, + Cyrillic_e = 1756, + Cyrillic_shcha = 1757, + Cyrillic_che = 1758, + Cyrillic_hardsign = 1759, + Cyrillic_YU = 1760, + Cyrillic_A = 1761, + Cyrillic_BE = 1762, + Cyrillic_TSE = 1763, + Cyrillic_DE = 1764, + Cyrillic_IE = 1765, + Cyrillic_EF = 1766, + Cyrillic_GHE = 1767, + Cyrillic_HA = 1768, + Cyrillic_I = 1769, + Cyrillic_SHORTI = 1770, + Cyrillic_KA = 1771, + Cyrillic_EL = 1772, + Cyrillic_EM = 1773, + Cyrillic_EN = 1774, + Cyrillic_O = 1775, + Cyrillic_PE = 1776, + Cyrillic_YA = 1777, + Cyrillic_ER = 1778, + Cyrillic_ES = 1779, + Cyrillic_TE = 1780, + Cyrillic_U = 1781, + Cyrillic_ZHE = 1782, + Cyrillic_VE = 1783, + Cyrillic_SOFTSIGN = 1784, + Cyrillic_YERU = 1785, + Cyrillic_ZE = 1786, + Cyrillic_SHA = 1787, + Cyrillic_E = 1788, + Cyrillic_SHCHA = 1789, + Cyrillic_CHE = 1790, + Cyrillic_HARDSIGN = 1791, + Greek_ALPHAaccent = 1953, + Greek_EPSILONaccent = 1954, + Greek_ETAaccent = 1955, + Greek_IOTAaccent = 1956, + Greek_IOTAdiaeresis = 1957, + Greek_OMICRONaccent = 1959, + Greek_UPSILONaccent = 1960, + Greek_UPSILONdieresis = 1961, + Greek_OMEGAaccent = 1963, + Greek_accentdieresis = 1966, + Greek_horizbar = 1967, + Greek_alphaaccent = 1969, + Greek_epsilonaccent = 1970, + Greek_etaaccent = 1971, + Greek_iotaaccent = 1972, + Greek_iotadieresis = 1973, + Greek_iotaaccentdieresis = 1974, + Greek_omicronaccent = 1975, + Greek_upsilonaccent = 1976, + Greek_upsilondieresis = 1977, + Greek_upsilonaccentdieresis = 1978, + Greek_omegaaccent = 1979, + Greek_ALPHA = 1985, + Greek_BETA = 1986, + Greek_GAMMA = 1987, + Greek_DELTA = 1988, + Greek_EPSILON = 1989, + Greek_ZETA = 1990, + Greek_ETA = 1991, + Greek_THETA = 1992, + Greek_IOTA = 1993, + Greek_KAPPA = 1994, + Greek_LAMBDA = 1995, + Greek_LAMDA = 1995, + Greek_MU = 1996, + Greek_NU = 1997, + Greek_XI = 1998, + Greek_OMICRON = 1999, + Greek_PI = 2000, + Greek_RHO = 2001, + Greek_SIGMA = 2002, + Greek_TAU = 2004, + Greek_UPSILON = 2005, + Greek_PHI = 2006, + Greek_CHI = 2007, + Greek_PSI = 2008, + Greek_OMEGA = 2009, + Greek_alpha = 2017, + Greek_beta = 2018, + Greek_gamma = 2019, + Greek_delta = 2020, + Greek_epsilon = 2021, + Greek_zeta = 2022, + Greek_eta = 2023, + Greek_theta = 2024, + Greek_iota = 2025, + Greek_kappa = 2026, + Greek_lambda = 2027, + Greek_lamda = 2027, + Greek_mu = 2028, + Greek_nu = 2029, + Greek_xi = 2030, + Greek_omicron = 2031, + Greek_pi = 2032, + Greek_rho = 2033, + Greek_sigma = 2034, + Greek_finalsmallsigma = 2035, + Greek_tau = 2036, + Greek_upsilon = 2037, + Greek_phi = 2038, + Greek_chi = 2039, + Greek_psi = 2040, + Greek_omega = 2041, + leftradical = 2209, + topleftradical = 2210, + horizconnector = 2211, + topintegral = 2212, + botintegral = 2213, + vertconnector = 2214, + topleftsqbracket = 2215, + botleftsqbracket = 2216, + toprightsqbracket = 2217, + botrightsqbracket = 2218, + topleftparens = 2219, + botleftparens = 2220, + toprightparens = 2221, + botrightparens = 2222, + leftmiddlecurlybrace = 2223, + rightmiddlecurlybrace = 2224, + topleftsummation = 2225, + botleftsummation = 2226, + topvertsummationconnector = 2227, + botvertsummationconnector = 2228, + toprightsummation = 2229, + botrightsummation = 2230, + rightmiddlesummation = 2231, + lessthanequal = 2236, + notequal = 2237, + greaterthanequal = 2238, + integral = 2239, + therefore = 2240, + variation = 2241, + infinity = 2242, + nabla = 2245, + approximate = 2248, + similarequal = 2249, + ifonlyif = 2253, + implies = 2254, + identical = 2255, + radical = 2262, + includedin = 2266, + includes = 2267, + intersection = 2268, + union = 2269, + logicaland = 2270, + logicalor = 2271, + partialderivative = 2287, + function = 2294, + leftarrow = 2299, + uparrow = 2300, + rightarrow = 2301, + downarrow = 2302, + blank = 2527, + soliddiamond = 2528, + checkerboard = 2529, + ht = 2530, + ff = 2531, + cr = 2532, + lf = 2533, + nl = 2536, + vt = 2537, + lowrightcorner = 2538, + uprightcorner = 2539, + upleftcorner = 2540, + lowleftcorner = 2541, + crossinglines = 2542, + horizlinescan1 = 2543, + horizlinescan3 = 2544, + horizlinescan5 = 2545, + horizlinescan7 = 2546, + horizlinescan9 = 2547, + leftt = 2548, + rightt = 2549, + bott = 2550, + topt = 2551, + vertbar = 2552, + emspace = 2721, + enspace = 2722, + em3space = 2723, + em4space = 2724, + digitspace = 2725, + punctspace = 2726, + thinspace = 2727, + hairspace = 2728, + emdash = 2729, + endash = 2730, + signifblank = 2732, + ellipsis = 2734, + doubbaselinedot = 2735, + onethird = 2736, + twothirds = 2737, + onefifth = 2738, + twofifths = 2739, + threefifths = 2740, + fourfifths = 2741, + onesixth = 2742, + fivesixths = 2743, + careof = 2744, + figdash = 2747, + leftanglebracket = 2748, + decimalpoint = 2749, + rightanglebracket = 2750, + marker = 2751, + oneeighth = 2755, + threeeighths = 2756, + fiveeighths = 2757, + seveneighths = 2758, + trademark = 2761, + signaturemark = 2762, + trademarkincircle = 2763, + leftopentriangle = 2764, + rightopentriangle = 2765, + emopencircle = 2766, + emopenrectangle = 2767, + leftsinglequotemark = 2768, + rightsinglequotemark = 2769, + leftdoublequotemark = 2770, + rightdoublequotemark = 2771, + prescription = 2772, + minutes = 2774, + seconds = 2775, + latincross = 2777, + hexagram = 2778, + filledrectbullet = 2779, + filledlefttribullet = 2780, + filledrighttribullet = 2781, + emfilledcircle = 2782, + emfilledrect = 2783, + enopencircbullet = 2784, + enopensquarebullet = 2785, + openrectbullet = 2786, + opentribulletup = 2787, + opentribulletdown = 2788, + openstar = 2789, + enfilledcircbullet = 2790, + enfilledsqbullet = 2791, + filledtribulletup = 2792, + filledtribulletdown = 2793, + leftpointer = 2794, + rightpointer = 2795, + club = 2796, + diamond = 2797, + heart = 2798, + maltesecross = 2800, + dagger = 2801, + doubledagger = 2802, + checkmark = 2803, + ballotcross = 2804, + musicalsharp = 2805, + musicalflat = 2806, + malesymbol = 2807, + femalesymbol = 2808, + telephone = 2809, + telephonerecorder = 2810, + phonographcopyright = 2811, + caret = 2812, + singlelowquotemark = 2813, + doublelowquotemark = 2814, + cursor = 2815, + leftcaret = 2979, + rightcaret = 2982, + downcaret = 2984, + upcaret = 2985, + overbar = 3008, + downtack = 3010, + upshoe = 3011, + downstile = 3012, + underbar = 3014, + jot = 3018, + quad = 3020, + uptack = 3022, + circle = 3023, + upstile = 3027, + downshoe = 3030, + rightshoe = 3032, + leftshoe = 3034, + lefttack = 3036, + righttack = 3068, + hebrew_doublelowline = 3295, + hebrew_aleph = 3296, + hebrew_bet = 3297, + hebrew_beth = 3297, + hebrew_gimel = 3298, + hebrew_gimmel = 3298, + hebrew_dalet = 3299, + hebrew_daleth = 3299, + hebrew_he = 3300, + hebrew_waw = 3301, + hebrew_zain = 3302, + hebrew_zayin = 3302, + hebrew_chet = 3303, + hebrew_het = 3303, + hebrew_tet = 3304, + hebrew_teth = 3304, + hebrew_yod = 3305, + hebrew_finalkaph = 3306, + hebrew_kaph = 3307, + hebrew_lamed = 3308, + hebrew_finalmem = 3309, + hebrew_mem = 3310, + hebrew_finalnun = 3311, + hebrew_nun = 3312, + hebrew_samech = 3313, + hebrew_samekh = 3313, + hebrew_ayin = 3314, + hebrew_finalpe = 3315, + hebrew_pe = 3316, + hebrew_finalzade = 3317, + hebrew_finalzadi = 3317, + hebrew_zade = 3318, + hebrew_zadi = 3318, + hebrew_kuf = 3319, + hebrew_qoph = 3319, + hebrew_resh = 3320, + hebrew_shin = 3321, + hebrew_taf = 3322, + hebrew_taw = 3322, + Thai_kokai = 3489, + Thai_khokhai = 3490, + Thai_khokhuat = 3491, + Thai_khokhwai = 3492, + Thai_khokhon = 3493, + Thai_khorakhang = 3494, + Thai_ngongu = 3495, + Thai_chochan = 3496, + Thai_choching = 3497, + Thai_chochang = 3498, + Thai_soso = 3499, + Thai_chochoe = 3500, + Thai_yoying = 3501, + Thai_dochada = 3502, + Thai_topatak = 3503, + Thai_thothan = 3504, + Thai_thonangmontho = 3505, + Thai_thophuthao = 3506, + Thai_nonen = 3507, + Thai_dodek = 3508, + Thai_totao = 3509, + Thai_thothung = 3510, + Thai_thothahan = 3511, + Thai_thothong = 3512, + Thai_nonu = 3513, + Thai_bobaimai = 3514, + Thai_popla = 3515, + Thai_phophung = 3516, + Thai_fofa = 3517, + Thai_phophan = 3518, + Thai_fofan = 3519, + Thai_phosamphao = 3520, + Thai_moma = 3521, + Thai_yoyak = 3522, + Thai_rorua = 3523, + Thai_ru = 3524, + Thai_loling = 3525, + Thai_lu = 3526, + Thai_wowaen = 3527, + Thai_sosala = 3528, + Thai_sorusi = 3529, + Thai_sosua = 3530, + Thai_hohip = 3531, + Thai_lochula = 3532, + Thai_oang = 3533, + Thai_honokhuk = 3534, + Thai_paiyannoi = 3535, + Thai_saraa = 3536, + Thai_maihanakat = 3537, + Thai_saraaa = 3538, + Thai_saraam = 3539, + Thai_sarai = 3540, + Thai_saraii = 3541, + Thai_saraue = 3542, + Thai_sarauee = 3543, + Thai_sarau = 3544, + Thai_sarauu = 3545, + Thai_phinthu = 3546, + Thai_maihanakat_maitho = 3550, + Thai_baht = 3551, + Thai_sarae = 3552, + Thai_saraae = 3553, + Thai_sarao = 3554, + Thai_saraaimaimuan = 3555, + Thai_saraaimaimalai = 3556, + Thai_lakkhangyao = 3557, + Thai_maiyamok = 3558, + Thai_maitaikhu = 3559, + Thai_maiek = 3560, + Thai_maitho = 3561, + Thai_maitri = 3562, + Thai_maichattawa = 3563, + Thai_thanthakhat = 3564, + Thai_nikhahit = 3565, + Thai_leksun = 3568, + Thai_leknung = 3569, + Thai_leksong = 3570, + Thai_leksam = 3571, + Thai_leksi = 3572, + Thai_lekha = 3573, + Thai_lekhok = 3574, + Thai_lekchet = 3575, + Thai_lekpaet = 3576, + Thai_lekkao = 3577, + Hangul_Kiyeog = 3745, + Hangul_SsangKiyeog = 3746, + Hangul_KiyeogSios = 3747, + Hangul_Nieun = 3748, + Hangul_NieunJieuj = 3749, + Hangul_NieunHieuh = 3750, + Hangul_Dikeud = 3751, + Hangul_SsangDikeud = 3752, + Hangul_Rieul = 3753, + Hangul_RieulKiyeog = 3754, + Hangul_RieulMieum = 3755, + Hangul_RieulPieub = 3756, + Hangul_RieulSios = 3757, + Hangul_RieulTieut = 3758, + Hangul_RieulPhieuf = 3759, + Hangul_RieulHieuh = 3760, + Hangul_Mieum = 3761, + Hangul_Pieub = 3762, + Hangul_SsangPieub = 3763, + Hangul_PieubSios = 3764, + Hangul_Sios = 3765, + Hangul_SsangSios = 3766, + Hangul_Ieung = 3767, + Hangul_Jieuj = 3768, + Hangul_SsangJieuj = 3769, + Hangul_Cieuc = 3770, + Hangul_Khieuq = 3771, + Hangul_Tieut = 3772, + Hangul_Phieuf = 3773, + Hangul_Hieuh = 3774, + Hangul_A = 3775, + Hangul_AE = 3776, + Hangul_YA = 3777, + Hangul_YAE = 3778, + Hangul_EO = 3779, + Hangul_E = 3780, + Hangul_YEO = 3781, + Hangul_YE = 3782, + Hangul_O = 3783, + Hangul_WA = 3784, + Hangul_WAE = 3785, + Hangul_OE = 3786, + Hangul_YO = 3787, + Hangul_U = 3788, + Hangul_WEO = 3789, + Hangul_WE = 3790, + Hangul_WI = 3791, + Hangul_YU = 3792, + Hangul_EU = 3793, + Hangul_YI = 3794, + Hangul_I = 3795, + Hangul_J_Kiyeog = 3796, + Hangul_J_SsangKiyeog = 3797, + Hangul_J_KiyeogSios = 3798, + Hangul_J_Nieun = 3799, + Hangul_J_NieunJieuj = 3800, + Hangul_J_NieunHieuh = 3801, + Hangul_J_Dikeud = 3802, + Hangul_J_Rieul = 3803, + Hangul_J_RieulKiyeog = 3804, + Hangul_J_RieulMieum = 3805, + Hangul_J_RieulPieub = 3806, + Hangul_J_RieulSios = 3807, + Hangul_J_RieulTieut = 3808, + Hangul_J_RieulPhieuf = 3809, + Hangul_J_RieulHieuh = 3810, + Hangul_J_Mieum = 3811, + Hangul_J_Pieub = 3812, + Hangul_J_PieubSios = 3813, + Hangul_J_Sios = 3814, + Hangul_J_SsangSios = 3815, + Hangul_J_Ieung = 3816, + Hangul_J_Jieuj = 3817, + Hangul_J_Cieuc = 3818, + Hangul_J_Khieuq = 3819, + Hangul_J_Tieut = 3820, + Hangul_J_Phieuf = 3821, + Hangul_J_Hieuh = 3822, + Hangul_RieulYeorinHieuh = 3823, + Hangul_SunkyeongeumMieum = 3824, + Hangul_SunkyeongeumPieub = 3825, + Hangul_PanSios = 3826, + Hangul_KkogjiDalrinIeung = 3827, + Hangul_SunkyeongeumPhieuf = 3828, + Hangul_YeorinHieuh = 3829, + Hangul_AraeA = 3830, + Hangul_AraeAE = 3831, + Hangul_J_PanSios = 3832, + Hangul_J_KkogjiDalrinIeung = 3833, + Hangul_J_YeorinHieuh = 3834, + Korean_Won = 3839, + OE = 5052, + oe = 5053, + Ydiaeresis = 5054, + EcuSign = 8352, + ColonSign = 8353, + CruzeiroSign = 8354, + FFrancSign = 8355, + LiraSign = 8356, + MillSign = 8357, + NairaSign = 8358, + PesetaSign = 8359, + RupeeSign = 8360, + WonSign = 8361, + NewSheqelSign = 8362, + DongSign = 8363, + EuroSign = 8364, + Key_3270_Duplicate = 64769, + Key_3270_FieldMark = 64770, + Key_3270_Right2 = 64771, + Key_3270_Left2 = 64772, + Key_3270_BackTab = 64773, + Key_3270_EraseEOF = 64774, + Key_3270_EraseInput = 64775, + Key_3270_Reset = 64776, + Key_3270_Quit = 64777, + Key_3270_PA1 = 64778, + Key_3270_PA2 = 64779, + Key_3270_PA3 = 64780, + Key_3270_Test = 64781, + Key_3270_Attn = 64782, + Key_3270_CursorBlink = 64783, + Key_3270_AltCursor = 64784, + Key_3270_KeyClick = 64785, + Key_3270_Jump = 64786, + Key_3270_Ident = 64787, + Key_3270_Rule = 64788, + Key_3270_Copy = 64789, + Key_3270_Play = 64790, + Key_3270_Setup = 64791, + Key_3270_Record = 64792, + Key_3270_ChangeScreen = 64793, + Key_3270_DeleteWord = 64794, + Key_3270_ExSelect = 64795, + Key_3270_CursorSelect = 64796, + Key_3270_PrintScreen = 64797, + Key_3270_Enter = 64798, + ISO_Lock = 65025, + ISO_Level2_Latch = 65026, + ISO_Level3_Shift = 65027, + ISO_Level3_Latch = 65028, + ISO_Level3_Lock = 65029, + ISO_Group_Latch = 65030, + ISO_Group_Lock = 65031, + ISO_Next_Group = 65032, + ISO_Next_Group_Lock = 65033, + ISO_Prev_Group = 65034, + ISO_Prev_Group_Lock = 65035, + ISO_First_Group = 65036, + ISO_First_Group_Lock = 65037, + ISO_Last_Group = 65038, + ISO_Last_Group_Lock = 65039, + ISO_Left_Tab = 65056, + ISO_Move_Line_Up = 65057, + ISO_Move_Line_Down = 65058, + ISO_Partial_Line_Up = 65059, + ISO_Partial_Line_Down = 65060, + ISO_Partial_Space_Left = 65061, + ISO_Partial_Space_Right = 65062, + ISO_Set_Margin_Left = 65063, + ISO_Set_Margin_Right = 65064, + ISO_Release_Margin_Left = 65065, + ISO_Release_Margin_Right = 65066, + ISO_Release_Both_Margins = 65067, + ISO_Fast_Cursor_Left = 65068, + ISO_Fast_Cursor_Right = 65069, + ISO_Fast_Cursor_Up = 65070, + ISO_Fast_Cursor_Down = 65071, + ISO_Continuous_Underline = 65072, + ISO_Discontinuous_Underline = 65073, + ISO_Emphasize = 65074, + ISO_Center_Object = 65075, + ISO_Enter = 65076, + dead_grave = 65104, + dead_acute = 65105, + dead_circumflex = 65106, + dead_tilde = 65107, + dead_macron = 65108, + dead_breve = 65109, + dead_abovedot = 65110, + dead_diaeresis = 65111, + dead_abovering = 65112, + dead_doubleacute = 65113, + dead_caron = 65114, + dead_cedilla = 65115, + dead_ogonek = 65116, + dead_iota = 65117, + dead_voiced_sound = 65118, + dead_semivoiced_sound = 65119, + dead_belowdot = 65120, + AccessX_Enable = 65136, + AccessX_Feedback_Enable = 65137, + RepeatKeys_Enable = 65138, + SlowKeys_Enable = 65139, + BounceKeys_Enable = 65140, + StickyKeys_Enable = 65141, + MouseKeys_Enable = 65142, + MouseKeys_Accel_Enable = 65143, + Overlay1_Enable = 65144, + Overlay2_Enable = 65145, + AudibleBell_Enable = 65146, + First_Virtual_Screen = 65232, + Prev_Virtual_Screen = 65233, + Next_Virtual_Screen = 65234, + Last_Virtual_Screen = 65236, + Terminate_Server = 65237, + Pointer_Left = 65248, + Pointer_Right = 65249, + Pointer_Up = 65250, + Pointer_Down = 65251, + Pointer_UpLeft = 65252, + Pointer_UpRight = 65253, + Pointer_DownLeft = 65254, + Pointer_DownRight = 65255, + Pointer_Button_Dflt = 65256, + Pointer_Button1 = 65257, + Pointer_Button2 = 65258, + Pointer_Button3 = 65259, + Pointer_Button4 = 65260, + Pointer_Button5 = 65261, + Pointer_DblClick_Dflt = 65262, + Pointer_DblClick1 = 65263, + Pointer_DblClick2 = 65264, + Pointer_DblClick3 = 65265, + Pointer_DblClick4 = 65266, + Pointer_DblClick5 = 65267, + Pointer_Drag_Dflt = 65268, + Pointer_Drag1 = 65269, + Pointer_Drag2 = 65270, + Pointer_Drag3 = 65271, + Pointer_Drag4 = 65272, + Pointer_EnableKeys = 65273, + Pointer_Accelerate = 65274, + Pointer_DfltBtnNext = 65275, + Pointer_DfltBtnPrev = 65276, + Pointer_Drag5 = 65277, + BackSpace = 65288, + Tab = 65289, + Linefeed = 65290, + Clear = 65291, + Return = 65293, + Pause = 65299, + Scroll_Lock = 65300, + Sys_Req = 65301, + Escape = 65307, + Multi_key = 65312, + Kanji = 65313, + Muhenkan = 65314, + Henkan = 65315, + Henkan_Mode = 65315, + Romaji = 65316, + Hiragana = 65317, + Katakana = 65318, + Hiragana_Katakana = 65319, + Zenkaku = 65320, + Hankaku = 65321, + Zenkaku_Hankaku = 65322, + Touroku = 65323, + Massyo = 65324, + Kana_Lock = 65325, + Kana_Shift = 65326, + Eisu_Shift = 65327, + Eisu_toggle = 65328, + Hangul = 65329, + Hangul_Start = 65330, + Hangul_End = 65331, + Hangul_Hanja = 65332, + Hangul_Jamo = 65333, + Hangul_Romaja = 65334, + Codeinput = 65335, + Hangul_Codeinput = 65335, + Kanji_Bangou = 65335, + Hangul_Jeonja = 65336, + Hangul_Banja = 65337, + Hangul_PreHanja = 65338, + Hangul_PostHanja = 65339, + Hangul_SingleCandidate = 65340, + SingleCandidate = 65340, + Hangul_MultipleCandidate = 65341, + MultipleCandidate = 65341, + Zen_Koho = 65341, + Hangul_PreviousCandidate = 65342, + Mae_Koho = 65342, + PreviousCandidate = 65342, + Hangul_Special = 65343, + Home = 65360, + Left = 65361, + Up = 65362, + Right = 65363, + Down = 65364, + Page_Up = 65365, + Prior = 65365, + Next = 65366, + Page_Down = 65366, + End = 65367, + Begin = 65368, + Select = 65376, + Print = 65377, + Execute = 65378, + Insert = 65379, + Undo = 65381, + Redo = 65382, + Menu = 65383, + Find = 65384, + Cancel = 65385, + Help = 65386, + Break = 65387, + Arabic_switch = 65406, + Greek_switch = 65406, + Hangul_switch = 65406, + Hebrew_switch = 65406, + ISO_Group_Shift = 65406, + Mode_switch = 65406, + kana_switch = 65406, + script_switch = 65406, + Num_Lock = 65407, + KP_Space = 65408, + KP_Tab = 65417, + KP_Enter = 65421, + KP_F1 = 65425, + KP_F2 = 65426, + KP_F3 = 65427, + KP_F4 = 65428, + KP_Home = 65429, + KP_Left = 65430, + KP_Up = 65431, + KP_Right = 65432, + KP_Down = 65433, + KP_Page_Up = 65434, + KP_Prior = 65434, + KP_Next = 65435, + KP_Page_Down = 65435, + KP_End = 65436, + KP_Begin = 65437, + KP_Insert = 65438, + KP_Delete = 65439, + KP_Multiply = 65450, + KP_Add = 65451, + KP_Separator = 65452, + KP_Subtract = 65453, + KP_Decimal = 65454, + KP_Divide = 65455, + KP_0 = 65456, + KP_1 = 65457, + KP_2 = 65458, + KP_3 = 65459, + KP_4 = 65460, + KP_5 = 65461, + KP_6 = 65462, + KP_7 = 65463, + KP_8 = 65464, + KP_9 = 65465, + KP_Equal = 65469, + F1 = 65470, + F2 = 65471, + F3 = 65472, + F4 = 65473, + F5 = 65474, + F6 = 65475, + F7 = 65476, + F8 = 65477, + F9 = 65478, + F10 = 65479, + F11 = 65480, + L1 = 65480, + F12 = 65481, + L2 = 65481, + F13 = 65482, + L3 = 65482, + F14 = 65483, + L4 = 65483, + F15 = 65484, + L5 = 65484, + F16 = 65485, + L6 = 65485, + F17 = 65486, + L7 = 65486, + F18 = 65487, + L8 = 65487, + F19 = 65488, + L9 = 65488, + F20 = 65489, + L10 = 65489, + F21 = 65490, + R1 = 65490, + F22 = 65491, + R2 = 65491, + F23 = 65492, + R3 = 65492, + F24 = 65493, + R4 = 65493, + F25 = 65494, + R5 = 65494, + F26 = 65495, + R6 = 65495, + F27 = 65496, + R7 = 65496, + F28 = 65497, + R8 = 65497, + F29 = 65498, + R9 = 65498, + F30 = 65499, + R10 = 65499, + F31 = 65500, + R11 = 65500, + F32 = 65501, + R12 = 65501, + F33 = 65502, + R13 = 65502, + F34 = 65503, + R14 = 65503, + F35 = 65504, + R15 = 65504, + Shift_L = 65505, + Shift_R = 65506, + Control_L = 65507, + Control_R = 65508, + Caps_Lock = 65509, + Shift_Lock = 65510, + Meta_L = 65511, + Meta_R = 65512, + Alt_L = 65513, + Alt_R = 65514, + Super_L = 65515, + Super_R = 65516, + Hyper_L = 65517, + Hyper_R = 65518, + Delete = 65535, + VoidSymbol = 16777215, + } +} diff --git a/src/Gtk/Avalonia.Gtk3/Interop/Native.cs b/src/Gtk/Avalonia.Gtk3/Interop/Native.cs index aa3e73f7c4..0508dcadc1 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/Native.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/Native.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; +using Avalonia.Controls; using gint8 = System.Byte; using gint16 = System.Int16; using gint32 = System.Int32; @@ -110,8 +111,33 @@ namespace Avalonia.Gtk3.Interop [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] public delegate void gtk_widget_queue_draw_area(IntPtr gtkWindow, int x, int y, int width, int height); + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] + public delegate IntPtr gtk_im_multicontext_new(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] + public delegate IntPtr gtk_im_context_set_client_window(IntPtr context, IntPtr window); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] + public delegate bool gtk_im_context_filter_keypress(IntPtr context, IntPtr ev); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gtk)] + public delegate void gtk_widget_activate(IntPtr widget); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)] + public delegate IntPtr gdk_screen_get_root_window(IntPtr screen); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)] + public delegate IntPtr gdk_window_get_pointer(IntPtr raw, out int x, out int y, out int mask); + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)] public delegate void gdk_window_invalidate_rect(IntPtr window, ref GdkRectangle rect, bool invalidate_children); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)] + public delegate void gdk_window_begin_move_drag(IntPtr window, gint button, gint root_x, gint root_y, guint32 timestamp); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gdk)] + public delegate void gdk_window_begin_resize_drag(IntPtr window, WindowEdge edge, gint button, gint root_x, gint root_y, guint32 timestamp); + [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gobject)] public delegate ulong g_signal_connect_object(IntPtr instance, Utf8Buffer signal, IntPtr handler, IntPtr userData, int flags); [UnmanagedFunctionPointer(CallingConvention.Cdecl), GtkImport(GtkDll.Gobject)] @@ -121,9 +147,14 @@ namespace Avalonia.Gtk3.Interop [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate bool signal_widget_draw(IntPtr gtkWidget, IntPtr cairoContext, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool signal_generic(IntPtr gtkWidget, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate bool signal_onevent(IntPtr gtkWidget, IntPtr ev, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool signal_commit(IntPtr gtkWidget, IntPtr utf8string, IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate bool timeout_callback(IntPtr data); @@ -153,9 +184,20 @@ namespace Avalonia.Gtk3.Interop public static D.gtk_widget_set_events GtkWidgetSetEvents; public static D.gdk_window_invalidate_rect GdkWindowInvalidateRect; public static D.gtk_widget_queue_draw_area GtkWidgetQueueDrawArea; + public static D.gtk_widget_activate GtkWidgetActivate; + + + public static D.gtk_im_multicontext_new GtkImMulticontextNew; + public static D.gtk_im_context_filter_keypress GtkImContextFilterKeypress; + public static D.gtk_im_context_set_client_window GtkImContextSetClientWindow; + public static D.gdk_screen_get_height GdkScreenGetHeight; public static D.gdk_screen_get_width GdkScreenGetWidth; + public static D.gdk_screen_get_root_window GdkScreenGetRootWindow; public static D.gdk_window_get_origin GdkWindowGetOrigin; + public static D.gdk_window_get_pointer GdkWindowGetPointer; + public static D.gdk_window_begin_move_drag GdkWindowBeginMoveDrag; + public static D.gdk_window_begin_resize_drag GdkWindowBeginResizeDrag; public static D.cairo_image_surface_create CairoImageSurfaceCreate; public static D.cairo_image_surface_get_data CairoImageSurfaceGetData; @@ -311,4 +353,43 @@ namespace Avalonia.Gtk3.Interop public gdouble delta_x; public gdouble delta_y; } + + [StructLayout(LayoutKind.Sequential)] + unsafe struct GdkEventWindowState + { + public GdkEventType type; + public IntPtr window; + gint8 send_event; + public GdkWindowState changed_mask; + public GdkWindowState new_window_state; + } + + unsafe struct GdkEventKey + { + public GdkEventType type; + public IntPtr window; + public gint8 send_event; + public guint32 time; + public guint state; + public guint keyval; + public gint length; + public IntPtr pstring; + public guint16 hardware_keycode; + public byte group; + public guint is_modifier; + } + + [Flags] + public enum GdkWindowState + { + Withdrawn = 1, + Iconified = 2, + Maximized = 4, + Sticky = 8, + Fullscreen = 16, + Above = 32, + Below = 64, + Focused = 128, + Ttiled = 256 + } } diff --git a/src/Gtk/Avalonia.Gtk3/README.md b/src/Gtk/Avalonia.Gtk3/README.md index 7f117d24b3..ea853bde75 100644 --- a/src/Gtk/Avalonia.Gtk3/README.md +++ b/src/Gtk/Avalonia.Gtk3/README.md @@ -3,7 +3,6 @@ P/Invoke based GTK3 backend Code is EXPERIMENTAL at this point. It also needs Direct2D/Skia for rendering. -Windows GTK3 binaries aren't included in the repo, you need to download them from http://www.tarnyko.net/repo/gtk3_build_system/gtk+-bundle_3.4.2-20130513_win32.zip -Then you need to extract them somewhere and add `bin` directory to PATH. Support for specifying exact path to binaries will be implemented later. +Windows GTK3 binaries aren't included in the repo, you need to download them from https://sourceforge.net/projects/gtk3win/ On Linux it should work out of the box with system-provided GTK3. On OSX you should be able to wire GTK3 using DYLD_LIBRARY_PATH environment variable. \ No newline at end of file diff --git a/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs b/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs index 4d5509f4f7..aa0044328e 100644 --- a/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs +++ b/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Text; using Avalonia.Controls; using Avalonia.Gtk3.Interop; using Avalonia.Input; @@ -13,26 +15,33 @@ namespace Avalonia.Gtk3 { protected readonly IntPtr GtkWidget; private IInputRoot _inputRoot; + private readonly IntPtr _imContext; private readonly FramebufferManager _framebuffer; - protected readonly List _disposables = new List(); + protected readonly List Disposables = new List(); + private Size _lastSize; + private Point _lastPosition; + private uint _lastKbdEvent; public TopLevelImpl(IntPtr gtkWidget) { GtkWidget = gtkWidget; _framebuffer = new FramebufferManager(this); + _imContext = Native.GtkImMulticontextNew(); Native.GtkWidgetSetEvents(gtkWidget, uint.MaxValue); - Native.GtkWidgetRealize(gtkWidget); + Disposables.Add(Signal.Connect(_imContext, "commit", OnCommit)); Connect("draw", OnDraw); - Connect("configure-event", OnConfigured); - Connect("button-press-event", OnButton); - Connect("button-release-event", OnButton); - Connect("motion-notify-event", OnMotion); - Connect("scroll-event", OnScroll); + Connect("realize", OnRealized); + ConnectEvent("configure-event", OnConfigured); + ConnectEvent("button-press-event", OnButton); + ConnectEvent("button-release-event", OnButton); + ConnectEvent("motion-notify-event", OnMotion); + ConnectEvent("scroll-event", OnScroll); + ConnectEvent("window-state-event", OnStateChanged); + ConnectEvent("key-press-event", OnKeyEvent); + ConnectEvent("key-release-event", OnKeyEvent); + Native.GtkWidgetRealize(gtkWidget); } - private Size _lastSize; - private Point _lastPosition; - private bool OnConfigured(IntPtr gtkwidget, IntPtr ev, IntPtr userdata) { var size = ClientSize; @@ -51,6 +60,11 @@ namespace Avalonia.Gtk3 return false; } + private bool OnRealized(IntPtr gtkwidget, IntPtr userdata) + { + Native.GtkImContextSetClientWindow(_imContext, Native.GtkWidgetGetWindow(GtkWidget)); + return false; + } private static InputModifiers GetModifierKeys(GdkModifierType state) { @@ -89,6 +103,19 @@ namespace Avalonia.Gtk3 return false; } + private unsafe bool OnStateChanged(IntPtr w, IntPtr pev, IntPtr userData) + { + var ev = (GdkEventWindowState*) pev; + if (ev->changed_mask.HasFlag(GdkWindowState.Focused)) + { + if(ev->new_window_state.HasFlag(GdkWindowState.Focused)) + Activated?.Invoke(); + else + Deactivated?.Invoke(); + } + return true; + } + private unsafe bool OnMotion(IntPtr w, IntPtr ev, IntPtr userdata) { var evnt = (GdkEventMotion*)ev; @@ -108,7 +135,7 @@ namespace Avalonia.Gtk3 { var evnt = (GdkEventScroll*)ev; var delta = new Vector(); - var step = (double) 1; + const double step = (double) 1; if (evnt->direction == GdkScrollDirection.Down) delta = new Vector(0, -step); else if (evnt->direction == GdkScrollDirection.Up) @@ -126,7 +153,36 @@ namespace Avalonia.Gtk3 return false; } - void Connect(string name, T handler) => _disposables.Add(Signal.Connect(GtkWidget, name, handler)); + private unsafe bool OnKeyEvent(IntPtr w, IntPtr pev, IntPtr userData) + { + var evnt = (GdkEventKey*) pev; + _lastKbdEvent = evnt->time; + if (Native.GtkImContextFilterKeypress(_imContext, pev)) + return true; + var e = new RawKeyEventArgs( + Gtk3Platform.Keyboard, + evnt->time, + evnt->type == GdkEventType.KeyPress ? RawKeyEventType.KeyDown : RawKeyEventType.KeyUp, + Avalonia.Gtk.Common.KeyTransform.ConvertKey((GdkKey)evnt->keyval), GetModifierKeys((GdkModifierType)evnt->state)); + Input(e); + return true; + } + + private unsafe bool OnCommit(IntPtr gtkwidget, IntPtr utf8string, IntPtr userdata) + { + var pstr = (byte*)utf8string; + int len; + for (len = 0; pstr[len] != 0; len++) ; + var bytes = new byte[len]; + Marshal.Copy(utf8string, bytes, 0, len); + + Input(new RawTextInputEventArgs(Gtk3Platform.Keyboard, _lastKbdEvent, Encoding.UTF8.GetString(bytes, 0, len))); + return true; + } + + void ConnectEvent(string name, Native.D.signal_onevent handler) + => Disposables.Add(Signal.Connect(GtkWidget, name, handler)); + void Connect(string name, T handler) => Disposables.Add(Signal.Connect(GtkWidget, name, handler)); internal IntPtr CurrentCairoContext { get; private set; } @@ -140,9 +196,9 @@ namespace Avalonia.Gtk3 public void Dispose() { - foreach(var d in _disposables) + foreach(var d in Disposables) d.Dispose(); - _disposables.Clear(); + Disposables.Clear(); //TODO } @@ -161,19 +217,16 @@ namespace Avalonia.Gtk3 string IPlatformHandle.HandleDescriptor => "HWND"; - public Action Activated { get; set; } //TODO + public Action Activated { get; set; } public Action Closed { get; set; } //TODO - public Action Deactivated { get; set; } //TODO - public Action Input { get; set; } //TODO + public Action Deactivated { get; set; } + public Action Input { get; set; } public Action Paint { get; set; } public Action Resized { get; set; } public Action ScalingChanged { get; set; } //TODO public Action PositionChanged { get; set; } - public void Activate() - { - throw new NotImplementedException(); - } + public void Activate() => Native.GtkWidgetActivate(GtkWidget); public void Invalidate(Rect rect) { @@ -206,14 +259,25 @@ namespace Avalonia.Gtk3 public void Hide() => Native.GtkWidgetHide(GtkWidget); + void GetGlobalPointer(out int x, out int y) + { + int mask; + Native.GdkWindowGetPointer(Native.GdkScreenGetRootWindow(Native.GtkWidgetGetScreen(GtkWidget)), + out x, out y, out mask); + } + public void BeginMoveDrag() { - //STUB + int x, y; + GetGlobalPointer(out x, out y); + Native.GdkWindowBeginMoveDrag(Native.GtkWidgetGetWindow(GtkWidget), 1, x, y, 0); } public void BeginResizeDrag(WindowEdge edge) { - //STUB + int x, y; + GetGlobalPointer(out x, out y); + Native.GdkWindowBeginResizeDrag(Native.GtkWidgetGetWindow(GtkWidget), edge, 1, x, y, 0); }