Пример #1
0
            /// <summary>
            /// Get mono's internal display handle to the X server
            /// </summary>
            public static IntPtr MonoGetDisplayHandle()
            {
                if (_displayHandleFieldInfo == null)
                {
                    _displayHandleFieldInfo = XplatUIX11.GetField("DisplayHandle",
                                                                  BindingFlags.NonPublic | BindingFlags.Static);
                }

                return((IntPtr)_displayHandleFieldInfo.GetValue(null));
            }
Пример #2
0
        /// <summary>
        /// Get mono's internal display handle to the X server
        /// </summary>
        public static IntPtr MonoGetDisplayHandle()
        {
            if (_displayHandle == null)
            {
                _displayHandle = XplatUIX11.GetField("DisplayHandle",
                                                     System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
            }

            return((IntPtr)_displayHandle.GetValue(null));
        }
Пример #3
0
        /// <summary>
        /// Gets mono's internal Focused Window Ptr/Handle.
        /// </summary>
        public static IntPtr MonoGetFocus()
        {
            if (_focusWindow == null)
            {
                _focusWindow = XplatUIX11.GetField("FocusWindow",
                                                   System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
            }

            // Get static field to determine Focused Window.
            return((IntPtr)_focusWindow.GetValue(null));
        }
Пример #4
0
        /// <summary>
        /// Sets XplatUI.State.ModifierKeys, which is what the Control.ModifierKeys WinForm property returns.
        /// </summary>
        public static void SetKeyStateTable(int virtualKey, byte value)
        {
            var keyboard = XplatUIX11.GetField("Keyboard",
                                               System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);

            if (keyboard == null)
            {
                return;
            }

            var key_state_table = X11Keyboard.GetField("key_state_table", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            if (key_state_table == null)
            {
                return;
            }

            var b = (byte[])key_state_table.GetValue(keyboard.GetValue(null));

            b[virtualKey] = value;

            key_state_table.SetValue(keyboard.GetValue(null), b);
        }