Skip to content
This repository was archived by the owner on Nov 29, 2024. It is now read-only.
Merged
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
170 changes: 156 additions & 14 deletions patches/librime.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 16082869..c4a5b5ca 100644
index 16082869..97824aa5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -166,6 +166,8 @@ if(BUILD_SHARED_LIBS)
@@ -166,6 +166,13 @@ if(BUILD_SHARED_LIBS)
else()
add_library(rime-static STATIC ${rime_src})
target_link_libraries(rime-static ${rime_deps})
+ target_link_options(rime-static PUBLIC
+ LINKER:-U,_f5m_is_linear_layout
+ LINKER:-U,_f5m_is_vertical_lr
+ LINKER:-U,_f5m_is_vertical_rl
+ )
+ target_compile_options(rime-static PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")
+ target_compile_definitions(rime-static PRIVATE BOOST_DISABLE_CURRENT_LOCATION)
set_target_properties(rime-static PROPERTIES
Expand Down Expand Up @@ -43,25 +48,162 @@ index 2e1c8b81..94a6b500 100644

protected:
Engine();
diff --git a/src/rime/gear/navigator.cc b/src/rime/gear/navigator.cc
index 9a2d128d..0b9d201c 100644
--- a/src/rime/gear/navigator.cc
+++ b/src/rime/gear/navigator.cc
@@ -15,6 +15,9 @@
#include <rime/gear/navigator.h>
#include <rime/gear/translator_commons.h>

+extern bool f5m_is_vertical_lr;
+extern bool f5m_is_vertical_rl;
+
namespace rime {

static Navigator::ActionDef navigation_actions[] = {
@@ -69,7 +72,7 @@ ProcessResult Navigator::ProcessKeyEvent(const KeyEvent& key_event) {
if (!ctx->IsComposing())
return kNoop;
TextOrientation text_orientation =
- ctx->get_option("_vertical") ? Vertical : Horizontal;
+ (f5m_is_vertical_lr || f5m_is_vertical_rl) ? Vertical : Horizontal;
return KeyBindingProcessor::ProcessKeyEvent(key_event, ctx, text_orientation,
FallbackOptions::All);
}
diff --git a/src/rime/gear/selector.cc b/src/rime/gear/selector.cc
index 06874103..0c4db888 100644
index 06874103..b83e815d 100644
--- a/src/rime/gear/selector.cc
+++ b/src/rime/gear/selector.cc
@@ -50,10 +50,10 @@ Selector::Selector(const Ticket& ticket)
keymap.Bind({XK_KP_Left, 0}, &Selector::PreviousCandidate);
keymap.Bind({XK_Right, 0}, &Selector::NextCandidate);
keymap.Bind({XK_KP_Right, 0}, &Selector::NextCandidate);
- keymap.Bind({XK_Up, 0}, &Selector::PreviousPage);
- keymap.Bind({XK_KP_Up, 0}, &Selector::PreviousPage);
- keymap.Bind({XK_Down, 0}, &Selector::NextPage);
- keymap.Bind({XK_KP_Down, 0}, &Selector::NextPage);
@@ -14,6 +14,10 @@
#include <rime/schema.h>
#include <rime/gear/selector.h>

+extern bool f5m_is_vertical_lr;
+extern bool f5m_is_vertical_rl;
+extern bool f5m_is_linear_layout;
+
namespace rime {

static Selector::ActionDef selector_actions[] = {
@@ -64,7 +68,7 @@ Selector::Selector(const Ticket& ticket)
keymap.Bind({XK_KP_End, 0}, &Selector::End);
}
{
- auto& keymap = get_keymap(Vertical | Stacked);
+ auto& keymap = get_keymap(VerticalRL | Stacked);
keymap.Bind({XK_Right, 0}, &Selector::PreviousCandidate);
keymap.Bind({XK_KP_Right, 0}, &Selector::PreviousCandidate);
keymap.Bind({XK_Left, 0}, &Selector::NextCandidate);
@@ -79,7 +83,7 @@ Selector::Selector(const Ticket& ticket)
keymap.Bind({XK_KP_End, 0}, &Selector::End);
}
{
- auto& keymap = get_keymap(Vertical | Linear);
+ auto& keymap = get_keymap(VerticalRL | Linear);
keymap.Bind({XK_Up, 0}, &Selector::PreviousCandidate);
keymap.Bind({XK_KP_Up, 0}, &Selector::PreviousCandidate);
keymap.Bind({XK_Down, 0}, &Selector::NextCandidate);
@@ -97,12 +101,46 @@ Selector::Selector(const Ticket& ticket)
keymap.Bind({XK_End, 0}, &Selector::End);
keymap.Bind({XK_KP_End, 0}, &Selector::End);
}
+ {
+ auto& keymap = get_keymap(VerticalLR | Stacked);
+ keymap.Bind({XK_Right, 0}, &Selector::NextCandidate);
+ keymap.Bind({XK_KP_Right, 0}, &Selector::NextCandidate);
+ keymap.Bind({XK_Left, 0}, &Selector::PreviousCandidate);
+ keymap.Bind({XK_KP_Left, 0}, &Selector::PreviousCandidate);
+ keymap.Bind({XK_Prior, 0}, &Selector::PreviousPage);
+ keymap.Bind({XK_KP_Prior, 0}, &Selector::PreviousPage);
+ keymap.Bind({XK_Next, 0}, &Selector::NextPage);
+ keymap.Bind({XK_KP_Next, 0}, &Selector::NextPage);
+ keymap.Bind({XK_Home, 0}, &Selector::Home);
+ keymap.Bind({XK_KP_Home, 0}, &Selector::Home);
+ keymap.Bind({XK_End, 0}, &Selector::End);
+ keymap.Bind({XK_KP_End, 0}, &Selector::End);
+ }
+ {
+ auto& keymap = get_keymap(VerticalLR | Linear);
+ keymap.Bind({XK_Up, 0}, &Selector::PreviousCandidate);
+ keymap.Bind({XK_KP_Up, 0}, &Selector::PreviousCandidate);
+ keymap.Bind({XK_Down, 0}, &Selector::NextCandidate);
+ keymap.Bind({XK_KP_Down, 0}, &Selector::NextCandidate);
keymap.Bind({XK_Prior, 0}, &Selector::PreviousPage);
keymap.Bind({XK_KP_Prior, 0}, &Selector::PreviousPage);
keymap.Bind({XK_Next, 0}, &Selector::NextPage);
+ keymap.Bind({XK_Right, 0}, &Selector::NextPage);
+ keymap.Bind({XK_KP_Right, 0}, &Selector::NextPage);
+ keymap.Bind({XK_Left, 0}, &Selector::PreviousPage);
+ keymap.Bind({XK_KP_Left, 0}, &Selector::PreviousPage);
+ keymap.Bind({XK_Prior, 0}, &Selector::PreviousPage);
+ keymap.Bind({XK_KP_Prior, 0}, &Selector::PreviousPage);
+ keymap.Bind({XK_Next, 0}, &Selector::NextPage);
+ keymap.Bind({XK_KP_Next, 0}, &Selector::NextPage);
+ keymap.Bind({XK_Home, 0}, &Selector::Home);
+ keymap.Bind({XK_KP_Home, 0}, &Selector::Home);
+ keymap.Bind({XK_End, 0}, &Selector::End);
+ keymap.Bind({XK_KP_End, 0}, &Selector::End);
+ }

Config* config = engine_->schema()->config();
LoadConfig(config, "selector", Horizontal | Stacked);
LoadConfig(config, "selector/linear", Horizontal | Linear);
- LoadConfig(config, "selector/vertical", Vertical | Stacked);
- LoadConfig(config, "selector/vertical/linear", Vertical | Linear);
+ LoadConfig(config, "selector/vertical", VerticalRL | Stacked);
+ LoadConfig(config, "selector/vertical/linear", VerticalRL | Linear);
}

inline static bool is_vertical_text(Context* ctx) {
@@ -126,9 +164,11 @@ ProcessResult Selector::ProcessKeyEvent(const KeyEvent& key_event) {
return kNoop;

TextOrientation text_orientation =
- is_vertical_text(ctx) ? Vertical : Horizontal;
+ f5m_is_vertical_rl ? VerticalRL :
+ f5m_is_vertical_lr ? VerticalLR :
+ Horizontal;
CandidateListLayout candidate_list_layout =
- is_linear_layout(ctx) ? Linear : Stacked;
+ f5m_is_linear_layout ? Linear : Stacked;
auto result = KeyBindingProcessor::ProcessKeyEvent(
key_event, ctx, text_orientation | candidate_list_layout,
FallbackOptions::None);
@@ -197,7 +237,7 @@ inline static bool caret_at_end_of_input(Context* ctx) {
}

bool Selector::PreviousCandidate(Context* ctx) {
- if (is_linear_layout(ctx) && !caret_at_end_of_input(ctx)) {
+ if (f5m_is_linear_layout && !caret_at_end_of_input(ctx)) {
// let navigator handle the arrow key.
return false;
}
@@ -207,7 +247,7 @@ bool Selector::PreviousCandidate(Context* ctx) {
int index = comp.back().selected_index;
if (index <= 0) {
// in case of linear layout, fall back to navigator
- return !is_linear_layout(ctx);
+ return !f5m_is_linear_layout;
}
comp.back().selected_index = index - 1;
comp.back().tags.insert("paging");
diff --git a/src/rime/gear/selector.h b/src/rime/gear/selector.h
index 5e4bfce0..e88aace0 100644
--- a/src/rime/gear/selector.h
+++ b/src/rime/gear/selector.h
@@ -14,11 +14,12 @@

namespace rime {

-class Selector : public Processor, public KeyBindingProcessor<Selector, 4> {
+class Selector : public Processor, public KeyBindingProcessor<Selector, 8> {
public:
enum TextOrientation {
Horizontal = 0,
- Vertical = 1,
+ VerticalRL = 1,
+ VerticalLR = 4,
};
enum CandidateListLayout {
Stacked = 0,
diff --git a/src/rime/service.h b/src/rime/service.h
index 2b3111af..95ca87dc 100644
--- a/src/rime/service.h
Expand Down
Loading