Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.5.2 #469

Merged
merged 6 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-nix-rustc-1.51.0-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-nix-rustc-v2-1.51.0-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-nix-rustc-1.51.0-
${{ runner.os }}-nix-rustc-v2-1.51.0-
- run: nix-shell --pure --run "bash scripts/build.sh -ad"
- run: nix-shell --pure --run "cargo test"

Expand Down
64 changes: 23 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"src/engine/capi",
"src/engine/core",
"src/engine/config",
"src/engine/cffi",
"src/engine/dict",

Expand All @@ -16,7 +17,6 @@ members = [
"src/frontends/xim",

"src/tools/check",
"src/tools/config",
"src/tools/kime",
"src/tools/indicator",
"src/tools/log",
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.1
2.5.2
8 changes: 8 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

### Improve

## 2.5.2

### Improve

* Fix wrong symbol name (Gammma -> Gamma)
* Fix config loading in capi [#465](https://github.com/Riey/kime/issues/465)
* Fix key repeat bug on XIM [#467](https://github.com/Riey/kime/issues/467)

## 2.5.1

### Improve
Expand Down
5 changes: 4 additions & 1 deletion docs/CONFIGURATION.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

[English](CONFIGURATION.md), [한국어](CONFIGURATION.ko.md)

`/etc/xdg/kime/config.yaml`에 기본값으로 설정된 파일이 있습니다. [default_config.yaml](../res/default_config.yaml)에서 기본 설정 파일을 온라인으로 볼 수도 있습니다. `/etc/xdg/kime/config.yaml`에서 전역 설정을 수정하거나 `~/.config/kime/config.yaml`에 새 설정 파일을 만들어 보세요.
`/usr/share/doc/kime/default_config.yaml`에 기본 설정 파일 샘플이 있습니다.
[default_config.yaml](../res/default_config.yaml)에서 기본 설정 파일을 온라인으로 볼 수도 있습니다.
이 파일을 `/etc/xdf/kime/config.yaml`로 복사하여 전역 설정으로 사용하세요.
`~/.config/kime/config.yaml`에 사용자마다 각각 적용되는 설정 파일을 만들 수도 있습니다.

[`$XDG_CONFIG_DIR`이나 `$XDG_CONFIG_HOME`][xdg] 환경 변수를 이용해 설정 파일의 위치를 바꿀 수도 있습니다. kime는 `$XDG_CONFIG_DIR/kime/config.yaml`과 `$XDG_CONFIG_HOME/kime/config.yaml`에 있는 설정 파일도 읽으려고 시도할 것입니다.

Expand Down
6 changes: 3 additions & 3 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

[English](CONFIGURATION.md), [한국어](CONFIGURATION.ko.md)

Default config file is located at `/etc/xdg/kime/config.yaml`. Check
Sample config file is located at `/usr/share/doc/kime/default_config.yaml`. Check
[default_config.yaml](../res/default_config.yaml) to see the default configuration
file. You edit `/etc/xdg/kime/config.yaml` or create a new config file at
`~/.config/kime/config.yaml`.
file. Copy this file to `/etc/xdg/kime/config.yaml` for global default configuration.
You may create per user file at `~/.config/kime/config.yaml`.

You can also change the location of config file using [`$XDG_CONFIG_DIR` or
`$XDG_CONFIG_HOME`][xdg] environment variable. kime will try to read
Expand Down
2 changes: 1 addition & 1 deletion src/engine/capi/cbindgen-c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitflags = true

[parse]
parse_deps = true
include = ["kime-engine-backend", "kime-engine-core", "kime-config"]
include = ["kime-engine-backend", "kime-engine-core", "kime-engine-config"]

[export]
prefix = "Kime"
Expand Down
2 changes: 1 addition & 1 deletion src/engine/capi/cbindgen-cpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bitflags = true

[parse]
parse_deps = true
include = ["kime-engine-backend", "kime-engine-core", "kime-config"]
include = ["kime-engine-backend", "kime-engine-core", "kime-engine-config"]

[const]
allow_static_const = true
Expand Down
80 changes: 72 additions & 8 deletions src/engine/capi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#![allow(clippy::missing_safety_doc)]

pub use kime_engine_core::{Config, InputCategory, InputEngine, InputResult, ModifierState};
pub use kime_engine_core::{
config_load_from_config_dir, Config, DaemonConfig, DaemonModule, IconColor, IndicatorConfig,
InputCategory, InputEngine, InputResult, ModifierState,
};

#[repr(C)]
pub struct XimPreeditFont {
name: RustStr,
size: f64,
}
pub const KIME_API_VERSION: usize = 6;

#[repr(C)]
pub struct RustStr {
Expand All @@ -23,7 +22,11 @@ impl RustStr {
}
}

pub const KIME_API_VERSION: usize = 5;
#[repr(C)]
pub struct XimPreeditFont {
name: RustStr,
size: f64,
}

/// Return API version
#[no_mangle]
Expand Down Expand Up @@ -125,7 +128,10 @@ pub extern "C" fn kime_engine_press_key(
#[cfg(unix)]
#[no_mangle]
pub extern "C" fn kime_config_load() -> *mut Config {
Box::into_raw(Box::new(Config::load_from_config_dir().unwrap_or_default()))
let config = config_load_from_config_dir()
.map(|c| c.0)
.unwrap_or_default();
Box::into_raw(Box::new(config))
}

/// Create default config note that this function will not read config file
Expand Down Expand Up @@ -155,3 +161,61 @@ pub extern "C" fn kime_config_xim_preedit_font(config: &Config) -> XimPreeditFon
size,
}
}

/// Load daemon config
#[cfg(unix)]
#[no_mangle]
pub extern "C" fn kime_daemon_config_load() -> *mut DaemonConfig {
let config = config_load_from_config_dir()
.map(|c| c.1)
.unwrap_or_default();
Box::into_raw(Box::new(config))
}

/// Get daemon `modules`
#[no_mangle]
pub extern "C" fn kime_daemon_config_modules(config: &DaemonConfig) -> u32 /* enumset doesn't have transparent yet -> EnumSet<DaemonModule> */
{
config.modules.as_u32()
}

/// Get default daemon config
#[no_mangle]
pub extern "C" fn kime_daemon_config_default() -> *mut DaemonConfig {
Box::into_raw(Box::new(DaemonConfig::default()))
}

/// Delete daemon config
#[no_mangle]
pub unsafe extern "C" fn kime_daemon_config_delete(config: *mut DaemonConfig) {
Box::from_raw(config);
}

/// Load indicator config
#[cfg(unix)]
#[no_mangle]
pub extern "C" fn kime_indicator_config_load() -> *mut IndicatorConfig {
let config = config_load_from_config_dir()
.map(|c| c.2)
.unwrap_or_default();
Box::into_raw(Box::new(config))
}

/// Get default indicator config
#[no_mangle]
pub extern "C" fn kime_indicator_config_default() -> *mut IndicatorConfig {
Box::into_raw(Box::new(IndicatorConfig::default()))
}

/// Delete indicator config
#[no_mangle]
pub unsafe extern "C" fn kime_indicator_config_delete(config: *mut IndicatorConfig) {
Box::from_raw(config);
}

/// Get indicator `icon_color`
#[no_mangle]
pub extern "C" fn kime_indicator_config_icon_color(config: &IndicatorConfig) -> IconColor /* enumset doesn't have transparent yet -> EnumSet<DaemonModule> */
{
config.icon_color
}
2 changes: 1 addition & 1 deletion src/engine/cffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2018"
license = "GPL-3.0-or-later"

[dependencies]
cty = "0.2.1"
kime-engine-capi = { path = "../capi" }
kime-engine-config = { path = "../config" }

[build-dependencies]
bindgen = { version = "0.58.1", default-features = false }
Expand Down
2 changes: 0 additions & 2 deletions src/engine/cffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ fn main() {
.allowlist_var("kime::.+")
.allowlist_type("kime::.+")
.allowlist_function("kime::.+")
.use_core()
.ctypes_prefix("cty")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.unwrap();
Expand Down
Loading