Merge pull request #14372 from keymanapp/refactor/linux/13281_defines

Fixes: #13281
This commit is contained in:
Eberhard Beilharz 2025-07-18 14:20:28 +02:00 • committed by GitHub
commit a04dd4b442
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 34 additions and 26 deletions

View file

@ -55,6 +55,10 @@ core_include_dirs = [
include_directories('../../core/build/arch' / get_option('buildtype') / 'include'),
]
linux_include_dirs = [
include_directories('../include')
]
subdir('icons')
subdir('src')
subdir('tests')

View file

@ -32,6 +32,8 @@
#include <keyman/keyman_core_api.h>
#include <keyman/keyman_core_api_consts.h>
#include <km_linux_common.h>
#include "config.h"
#include "keymanutil.h"
#include "keyman-service.h"
@ -51,10 +53,6 @@
#define KEYMAN_RCTRL 97 // 0x61
#define KEYMAN_RALT 100 // 0x64
// TODO: Move to a common header file. Also defined in tests/testfixture.h
// and keyman-system-service/src/OrderedOutputDevice.cpp
#define KEYMAN_F24_KEYCODE_OUTPUT_SENTINEL 194 // 0xC2
typedef struct _IBusKeymanEngine IBusKeymanEngine;
typedef struct _IBusKeymanEngineClass IBusKeymanEngineClass;

View file

@ -13,6 +13,7 @@ engine_files = files(
include_dirs = [
core_include_dirs,
linux_include_dirs,
include_directories('..'),
include_directories(meson.current_build_dir() / '..'),
]

View file

@ -2,18 +2,13 @@
#include <glib-object.h>
#include <glib.h>
#include <kmx/kmx_processevent.h>
#include <km_linux_test_common.h>
#include "EventSource.h"
#include "KeyHandling.h"
#include "KeymanSystemServiceClient.h"
#include "kmx_test_source.hpp"
#include "DbusTestHelper.h"
// TODO: move these to a common header. Also defined in
// keyman-system-service/tests/OrderedOutputDeviceMock.cpp
#define KEYMAN_TESTHELPER_BUS_NAME "com.keyman.TestService"
#define KEYMAN_TESTHELPER_OBJECT_PATH "/com/keyman/TestService/TestHelper"
#define KEYMAN_TESTHELPER_INTERFACE_NAME "com.keyman.TestService.TestHelper"
static sd_bus* bus = NULL;
static EventSource *source = NULL;

View file

@ -25,6 +25,7 @@ test_env = [
test_include_dirs = [
core_include_dirs,
linux_include_dirs,
include_directories('../../../core/tests/kmx_test_source'),
include_directories('../src'),
include_directories('..'),

View file

@ -4,12 +4,9 @@
#include <glib-object.h>
#include <glib.h>
#include <ibus.h>
#include <km_linux_common.h>
#include "ibusimcontext.h"
// TODO: Move to a common header file. Also defined in engine.c and
// keyman-system-service/src/OrderedOutputDevice.cpp
#define KEYMAN_F24_KEYCODE_OUTPUT_SENTINEL 194 // 0xC2
typedef struct {
IBusBus* bus;
GtkIMContext* context;

View file

@ -0,0 +1,7 @@
// Keyman is copyright(C) SIL Global.MIT License.
#ifndef __KM_LINUX_COMMON_H__
#define __KM_LINUX_COMMON_H__
#define KEYMAN_F24_KEYCODE_OUTPUT_SENTINEL 194 // 0xC2
#endif // __KM_LINUX_COMMON_H__

View file

@ -0,0 +1,9 @@
// Keyman is copyright(C) SIL Global.MIT License.
#ifndef __KM_LINUX_TEST_COMMON_H__
#define __KM_LINUX_TEST_COMMON_H__
#define KEYMAN_TESTHELPER_BUS_NAME "com.keyman.TestService"
#define KEYMAN_TESTHELPER_OBJECT_PATH "/com/keyman/TestService/TestHelper"
#define KEYMAN_TESTHELPER_INTERFACE_NAME "com.keyman.TestService.TestHelper"
#endif // __KM_LINUX_TEST_COMMON_H__

View file

@ -19,6 +19,10 @@ endif
configure_file(output : 'config.h',
configuration : conf)
linux_include_dirs = [
include_directories('../include')
]
subdir('resources')
subdir('src')
subdir('tests')

View file

@ -5,14 +5,11 @@
#include <string>
#include <syslog.h>
#include <unistd.h>
#include <km_linux_common.h>
#include "OrderedOutputDevice.h"
using namespace std;
// TODO: Move to a common header file. Also defined in ibus-keyman/src/engine.c
// and ibus-keyman/tests/testfixture.h
#define KEYMAN_F24_KEYCODE_OUTPUT_SENTINEL 194 // 0xC2
#ifndef KEYMAN_TESTING
OrderedOutputDevice* CreateOrderedOutputDevice() {
return new OrderedOutputDevice();

View file

@ -11,7 +11,7 @@ exe = executable(
'keyman-system-service',
sources: [service_files],
dependencies: deps,
include_directories: ['..'],
include_directories: [linux_include_dirs, '..'],
install: true,
install_dir: get_option('libexecdir'),
)

View file

@ -4,14 +4,9 @@
#else
#include <basu/sd-bus.h>
#endif
#include <km_linux_test_common.h>
#include "OrderedOutputDevice.h"
// TODO: move these to a common header. Also defined in
// ibus-keyman/tests/DBusTestHelper.cpp
#define KEYMAN_TESTHELPER_BUS_NAME "com.keyman.TestService"
#define KEYMAN_TESTHELPER_OBJECT_PATH "/com/keyman/TestService/TestHelper"
#define KEYMAN_TESTHELPER_INTERFACE_NAME "com.keyman.TestService.TestHelper"
#ifndef KEYMAN_TESTING
#warning KEYMAN_TESTING should be defined when compiling tests
#endif

View file

@ -19,7 +19,7 @@ exe = executable(
c_args: test_c_args,
cpp_args: test_c_args,
dependencies: deps,
include_directories: [ '..', '../src' ]
include_directories: [ linux_include_dirs, '..', '../src' ]
)
# we currently don't have any real unit tests for keyman-system-service.