github.com/rajveermalviya/gamen@v0.1.2-0.20220930195403-9be15877c1aa/internal/xkbcommon/lib.go (about)

     1  //go:build linux && !android
     2  
     3  package xkbcommon
     4  
     5  /*
     6  
     7  #cgo CFLAGS: -I${SRCDIR}/include
     8  #cgo LDFLAGS: -ldl
     9  
    10  #include <dlfcn.h>
    11  
    12  #include <X11/Xlib-xcb.h>
    13  #include <xcb/xkb.h>
    14  
    15  #include <xkbcommon/xkbcommon.h>
    16  #include <xkbcommon/xkbcommon-x11.h>
    17  #include <xkbcommon/xkbcommon-compose.h>
    18  
    19  // libxkbcommon
    20  struct xkb_context *gamen_xkb_context_new(void *fp, enum xkb_context_flags flags) {
    21  	typedef struct xkb_context *(*proc_xkb_context_new)(enum xkb_context_flags flags);
    22  	return ((proc_xkb_context_new)fp)(flags);
    23  }
    24  struct xkb_compose_table *gamen_xkb_compose_table_new_from_locale(void *fp, struct xkb_context *context, const char *locale, enum xkb_compose_compile_flags flags) {
    25  	typedef struct xkb_compose_table *(*proc_xkb_compose_table_new_from_locale)(struct xkb_context *context, const char *locale, enum xkb_compose_compile_flags flags);
    26  	return ((proc_xkb_compose_table_new_from_locale)fp)(context, locale, flags);
    27  }
    28  struct xkb_compose_state *gamen_xkb_compose_state_new(void *fp, struct xkb_compose_table *table, enum xkb_compose_state_flags flags) {
    29  	typedef struct xkb_compose_state *(*proc_xkb_compose_state_new)(struct xkb_compose_table *table, enum xkb_compose_state_flags flags);
    30  	return ((proc_xkb_compose_state_new)fp)(table, flags);
    31  }
    32  void gamen_xkb_state_unref(void *fp, struct xkb_state *state) {
    33  	typedef void (*proc_xkb_state_unref)(struct xkb_state *state);
    34  	return ((proc_xkb_state_unref)fp)(state);
    35  }
    36  void gamen_xkb_keymap_unref(void *fp, struct xkb_keymap *keymap) {
    37  	typedef void (*proc_xkb_keymap_unref)(struct xkb_keymap *keymap);
    38  	return ((proc_xkb_keymap_unref)fp)(keymap);
    39  }
    40  void gamen_xkb_compose_state_unref(void *fp, struct xkb_compose_state *state) {
    41  	typedef void (*proc_xkb_compose_state_unref)(struct xkb_compose_state *state);
    42  	return ((proc_xkb_compose_state_unref)fp)(state);
    43  }
    44  void gamen_xkb_compose_table_unref(void *fp, struct xkb_compose_table *table) {
    45  	typedef void (*proc_xkb_compose_table_unref)(struct xkb_compose_table *table);
    46  	return ((proc_xkb_compose_table_unref)fp)(table);
    47  }
    48  void gamen_xkb_context_unref(void *fp, struct xkb_context *context) {
    49  	typedef void (*proc_xkb_context_unref)(struct xkb_context *context);
    50  	return ((proc_xkb_context_unref)fp)(context);
    51  }
    52  struct xkb_keymap *gamen_xkb_keymap_new_from_buffer(void *fp, struct xkb_context *context, const char *buffer, size_t length, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags) {
    53  	typedef struct xkb_keymap *(*proc_xkb_keymap_new_from_buffer)(struct xkb_context *context, const char *buffer, size_t length, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags);
    54  	return ((proc_xkb_keymap_new_from_buffer)fp)(context, buffer, length, format, flags);
    55  }
    56  struct xkb_state *gamen_xkb_state_new(void *fp, struct xkb_keymap *keymap) {
    57  	typedef struct xkb_state *(*proc_xkb_state_new)(struct xkb_keymap *keymap);
    58  	return ((proc_xkb_state_new)fp)(keymap);
    59  }
    60  int gamen_xkb_keymap_key_repeats(void *fp, struct xkb_keymap *keymap, xkb_keycode_t key) {
    61  	typedef int (*proc_xkb_keymap_key_repeats)(struct xkb_keymap *keymap, xkb_keycode_t key);
    62  	return ((proc_xkb_keymap_key_repeats)fp)(keymap, key);
    63  }
    64  xkb_keysym_t gamen_xkb_state_key_get_one_sym(void *fp, struct xkb_state *state, xkb_keycode_t key) {
    65  	typedef xkb_keysym_t (*proc_xkb_state_key_get_one_sym)(struct xkb_state *state, xkb_keycode_t key);
    66  	return ((proc_xkb_state_key_get_one_sym)fp)(state, key);
    67  }
    68  int gamen_xkb_state_key_get_utf8(void *fp, struct xkb_state *state, xkb_keycode_t key, char *buffer, size_t size) {
    69  	typedef int (*proc_xkb_state_key_get_utf8)(struct xkb_state *state, xkb_keycode_t key, char *buffer, size_t size);
    70  	return ((proc_xkb_state_key_get_utf8)fp)(state, key, buffer, size);
    71  }
    72  enum xkb_compose_feed_result gamen_xkb_compose_state_feed(void *fp, struct xkb_compose_state *state, xkb_keysym_t keysym) {
    73  	typedef enum xkb_compose_feed_result (*proc_xkb_compose_state_feed)(struct xkb_compose_state *state, xkb_keysym_t keysym);
    74  	return ((proc_xkb_compose_state_feed)fp)(state, keysym);
    75  }
    76  enum xkb_compose_status gamen_xkb_compose_state_get_status(void *fp, struct xkb_compose_state *state) {
    77  	typedef enum xkb_compose_status (*proc_xkb_compose_state_get_status)(struct xkb_compose_state *state);
    78  	return ((proc_xkb_compose_state_get_status)fp)(state);
    79  }
    80  int gamen_xkb_compose_state_get_utf8(void *fp, struct xkb_compose_state *state, char *buffer, size_t size) {
    81  	typedef int (*proc_xkb_compose_state_get_utf8)(struct xkb_compose_state *state, char *buffer, size_t size);
    82  	return ((proc_xkb_compose_state_get_utf8)fp)(state, buffer, size);
    83  }
    84  enum xkb_state_component gamen_xkb_state_update_mask(void *fp, struct xkb_state *state, xkb_mod_mask_t depressed_mods, xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods, xkb_layout_index_t depressed_layout, xkb_layout_index_t latched_layout, xkb_layout_index_t locked_layout) {
    85  	typedef enum xkb_state_component (*proc_xkb_state_update_mask)(struct xkb_state *state, xkb_mod_mask_t depressed_mods, xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods, xkb_layout_index_t depressed_layout, xkb_layout_index_t latched_layout, xkb_layout_index_t locked_layout);
    86  	return ((proc_xkb_state_update_mask)fp)(state, depressed_mods, latched_mods, locked_mods, depressed_layout, latched_layout, locked_layout);
    87  }
    88  int gamen_xkb_state_mod_name_is_active(void *fp, struct xkb_state *state, const char *name, enum xkb_state_component type) {
    89  	typedef int (*proc_xkb_state_mod_name_is_active)(struct xkb_state *state, const char *name, enum xkb_state_component type);
    90  	return ((proc_xkb_state_mod_name_is_active)fp)(state, name, type);
    91  }
    92  
    93  // libxkbcommon-x11
    94  int gamen_xkb_x11_setup_xkb_extension(void *fp, xcb_connection_t *connection, uint16_t major_xkb_version, uint16_t minor_xkb_version, enum xkb_x11_setup_xkb_extension_flags flags, uint16_t *major_xkb_version_out, uint16_t *minor_xkb_version_out, uint8_t *base_event_out, uint8_t *base_error_out) {
    95  	typedef int (*proc_xkb_x11_setup_xkb_extension)(xcb_connection_t *connection, uint16_t major_xkb_version, uint16_t minor_xkb_version, enum xkb_x11_setup_xkb_extension_flags flags, uint16_t *major_xkb_version_out, uint16_t *minor_xkb_version_out, uint8_t *base_event_out, uint8_t *base_error_out);
    96  	return ((proc_xkb_x11_setup_xkb_extension)fp)(connection, major_xkb_version, minor_xkb_version, flags, major_xkb_version_out, minor_xkb_version_out, base_event_out, base_error_out);
    97  }
    98  int32_t gamen_xkb_x11_get_core_keyboard_device_id(void *fp, xcb_connection_t *connection) {
    99  	typedef int32_t (*proc_xkb_x11_get_core_keyboard_device_id)(xcb_connection_t *connection);
   100  	return ((proc_xkb_x11_get_core_keyboard_device_id)fp)(connection);
   101  }
   102  struct xkb_keymap *gamen_xkb_x11_keymap_new_from_device(void *fp, struct xkb_context *context, xcb_connection_t *connection, int32_t device_id, enum xkb_keymap_compile_flags flags) {
   103  	typedef struct xkb_keymap *(*proc_xkb_x11_keymap_new_from_device)(struct xkb_context *context, xcb_connection_t *connection, int32_t device_id, enum xkb_keymap_compile_flags flags);
   104  	return ((proc_xkb_x11_keymap_new_from_device)fp)(context, connection, device_id, flags);
   105  }
   106  struct xkb_state *gamen_xkb_x11_state_new_from_device(void *fp, struct xkb_keymap *keymap, xcb_connection_t *connection, int32_t device_id) {
   107  	typedef struct xkb_state *(*proc_xkb_x11_state_new_from_device)(struct xkb_keymap *keymap, xcb_connection_t *connection, int32_t device_id);
   108  	return ((proc_xkb_x11_state_new_from_device)fp)(keymap, connection, device_id);
   109  }
   110  
   111  // libxcb
   112  xcb_generic_error_t *gamen_xkbcommon_xcb_request_check(void *fp, xcb_connection_t *c, xcb_void_cookie_t cookie) {
   113  	typedef xcb_generic_error_t *(*proc_xcb_request_check)(xcb_connection_t *c, xcb_void_cookie_t cookie);
   114  	return ((proc_xcb_request_check)fp)(c, cookie);
   115  }
   116  
   117  // libxcb-xkb
   118  xcb_void_cookie_t gamen_xcb_xkb_select_events_aux_checked(void *fp, xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, uint16_t affectMap, uint16_t map, const xcb_xkb_select_events_details_t *details) {
   119  	typedef xcb_void_cookie_t (*proc_xcb_xkb_select_events_aux_checked)(xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, uint16_t affectMap, uint16_t map, const xcb_xkb_select_events_details_t *details);
   120  	return ((proc_xcb_xkb_select_events_aux_checked)fp)(c, deviceSpec, affectWhich, clear, selectAll, affectMap, map, details);
   121  }
   122  
   123  */
   124  import "C"
   125  import (
   126  	"errors"
   127  	"unsafe"
   128  )
   129  
   130  type xkbcommon_library struct {
   131  	libxkbcommonHandle    unsafe.Pointer
   132  	libxkbcommonX11Handle unsafe.Pointer
   133  	libxcbHandle          unsafe.Pointer
   134  	libxcbXkbHandle       unsafe.Pointer
   135  
   136  	// libxkbcommon
   137  	xkb_context_new_handle                   unsafe.Pointer
   138  	xkb_compose_table_new_from_locale_handle unsafe.Pointer
   139  	xkb_compose_state_new_handle             unsafe.Pointer
   140  	xkb_state_unref_handle                   unsafe.Pointer
   141  	xkb_keymap_unref_handle                  unsafe.Pointer
   142  	xkb_compose_state_unref_handle           unsafe.Pointer
   143  	xkb_compose_table_unref_handle           unsafe.Pointer
   144  	xkb_context_unref_handle                 unsafe.Pointer
   145  	xkb_keymap_new_from_buffer_handle        unsafe.Pointer
   146  	xkb_state_new_handle                     unsafe.Pointer
   147  	xkb_keymap_key_repeats_handle            unsafe.Pointer
   148  	xkb_state_key_get_one_sym_handle         unsafe.Pointer
   149  	xkb_state_key_get_utf8_handle            unsafe.Pointer
   150  	xkb_compose_state_feed_handle            unsafe.Pointer
   151  	xkb_compose_state_get_status_handle      unsafe.Pointer
   152  	xkb_compose_state_get_utf8_handle        unsafe.Pointer
   153  	xkb_state_update_mask_handle             unsafe.Pointer
   154  	xkb_state_mod_name_is_active_handle      unsafe.Pointer
   155  
   156  	// libxkbcommon-x11
   157  	xkb_x11_setup_xkb_extension_handle         unsafe.Pointer
   158  	xkb_x11_get_core_keyboard_device_id_handle unsafe.Pointer
   159  	xkb_x11_keymap_new_from_device_handle      unsafe.Pointer
   160  	xkb_x11_state_new_from_device_handle       unsafe.Pointer
   161  
   162  	// libxcb
   163  	xcb_request_check_handle unsafe.Pointer
   164  
   165  	// libxcb-xkb
   166  	xcb_xkb_select_events_aux_checked_handle unsafe.Pointer
   167  }
   168  
   169  func loadSym(handle unsafe.Pointer, symbol *C.char) (unsafe.Pointer, error) {
   170  	C.dlerror()
   171  	fp := C.dlsym(handle, symbol)
   172  	if fp == nil {
   173  		err := C.dlerror()
   174  		if err != nil {
   175  			return nil, errors.New(C.GoString(err))
   176  		}
   177  	}
   178  	return fp, nil
   179  }
   180  
   181  func open_xkbcommon_library() (*xkbcommon_library, error) {
   182  	C.dlerror()
   183  
   184  	l := &xkbcommon_library{}
   185  
   186  	l.libxkbcommonHandle = C.dlopen((*C.char)(unsafe.Pointer(&([]byte("libxkbcommon.so.0\x00"))[0])), C.RTLD_LAZY)
   187  	if l.libxkbcommonHandle == nil {
   188  		err := C.dlerror()
   189  		if err != nil {
   190  			l.close()
   191  			return nil, errors.New(C.GoString(err))
   192  		}
   193  	}
   194  	l.libxkbcommonX11Handle = C.dlopen((*C.char)(unsafe.Pointer(&([]byte("libxkbcommon-x11.so.0\x00"))[0])), C.RTLD_LAZY)
   195  	if l.libxkbcommonX11Handle == nil {
   196  		err := C.dlerror()
   197  		if err != nil {
   198  			l.close()
   199  			return nil, errors.New(C.GoString(err))
   200  		}
   201  	}
   202  	l.libxcbHandle = C.dlopen((*C.char)(unsafe.Pointer(&([]byte("libxcb.so.1\x00"))[0])), C.RTLD_LAZY)
   203  	if l.libxcbHandle == nil {
   204  		err := C.dlerror()
   205  		if err != nil {
   206  			l.close()
   207  			return nil, errors.New(C.GoString(err))
   208  		}
   209  	}
   210  	l.libxcbXkbHandle = C.dlopen((*C.char)(unsafe.Pointer(&([]byte("libxcb-xkb.so.1\x00"))[0])), C.RTLD_LAZY)
   211  	if l.libxcbXkbHandle == nil {
   212  		err := C.dlerror()
   213  		if err != nil {
   214  			l.close()
   215  			return nil, errors.New(C.GoString(err))
   216  		}
   217  	}
   218  
   219  	var err error
   220  
   221  	// libxkbcommon
   222  	l.xkb_context_new_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_context_new\x00"))[0])))
   223  	if err != nil {
   224  		l.close()
   225  		return nil, err
   226  	}
   227  	l.xkb_compose_table_new_from_locale_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_compose_table_new_from_locale\x00"))[0])))
   228  	if err != nil {
   229  		l.close()
   230  		return nil, err
   231  	}
   232  	l.xkb_compose_state_new_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_compose_state_new\x00"))[0])))
   233  	if err != nil {
   234  		l.close()
   235  		return nil, err
   236  	}
   237  	l.xkb_state_unref_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_state_unref\x00"))[0])))
   238  	if err != nil {
   239  		l.close()
   240  		return nil, err
   241  	}
   242  	l.xkb_keymap_unref_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_keymap_unref\x00"))[0])))
   243  	if err != nil {
   244  		l.close()
   245  		return nil, err
   246  	}
   247  	l.xkb_compose_state_unref_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_compose_state_unref\x00"))[0])))
   248  	if err != nil {
   249  		l.close()
   250  		return nil, err
   251  	}
   252  	l.xkb_compose_table_unref_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_compose_table_unref\x00"))[0])))
   253  	if err != nil {
   254  		l.close()
   255  		return nil, err
   256  	}
   257  	l.xkb_context_unref_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_context_unref\x00"))[0])))
   258  	if err != nil {
   259  		l.close()
   260  		return nil, err
   261  	}
   262  	l.xkb_keymap_new_from_buffer_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_keymap_new_from_buffer\x00"))[0])))
   263  	if err != nil {
   264  		l.close()
   265  		return nil, err
   266  	}
   267  	l.xkb_state_new_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_state_new\x00"))[0])))
   268  	if err != nil {
   269  		l.close()
   270  		return nil, err
   271  	}
   272  	l.xkb_keymap_key_repeats_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_keymap_key_repeats\x00"))[0])))
   273  	if err != nil {
   274  		l.close()
   275  		return nil, err
   276  	}
   277  	l.xkb_state_key_get_one_sym_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_state_key_get_one_sym\x00"))[0])))
   278  	if err != nil {
   279  		l.close()
   280  		return nil, err
   281  	}
   282  	l.xkb_state_key_get_utf8_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_state_key_get_utf8\x00"))[0])))
   283  	if err != nil {
   284  		l.close()
   285  		return nil, err
   286  	}
   287  	l.xkb_compose_state_feed_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_compose_state_feed\x00"))[0])))
   288  	if err != nil {
   289  		l.close()
   290  		return nil, err
   291  	}
   292  	l.xkb_compose_state_get_status_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_compose_state_get_status\x00"))[0])))
   293  	if err != nil {
   294  		l.close()
   295  		return nil, err
   296  	}
   297  	l.xkb_compose_state_get_utf8_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_compose_state_get_utf8\x00"))[0])))
   298  	if err != nil {
   299  		l.close()
   300  		return nil, err
   301  	}
   302  	l.xkb_state_update_mask_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_state_update_mask\x00"))[0])))
   303  	if err != nil {
   304  		l.close()
   305  		return nil, err
   306  	}
   307  	l.xkb_state_mod_name_is_active_handle, err = loadSym(l.libxkbcommonHandle, (*C.char)(unsafe.Pointer(&([]byte("xkb_state_mod_name_is_active\x00"))[0])))
   308  	if err != nil {
   309  		l.close()
   310  		return nil, err
   311  	}
   312  
   313  	// libxkbcommon-x11
   314  	l.xkb_x11_setup_xkb_extension_handle, err = loadSym(l.libxkbcommonX11Handle, (*C.char)(unsafe.Pointer(&([]byte("xkb_x11_setup_xkb_extension\x00"))[0])))
   315  	if err != nil {
   316  		l.close()
   317  		return nil, err
   318  	}
   319  	l.xkb_x11_get_core_keyboard_device_id_handle, err = loadSym(l.libxkbcommonX11Handle, (*C.char)(unsafe.Pointer(&([]byte("xkb_x11_get_core_keyboard_device_id\x00"))[0])))
   320  	if err != nil {
   321  		l.close()
   322  		return nil, err
   323  	}
   324  	l.xkb_x11_keymap_new_from_device_handle, err = loadSym(l.libxkbcommonX11Handle, (*C.char)(unsafe.Pointer(&([]byte("xkb_x11_keymap_new_from_device\x00"))[0])))
   325  	if err != nil {
   326  		l.close()
   327  		return nil, err
   328  	}
   329  	l.xkb_x11_state_new_from_device_handle, err = loadSym(l.libxkbcommonX11Handle, (*C.char)(unsafe.Pointer(&([]byte("xkb_x11_state_new_from_device\x00"))[0])))
   330  	if err != nil {
   331  		l.close()
   332  		return nil, err
   333  	}
   334  
   335  	// libxcb
   336  	l.xcb_request_check_handle, err = loadSym(l.libxcbHandle, (*C.char)(unsafe.Pointer(&([]byte("xcb_request_check\x00"))[0])))
   337  	if err != nil {
   338  		l.close()
   339  		return nil, err
   340  	}
   341  
   342  	// libxcb-xkb
   343  	l.xcb_xkb_select_events_aux_checked_handle, err = loadSym(l.libxcbXkbHandle, (*C.char)(unsafe.Pointer(&([]byte("xcb_xkb_select_events_aux_checked\x00"))[0])))
   344  	if err != nil {
   345  		l.close()
   346  		return nil, err
   347  	}
   348  
   349  	return l, nil
   350  }
   351  
   352  func (l *xkbcommon_library) close() {
   353  	if l.libxcbXkbHandle != nil {
   354  		C.dlclose(l.libxcbXkbHandle)
   355  		l.libxcbXkbHandle = nil
   356  	}
   357  	if l.libxcbHandle != nil {
   358  		C.dlclose(l.libxcbHandle)
   359  		l.libxcbHandle = nil
   360  	}
   361  	if l.libxkbcommonX11Handle != nil {
   362  		C.dlclose(l.libxkbcommonX11Handle)
   363  		l.libxkbcommonX11Handle = nil
   364  	}
   365  	if l.libxkbcommonHandle != nil {
   366  		C.dlclose(l.libxkbcommonHandle)
   367  		l.libxkbcommonHandle = nil
   368  	}
   369  }
   370  
   371  // libxkbcommon
   372  func (l *xkbcommon_library) xkb_context_new(flags C.enum_xkb_context_flags) *C.struct_xkb_context {
   373  	return C.gamen_xkb_context_new(l.xkb_context_new_handle, flags)
   374  }
   375  func (l *xkbcommon_library) xkb_compose_table_new_from_locale(context *C.struct_xkb_context, locale *C.char, flags C.enum_xkb_compose_compile_flags) *C.struct_xkb_compose_table {
   376  	return C.gamen_xkb_compose_table_new_from_locale(l.xkb_compose_table_new_from_locale_handle, context, locale, flags)
   377  }
   378  func (l *xkbcommon_library) xkb_compose_state_new(table *C.struct_xkb_compose_table, flags C.enum_xkb_compose_state_flags) *C.struct_xkb_compose_state {
   379  	return C.gamen_xkb_compose_state_new(l.xkb_compose_state_new_handle, table, flags)
   380  }
   381  func (l *xkbcommon_library) xkb_state_unref(state *C.struct_xkb_state) {
   382  	C.gamen_xkb_state_unref(l.xkb_state_unref_handle, state)
   383  }
   384  func (l *xkbcommon_library) xkb_keymap_unref(keymap *C.struct_xkb_keymap) {
   385  	C.gamen_xkb_keymap_unref(l.xkb_keymap_unref_handle, keymap)
   386  }
   387  func (l *xkbcommon_library) xkb_compose_state_unref(state *C.struct_xkb_compose_state) {
   388  	C.gamen_xkb_compose_state_unref(l.xkb_compose_state_unref_handle, state)
   389  }
   390  func (l *xkbcommon_library) xkb_compose_table_unref(table *C.struct_xkb_compose_table) {
   391  	C.gamen_xkb_compose_table_unref(l.xkb_compose_table_unref_handle, table)
   392  }
   393  func (l *xkbcommon_library) xkb_context_unref(context *C.struct_xkb_context) {
   394  	C.gamen_xkb_context_unref(l.xkb_context_unref_handle, context)
   395  }
   396  func (l *xkbcommon_library) xkb_keymap_new_from_buffer(context *C.struct_xkb_context, buffer *C.char, length C.size_t, format C.enum_xkb_keymap_format, flags C.enum_xkb_keymap_compile_flags) *C.struct_xkb_keymap {
   397  	return C.gamen_xkb_keymap_new_from_buffer(l.xkb_keymap_new_from_buffer_handle, context, buffer, length, format, flags)
   398  }
   399  func (l *xkbcommon_library) xkb_state_new(keymap *C.struct_xkb_keymap) *C.struct_xkb_state {
   400  	return C.gamen_xkb_state_new(l.xkb_state_new_handle, keymap)
   401  }
   402  func (l *xkbcommon_library) xkb_keymap_key_repeats(keymap *C.struct_xkb_keymap, key C.xkb_keycode_t) C.int {
   403  	return C.gamen_xkb_keymap_key_repeats(l.xkb_keymap_key_repeats_handle, keymap, key)
   404  }
   405  func (l *xkbcommon_library) xkb_state_key_get_one_sym(state *C.struct_xkb_state, key C.xkb_keycode_t) C.xkb_keysym_t {
   406  	return C.gamen_xkb_state_key_get_one_sym(l.xkb_state_key_get_one_sym_handle, state, key)
   407  }
   408  func (l *xkbcommon_library) xkb_state_key_get_utf8(state *C.struct_xkb_state, key C.xkb_keycode_t, buffer *C.char, size C.size_t) C.int {
   409  	return C.gamen_xkb_state_key_get_utf8(l.xkb_state_key_get_utf8_handle, state, key, buffer, size)
   410  }
   411  func (l *xkbcommon_library) xkb_compose_state_feed(state *C.struct_xkb_compose_state, keysym C.xkb_keysym_t) C.enum_xkb_compose_feed_result {
   412  	return C.gamen_xkb_compose_state_feed(l.xkb_compose_state_feed_handle, state, keysym)
   413  }
   414  func (l *xkbcommon_library) xkb_compose_state_get_status(state *C.struct_xkb_compose_state) C.enum_xkb_compose_status {
   415  	return C.gamen_xkb_compose_state_get_status(l.xkb_compose_state_get_status_handle, state)
   416  }
   417  func (l *xkbcommon_library) xkb_compose_state_get_utf8(state *C.struct_xkb_compose_state, buffer *C.char, size C.size_t) C.int {
   418  	return C.gamen_xkb_compose_state_get_utf8(l.xkb_compose_state_get_utf8_handle, state, buffer, size)
   419  }
   420  func (l *xkbcommon_library) xkb_state_update_mask(state *C.struct_xkb_state, depressed_mods C.xkb_mod_mask_t, latched_mods C.xkb_mod_mask_t, locked_mods C.xkb_mod_mask_t, depressed_layout C.xkb_layout_index_t, latched_layout C.xkb_layout_index_t, locked_layout C.xkb_layout_index_t) C.enum_xkb_state_component {
   421  	return C.gamen_xkb_state_update_mask(l.xkb_state_update_mask_handle, state, depressed_mods, latched_mods, locked_mods, depressed_layout, latched_layout, locked_layout)
   422  }
   423  func (l *xkbcommon_library) xkb_state_mod_name_is_active(state *C.struct_xkb_state, name *C.char, _type C.enum_xkb_state_component) C.int {
   424  	return C.gamen_xkb_state_mod_name_is_active(l.xkb_state_mod_name_is_active_handle, state, name, _type)
   425  }
   426  
   427  // libxkbcommon-x11
   428  func (l *xkbcommon_library) xkb_x11_setup_xkb_extension(connection *C.xcb_connection_t, major_xkb_version C.uint16_t, minor_xkb_version C.uint16_t, flags C.enum_xkb_x11_setup_xkb_extension_flags, major_xkb_version_out *C.uint16_t, minor_xkb_version_out *C.uint16_t, base_event_out *C.uint8_t, base_error_out *C.uint8_t) C.int {
   429  	return C.gamen_xkb_x11_setup_xkb_extension(l.xkb_x11_setup_xkb_extension_handle, connection, major_xkb_version, minor_xkb_version, flags, major_xkb_version_out, minor_xkb_version_out, base_event_out, base_error_out)
   430  }
   431  func (l *xkbcommon_library) xkb_x11_get_core_keyboard_device_id(connection *C.xcb_connection_t) C.int32_t {
   432  	return C.gamen_xkb_x11_get_core_keyboard_device_id(l.xkb_x11_get_core_keyboard_device_id_handle, connection)
   433  }
   434  func (l *xkbcommon_library) xkb_x11_keymap_new_from_device(context *C.struct_xkb_context, connection *C.xcb_connection_t, device_id C.int32_t, flags C.enum_xkb_keymap_compile_flags) *C.struct_xkb_keymap {
   435  	return C.gamen_xkb_x11_keymap_new_from_device(l.xkb_x11_keymap_new_from_device_handle, context, connection, device_id, flags)
   436  }
   437  func (l *xkbcommon_library) xkb_x11_state_new_from_device(keymap *C.struct_xkb_keymap, connection *C.xcb_connection_t, device_id C.int32_t) *C.struct_xkb_state {
   438  	return C.gamen_xkb_x11_state_new_from_device(l.xkb_x11_state_new_from_device_handle, keymap, connection, device_id)
   439  }
   440  
   441  // libxcb
   442  func (l *xkbcommon_library) xcb_request_check(c *C.xcb_connection_t, cookie C.xcb_void_cookie_t) *C.xcb_generic_error_t {
   443  	return C.gamen_xkbcommon_xcb_request_check(l.xcb_request_check_handle, c, cookie)
   444  }
   445  
   446  // libxcb-xkb
   447  func (l *xkbcommon_library) xcb_xkb_select_events_aux_checked(c *C.xcb_connection_t, deviceSpec C.xcb_xkb_device_spec_t, affectWhich C.uint16_t, clear C.uint16_t, selectAll C.uint16_t, affectMap C.uint16_t, _map C.uint16_t, details *C.xcb_xkb_select_events_details_t) C.xcb_void_cookie_t {
   448  	return C.gamen_xcb_xkb_select_events_aux_checked(l.xcb_xkb_select_events_aux_checked_handle, c, deviceSpec, affectWhich, clear, selectAll, affectMap, _map, details)
   449  }