2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
23 /// It inherits System.EventArgs.
24 /// The EcoreKeyEventArgs is a EventArgs to record Ecore event's key name and key code.
26 public class EcoreKeyEventArgs : EventArgs
29 /// Gets the KeyName property.The return type is string.
31 public string KeyName { get; private set; }
33 /// Gets the KeyCode property.The return type is int.
35 public int KeyCode { get; private set; }
38 /// Creates and initializes a new instance of the EcoreKeyEventArgs class.
40 /// <param name="data">data</param>
41 /// <param name="type">type</param>
42 /// <param name="info">information </param>
43 /// <returns>new instance of the EcoreKeyEventArgs class</returns>
44 public static EcoreKeyEventArgs Create(IntPtr data, EcoreEventType type, IntPtr info)
46 var evt = Marshal.PtrToStructure<EcoreEventKey>(info);
47 return new EcoreKeyEventArgs { KeyName = evt.keyname, KeyCode = (int)evt.keycode };
50 [StructLayout(LayoutKind.Sequential)]
53 public string keyname;
56 public string compose;
58 public IntPtr root_window;
59 public IntPtr event_window;
60 public uint timestamp;
61 public uint modifiers;
62 public int same_screen;