From 1ad8656f35e499c5b4f22fea50f2a8b619f049ca Mon Sep 17 00:00:00 2001 From: Inhong Han Date: Thu, 9 May 2024 11:30:26 +0900 Subject: [PATCH] Support for aligning the floating IME Change-Id: Ifa57f147a916f1863c8c27ea36cc5f602e92c54c --- src/sclconnection-isf.cpp | 18 ++++++++++++++++++ src/sclconnection-isf.h | 1 + src/sclconnection.cpp | 7 +++++++ src/sclconnection.h | 1 + src/sclcore.cpp | 7 +++++++ src/sclcore.h | 5 +++++ src/sclcorecallback.h | 1 + src/sclcoreimpl.cpp | 5 +++++ src/sclcoreimpl.h | 1 + 9 files changed, 46 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 2e62e28..0308d57 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -775,6 +775,16 @@ static void slot_set_input_hint(const scim::HelperAgent *agent, scim::uint32 &in } } +static void slot_set_position_align(const scim::HelperAgent *agent, scim::uint32 &x, scim::uint32 &y, scim::uint32 &align) { + CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); + if (impl) { + ISCLCoreEventCallback *callback = impl->get_core_event_callback(); + if (callback) { + callback->on_set_position_align(x, y, align); + } + } +} + /* Internal input handler function */ Eina_Bool input_handler(void *data, Ecore_Fd_Handler *fd_handler) { @@ -878,6 +888,7 @@ sclboolean CSCLConnectionISF::init() m_helper_agent.signal_connect_set_autocapital_type(scim::slot(slot_set_autocapital_type)); m_helper_agent.signal_connect_set_prediction_allow(scim::slot(slot_set_prediction_allow)); m_helper_agent.signal_connect_set_input_hint(scim::slot(slot_set_input_hint)); + m_helper_agent.signal_connect_set_position_align(scim::slot(slot_set_position_align)); m_initialized = TRUE; } @@ -1492,6 +1503,13 @@ void CSCLConnectionISF::set_floating_drag_enabled(sclboolean enabled) } } +void CSCLConnectionISF::move_resize_floating_window(sclint x, sclint y, sclint w, sclint h) +{ + if (m_initialized) { + m_helper_agent.move_resize_floating_window(x, y, w, h); + } +} + extern "C" { EXAPI void scim_module_init(void) { diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h index 1d1f847..61e4742 100644 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -101,6 +101,7 @@ public: void send_key_event_processing_result(scim::KeyEvent &key, sclu32 serial, sclboolean is_success); void set_floating_mode(sclboolean floating_mode); void set_floating_drag_enabled(sclboolean enabled); + void move_resize_floating_window(sclint x, sclint y, sclint w, sclint h); private: sclboolean m_initialized; diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp index 7e8be62..25cb024 100644 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -455,4 +455,11 @@ void CSCLConnection::set_floating_drag_enabled(sclboolean enabled) if (m_impl) { m_impl->set_floating_drag_enabled(enabled); } +} + +void CSCLConnection::move_resize_floating_window(sclint x, sclint y, sclint w, sclint h) +{ + if (m_impl) { + m_impl->move_resize_floating_window(x, y, w, h); + } } \ No newline at end of file diff --git a/src/sclconnection.h b/src/sclconnection.h index 80a5722..f5585f6 100644 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -107,6 +107,7 @@ public: virtual void send_key_event_processing_result(scim::KeyEvent &key, sclu32 serial, sclboolean is_success); virtual void set_floating_mode(sclboolean floating_mode); virtual void set_floating_drag_enabled(sclboolean enabled); + virtual void move_resize_floating_window(sclint x, sclint y, sclint w, sclint h); protected: std::string m_backend_identifier; diff --git a/src/sclcore.cpp b/src/sclcore.cpp index 781ad8a..6dcabcd 100644 --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -465,6 +465,13 @@ void CSCLCore::set_floating_drag_enabled(sclboolean enabled) } } +void CSCLCore::move_resize_floating_window(sclint x, sclint y, sclint w, sclint h) +{ + if (m_impl) { + m_impl->move_resize_floating_window(x, y, w, h); + } +} + void CSCLCore::set_window_creation_defer_flag(sclboolean flag) { if (m_impl) { diff --git a/src/sclcore.h b/src/sclcore.h index 78d4534..4b09577 100644 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -474,6 +474,11 @@ public: */ void set_floating_drag_enabled(sclboolean enabled); + /** + * @brief Request to move and resize the floating ISE. + */ + void move_resize_floating_window(sclint x, sclint y, sclint w, sclint h); + /** * @brief Request to defer creating window until the window object gets accessed. */ diff --git a/src/sclcorecallback.h b/src/sclcorecallback.h index 08dbe9f..6af86e6 100644 --- a/src/sclcorecallback.h +++ b/src/sclcorecallback.h @@ -101,6 +101,7 @@ struct ISCLCoreEventCallback { virtual void on_set_autocapital_type(sclu32 type) {} virtual void on_set_prediction_allow(sclu32 prediction_allow) {} virtual void on_set_input_hint(sclu32 input_hint) {} + virtual void on_set_position_align(sclu32 x, sclu32 y, sclu32 align) {} virtual void on_trigger_property(const sclchar *property) {} ISCLCoreEventCallback() { diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index a04e18d..9dadd64 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -426,6 +426,11 @@ void CSCLCoreImpl::set_floating_drag_enabled(sclboolean enabled) m_connection.set_floating_drag_enabled(enabled); } +void CSCLCoreImpl::move_resize_floating_window(sclint x, sclint y, sclint w, sclint h) +{ + m_connection.move_resize_floating_window(x, y, w, h); +} + void CSCLCoreImpl::set_window_creation_defer_flag(sclboolean flag) { LOGD("defer_flag %d", flag); diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h index 65a76c7..65009b1 100644 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -111,6 +111,7 @@ public: void commit_content(const sclchar *content, const sclchar *description, const sclchar *mime_types); void set_floating_mode(sclboolean floating_mode); void set_floating_drag_enabled(sclboolean enabled); + void move_resize_floating_window(sclint x, sclint y, sclint w, sclint h); void set_window_creation_defer_flag(sclboolean flag); void update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret); -- 2.34.1