Skip to content

Commit

Permalink
tools: Keymap compiler server
Browse files Browse the repository at this point in the history
  • Loading branch information
wismill committed Nov 19, 2024
1 parent 92d0368 commit 5175c7a
Show file tree
Hide file tree
Showing 5 changed files with 787 additions and 32 deletions.
17 changes: 17 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ if not cc.has_header_symbol('limits.h', 'PATH_MAX', prefix: system_ext_define)
configh_data.set('PATH_MAX', 4096)
endif
endif
if cc.get_argument_syntax() == 'msvc'
add_project_arguments(
cc.get_supported_arguments(['/experimental:c11atomics']),
language: 'c'
)
endif

# Silence some security & deprecation warnings on MSVC
# for some unix/C functions we use.
Expand Down Expand Up @@ -512,6 +518,17 @@ if build_tools
c_args: ['-DENABLE_PRIVATE_APIS'],
include_directories: [include_directories('src', 'include')],
install: false)
thread_dep = dependency('threads', required: false)
if thread_dep.found() and cc.has_header('sys/un.h')
# Similar to previous tool, but for batch processing using a server
executable('compile-keymap-server',
'tools/compile-keymap-server.c',
libxkbcommon_sources,
dependencies: [tools_dep, thread_dep],
c_args: ['-DENABLE_KEYMAP_SOCKET'],
include_directories: [include_directories('src', 'include')],
install: false)
endif

# Tool: compose
executable('xkbcli-compile-compose',
Expand Down
5 changes: 5 additions & 0 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,12 @@ xkb_context_new(enum xkb_context_flags flags)
return NULL;
}

#ifdef ENABLE_KEYMAP_SOCKET
/* NOTE: Size should be adusted to deal with xkeyboard-config database */
ctx->atom_table = atom_table_new(14);
#else
ctx->atom_table = atom_table_new();
#endif
if (!ctx->atom_table) {
xkb_context_unref(ctx);
return NULL;
Expand Down
1 change: 1 addition & 0 deletions src/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "xkbcommon/xkbcommon.h"
#include "atom.h"
#include "messages-codes.h"
#include "src/utils.h"

struct xkb_context {
atomic_int refcnt;
Expand Down
Loading

0 comments on commit 5175c7a

Please sign in to comment.