예제 #1
0
        private void KeymapCallback(void *data, wl_keyboard *proxy, wl_keyboard_keymap_format format, int fd, uint size)
        {
            if (format != wl_keyboard_keymap_format.XkbV1)
            {
                Libc.close(fd);
                throw new NotImplementedException("Only xkbcommon compatible keymaps are currently supported.");
            }

            var kbdStr = Libc.mmap(null, size, Libc.PROT_READ, Libc.MAP_PRIVATE, fd, 0);

            if (kbdStr == null)
            {
                Libc.close(fd);
                return;
            }

            var newKeymap = XkbCommon.xkb_keymap_new_from_string(_xkbContext, kbdStr, XkbCommon.XKB_KEYMAP_FORMAT_TEXT_V1);

            Libc.munmap(kbdStr, size);
            Libc.close(fd);

            if (newKeymap == null)
            {
                throw new OpenWindowException("Failed to create xkb keymap.");
            }

            var newState = XkbCommon.xkb_state_new(newKeymap);

            if (newState == null)
            {
                XkbCommon.xkb_keymap_unref(newKeymap);
                throw new OpenWindowException("Failed to create xkb state.");
            }

            if (_xkbKeymap != null)
            {
                XkbCommon.xkb_keymap_unref(_xkbKeymap);
            }
            if (_xkbState != null)
            {
                XkbCommon.xkb_state_unref(_xkbState);
            }

            _xkbKeymap = newKeymap;
            _xkbState  = newState;

            UpdateKeymap();
        }
예제 #2
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern int xkb_state_led_name_is_active(xkb_state *state, byte *name);
예제 #3
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern void xkb_state_unref(xkb_state *state);
예제 #4
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern int xkb_state_mod_name_is_active(xkb_state *state, byte *name, xkb_state_component type);
예제 #5
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern int xkb_state_key_get_utf8(xkb_state *state, uint key, byte *buffer, int size);
예제 #6
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern int xkb_state_key_get_utf32(xkb_state *state, uint key);
예제 #7
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern uint xkb_state_key_get_one_sym(xkb_state *state, uint key);
예제 #8
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern xkb_state_component xkb_state_update_mask(xkb_state *state, uint depressed_mods, uint latched_mods, uint locked_mods, uint depressed_layout, uint latched_layout, uint locked_layout);
예제 #9
0
파일: Native.cs 프로젝트: Joleme/OpenWindow
 public static extern xkb_state_component xkb_state_update_key(xkb_state *state, uint key, wl_keyboard_key_state down);