From 4bdaeb97f97535e3144dd982b2db5581a25f1bfa Mon Sep 17 00:00:00 2001 From: Nick Holland Date: Tue, 26 Apr 2016 10:05:09 +0100 Subject: [PATCH] Updated Wayland TextInput to match latest system changes Change-Id: Ife9920178b8fb1f147c8964b1bdc8b3c6b83c0c0 --- adaptors/wayland/input/text/text-input-interface.h | 37 +++++++++++++++++----- .../wayland/input/text/text-input-listeners.cpp | 28 ++++++++++++---- adaptors/wayland/input/text/text-input-manager.cpp | 9 ++++++ adaptors/wayland/input/text/text-input-manager.h | 8 +++++ 4 files changed, 67 insertions(+), 15 deletions(-) diff --git a/adaptors/wayland/input/text/text-input-interface.h b/adaptors/wayland/input/text/text-input-interface.h index 3d23c89..f993e9f 100644 --- a/adaptors/wayland/input/text/text-input-interface.h +++ b/adaptors/wayland/input/text/text-input-interface.h @@ -55,7 +55,7 @@ public: * @brief Notify the text input has received focus. Typically in response to an activate request. * * @param[in] seat the seat that produced the event - * @param[in] serial serial number + * @param[in] surface wayland surface */ virtual void Enter( Seat* seat, WlSurface* surface ) = 0; @@ -135,6 +135,7 @@ public: * * @param[in] seat the seat that produced the event * @param[in] serial of the latest known text input state + * @param[in] text the text to commit */ virtual void CommitString( Seat* seat, uint32_t serial, const char *text ) = 0; @@ -170,6 +171,10 @@ public: * (where the modifier indices are set by the modifiers_map event) * @param[in] seat the seat that produced the event * @param[in] serial of the latest known text input state + * @param[in] time time stamp + * @param[in] sym symbol + * @param[in] state state + * @param[in] modifiers modifiers */ virtual void Keysym( Seat* seat, uint32_t serial, @@ -182,7 +187,7 @@ public: * @brief Set the language of the input text. * @param[in] seat the seat that produced the event * @param[in] serial of the latest known text input state - * @param[in] The "language" argument is a RFC-3066 format language tag. + * @param[in] language The "language" argument is a RFC-3066 format language tag. */ virtual void Language( Seat* seat, uint32_t serial, const char *language ) = 0; @@ -194,6 +199,7 @@ public: * direction text is laid out properly. * * @param[in] seat the seat that produced the event + * @param[in] serial of the latest known text input state * @param[in] direction ( see text_direction enum in wayland-extension/protocol/text.xml ) */ virtual void TextDirection( Seat* seat, uint32_t serial, uint32_t direction ) = 0; @@ -204,8 +210,8 @@ public: * * @param[in] seat the seat that produced the event * @param[in] serial of the latest known text input state - * @param[in] start index - * @param[in] start index + * @param[in] start start index + * @param[in] end end index */ virtual void SelectionRegion( Seat* seat, uint32_t serial, int32_t start, int32_t end) = 0; @@ -213,12 +219,13 @@ public: * @brief Notify when the input panels ask to send private command * @param[in] seat the seat that produced the event * @param[in] serial of the latest known text input state - * @param[in] start index + * @param[in] command private command string */ virtual void PrivateCommand( Seat* seat, uint32_t serial, const char *command) = 0; /** - * @ Notify when the geometry of the input panel changed. + * @brief Notify when the geometry of the input panel changed. + * @param[in] seat the seat that produced the event * @param[in] x position * @param[in] y position * @param[in] width panel width @@ -230,11 +237,25 @@ public: uint32_t width, uint32_t height) = 0; + /** + * @brief Notify when the input panels ask to send input panel data + * Not sure what this is for exactly + * @param[in] seat the seat that produced the event + * @param[in] serial of the latest known text input state + * @param[in] data input panel data + * @param[in] dataLength data length + * + */ + virtual void InputPanelData( Seat* seat, + uint32_t serial, + const char* data, + uint32_t dataLength ) = 0; + public: // Helper functions used to find the seat associated with the keyboard/pointer/touch device /** - * @brief get the seat that contains the keyboard interface - * @param[in] keyboard wayland keyboard interface + * @brief get the seat that contains the text input interface + * @param[in] textInput wayland textinput interface * @return the seat the keyboard belongs to */ virtual Seat* GetSeat( const WlTextInput* textInput) = 0; diff --git a/adaptors/wayland/input/text/text-input-listeners.cpp b/adaptors/wayland/input/text/text-input-listeners.cpp index 61c4218..c4502ef 100644 --- a/adaptors/wayland/input/text/text-input-listeners.cpp +++ b/adaptors/wayland/input/text/text-input-listeners.cpp @@ -17,12 +17,6 @@ // CLASS HEADER #include "text-input-listeners.h" -/* -// EXTERNAL INCLUDES -#include -#include -*/ - // INTERNAL INCLUDES #include #include @@ -204,6 +198,25 @@ void InputPanelGeometry(void* data, input->InputPanelGeometry( seat, x, y, width, height ); } +void InputPanelData( void* data, + WlTextInput* textInput, + uint32_t serial, + const char* input_panel_data, + uint32_t input_panel_data_length) +{ + TextInputInterface* input = static_cast< TextInputInterface* >( data ); + Seat* seat = input->GetSeat( textInput ); + + input->InputPanelData( seat, serial, input_panel_data, input_panel_data_length); +} + + +/** + * If when running DALi on target a message like + * listener function for opcode 16 of wl_text_input is NULL, + * then it means the interface has been updated, and they've added an extra function + * to the listener + */ const WlTextInputListener TextInputListener = { Enter, @@ -221,7 +234,8 @@ const WlTextInputListener TextInputListener = TextDirection, SelectionRegion, PrivateCommand, - InputPanelGeometry + InputPanelGeometry, + InputPanelData }; } // unnamed namespace diff --git a/adaptors/wayland/input/text/text-input-manager.cpp b/adaptors/wayland/input/text/text-input-manager.cpp index 001884b..37faf0f 100644 --- a/adaptors/wayland/input/text/text-input-manager.cpp +++ b/adaptors/wayland/input/text/text-input-manager.cpp @@ -284,6 +284,15 @@ void TextInputManager::InputPanelGeometry( Seat* seat, } } +void TextInputManager::InputPanelData( Seat* seat, + uint32_t serial, + const char* data, + uint32_t dataLength ) +{ + mLastActiveSeat = seat; + // unsure what this function in the text protocol is used for due to limited documentation +} + TextInputManager::SeatInfo& TextInputManager::GetLastActiveSeat() { SeatInfo* currentSeat = &mSeats[ 0 ]; diff --git a/adaptors/wayland/input/text/text-input-manager.h b/adaptors/wayland/input/text/text-input-manager.h index d40b74e..3c24fb6 100644 --- a/adaptors/wayland/input/text/text-input-manager.h +++ b/adaptors/wayland/input/text/text-input-manager.h @@ -170,6 +170,14 @@ private: // TextInputInterface virtual void InputPanelGeometry( Seat* seat, uint32_t x, uint32_t y, uint32_t width, uint32_t height ); /** + * @copydoc TextInputInterface::InputPanelData + */ + virtual void InputPanelData( Seat* seat, + uint32_t serial, + const char* data, + uint32_t dataLength ); + + /** * @copydoc TextInputInterface::GetSeat */ virtual Seat* GetSeat( const WlTextInput* textInput ); -- 2.7.4