diff options
-rw-r--r-- | ports/libsimpleservo/api/src/lib.rs | 8 | ||||
-rw-r--r-- | support/hololens/ServoApp/ServoControl/Servo.cpp | 27 | ||||
-rw-r--r-- | support/hololens/ServoApp/ServoControl/Servo.h | 1 | ||||
-rw-r--r-- | support/hololens/ServoApp/ServoControl/ServoControl.cpp | 4 | ||||
-rw-r--r-- | support/hololens/ServoApp/ServoControl/ServoControl.h | 1 |
5 files changed, 39 insertions, 2 deletions
diff --git a/ports/libsimpleservo/api/src/lib.rs b/ports/libsimpleservo/api/src/lib.rs index e4b065a7b40..a68cea55dbc 100644 --- a/ports/libsimpleservo/api/src/lib.rs +++ b/ports/libsimpleservo/api/src/lib.rs @@ -559,6 +559,12 @@ impl ServoGlue { EmbedderMsg::Shutdown => { self.callbacks.host_callbacks.on_shutdown_complete(); }, + EmbedderMsg::ShowIME(..) => { + self.callbacks.host_callbacks.on_ime_state_changed(true); + }, + EmbedderMsg::HideIME => { + self.callbacks.host_callbacks.on_ime_state_changed(false); + }, EmbedderMsg::Status(..) | EmbedderMsg::SelectFiles(..) | EmbedderMsg::MoveTo(..) | @@ -568,8 +574,6 @@ impl ServoGlue { EmbedderMsg::NewFavicon(..) | EmbedderMsg::HeadParsed | EmbedderMsg::SetFullscreenState(..) | - EmbedderMsg::ShowIME(..) | - EmbedderMsg::HideIME | EmbedderMsg::Panic(..) | EmbedderMsg::ReportProfile(..) => {}, } diff --git a/support/hololens/ServoApp/ServoControl/Servo.cpp b/support/hololens/ServoApp/ServoControl/Servo.cpp index efd59e44ab6..df9d58f8fe3 100644 --- a/support/hololens/ServoApp/ServoControl/Servo.cpp +++ b/support/hololens/ServoApp/ServoControl/Servo.cpp @@ -4,26 +4,37 @@ namespace winrt::servo { void on_load_started() { sServo->Delegate().OnServoLoadStarted(); } + void on_load_ended() { sServo->Delegate().OnServoLoadEnded(); } + void on_history_changed(bool back, bool forward) { sServo->Delegate().OnServoHistoryChanged(back, forward); } + void on_shutdown_complete() { sServo->Delegate().OnServoShutdownComplete(); } + void on_alert(const char *message) { sServo->Delegate().OnServoAlert(char2hstring(message)); } + void on_title_changed(const char *title) { sServo->Delegate().OnServoTitleChanged(char2hstring(title)); } + void on_url_changed(const char *url) { sServo->Delegate().OnServoURLChanged(char2hstring(url)); } + void flush() { sServo->Delegate().Flush(); } + void make_current() { sServo->Delegate().MakeCurrent(); } + void wakeup() { sServo->Delegate().WakeUp(); } + bool on_allow_navigation(const char *url) { return sServo->Delegate().OnServoAllowNavigation(char2hstring(url)); }; + void on_animating_changed(bool aAnimating) { sServo->Delegate().OnServoAnimatingChanged(aAnimating); } @@ -32,6 +43,19 @@ void on_panic(const char *backtrace) { throw hresult_error(E_FAIL, char2hstring(backtrace)); } +void on_ime_state_changed(bool aShow) { + sServo->Delegate().OnServoIMEStateChanged(aShow); +} + +void set_clipboard_contents(const char* content) { + // FIXME +} + +const char* get_clipboard_contents() { + // FIXME + return nullptr; +} + Servo::Servo(hstring url, GLsizei width, GLsizei height, ServoDelegate &aDelegate) : mWindowHeight(height), mWindowWidth(width), mDelegate(aDelegate) { @@ -59,6 +83,9 @@ Servo::Servo(hstring url, GLsizei width, GLsizei height, c.on_animating_changed = &on_animating_changed; c.on_shutdown_complete = &on_shutdown_complete; c.on_allow_navigation = &on_allow_navigation; + c.on_ime_state_changed = &on_ime_state_changed; + c.get_clipboard_contents = &get_clipboard_contents; + c.set_clipboard_contents = &set_clipboard_contents; capi::register_panic_handler(&on_panic); diff --git a/support/hololens/ServoApp/ServoControl/Servo.h b/support/hololens/ServoApp/ServoControl/Servo.h index b5a730ad523..bdfe7dc5e20 100644 --- a/support/hololens/ServoApp/ServoControl/Servo.h +++ b/support/hololens/ServoApp/ServoControl/Servo.h @@ -33,6 +33,7 @@ public: virtual void OnServoURLChanged(hstring) = 0; virtual bool OnServoAllowNavigation(hstring) = 0; virtual void OnServoAnimatingChanged(bool) = 0; + virtual void OnServoIMEStateChanged(bool) = 0; virtual void Flush() = 0; virtual void MakeCurrent() = 0; diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.cpp b/support/hololens/ServoApp/ServoControl/ServoControl.cpp index 9de129c1e4e..d0fcde7681f 100644 --- a/support/hololens/ServoApp/ServoControl/ServoControl.cpp +++ b/support/hololens/ServoApp/ServoControl/ServoControl.cpp @@ -254,6 +254,10 @@ void ServoControl::OnServoAnimatingChanged(bool animating) { WakeConditionVariable(&mGLCondVar); } +void ServoControl::OnServoIMEStateChanged(bool aShow) { + // FIXME: https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-implementingtextandtextrange +} + template <typename Callable> void ServoControl::RunOnUIThread(Callable cb) { Dispatcher().RunAsync(CoreDispatcherPriority::High, cb); } diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.h b/support/hololens/ServoApp/ServoControl/ServoControl.h index bd1d8a74d63..f8159ca8d6c 100644 --- a/support/hololens/ServoApp/ServoControl/ServoControl.h +++ b/support/hololens/ServoApp/ServoControl/ServoControl.h @@ -56,6 +56,7 @@ struct ServoControl : ServoControlT<ServoControl>, public servo::ServoDelegate { virtual void MakeCurrent(); virtual bool OnServoAllowNavigation(winrt::hstring); virtual void OnServoAnimatingChanged(bool); + virtual void OnServoIMEStateChanged(bool); private: winrt::event<Windows::Foundation::EventHandler<hstring>> mOnURLChangedEvent; |