File tree 4 files changed +11
-11
lines changed
4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,11 @@ class Engine : public Messenger {
31
31
Context* context () const { return context_.get (); }
32
32
CommitSink& sink () { return sink_; }
33
33
34
- Context* active_context () const {
35
- return active_context_ ? active_context_ : context_. get () ;
34
+ Engine* active_engine () {
35
+ return active_engine_ ? active_engine_ : this ;
36
36
}
37
- void set_active_context (Context* context = nullptr ) {
38
- active_context_ = context ;
37
+ void set_active_engine (Engine* engine = nullptr ) {
38
+ active_engine_ = engine ;
39
39
}
40
40
41
41
RIME_API static Engine* Create ();
@@ -46,7 +46,7 @@ class Engine : public Messenger {
46
46
the<Schema> schema_;
47
47
the<Context> context_;
48
48
CommitSink sink_;
49
- Context* active_context_ = nullptr ;
49
+ Engine* active_engine_ = nullptr ;
50
50
};
51
51
52
52
} // namespace rime
Original file line number Diff line number Diff line change @@ -56,11 +56,11 @@ void Session::OnCommit(const string& commit_text) {
56
56
}
57
57
58
58
Context* Session::context () const {
59
- return engine_ ? engine_->active_context () : NULL ;
59
+ return engine_ ? engine_->active_engine ()-> context () : NULL ;
60
60
}
61
61
62
62
Schema* Session::schema () const {
63
- return engine_ ? engine_->schema () : NULL ;
63
+ return engine_ ? engine_->active_engine ()-> schema () : NULL ;
64
64
}
65
65
66
66
Service::Service () {
Original file line number Diff line number Diff line change @@ -189,13 +189,13 @@ void Switcher::Activate() {
189
189
LOG (INFO) << " switcher is activated." ;
190
190
context_->set_option (" _fold_options" , fold_options_);
191
191
RefreshMenu ();
192
- engine_->set_active_context (context_. get () );
192
+ engine_->set_active_engine ( this );
193
193
active_ = true ;
194
194
}
195
195
196
196
void Switcher::Deactivate () {
197
197
context_->Clear ();
198
- engine_->set_active_context ();
198
+ engine_->set_active_engine ();
199
199
active_ = false ;
200
200
}
201
201
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ class RimeConsole {
53
53
const Segment ¤t (comp.back ());
54
54
if (!current.menu )
55
55
return ;
56
- int page_size = engine_->schema ()->page_size ();
56
+ int page_size = engine_->active_engine ()-> schema ()->page_size ();
57
57
int page_no = current.selected_index / page_size;
58
58
the<Page> page (current.menu ->CreatePage (page_size, page_no));
59
59
if (!page)
@@ -81,7 +81,7 @@ class RimeConsole {
81
81
for (const KeyEvent &key : keys) {
82
82
engine_->ProcessKey (key);
83
83
}
84
- Context *ctx = engine_->active_context ();
84
+ Context *ctx = engine_->active_engine ()-> context ();
85
85
if (interactive_) {
86
86
PrintComposition (ctx);
87
87
}
You can’t perform that action at this time.
0 commit comments