}
}
-void CSCLConnectionISF::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
+sclint CSCLConnectionISF::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
{
if (m_initialized) {
scim::String surrounding_text;
m_helper_agent.get_surrounding_text(maxlen_before, maxlen_after, surrounding_text, cursor);
- if (text)
+ if (text) {
*text = strdup(surrounding_text.c_str());
+ if (*text == NULL) {
+ return -1;
+ }
+ }
}
+ return 0;
}
void CSCLConnectionISF::delete_surrounding_text(sclint offset, sclint len) const
void get_keyboard_ise(const sclchar *uuid);
void set_selection(sclint start, sclint end);
void send_private_command(const char *command);
- void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
+ sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
void get_selection_text(sclchar **text);
private:
sclboolean m_initialized;
}
}
-void CSCLConnection::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
+sclint CSCLConnection::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
{
+ sclint ret = -1;
if (m_impl) {
- m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
+ ret = m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
}
+ return ret;
}
void CSCLConnection::delete_surrounding_text(sclint offset, sclint len) const
virtual void get_keyboard_ise(const sclchar *uuid);
virtual void set_selection(sclint start, sclint end);
virtual void send_private_command(const sclchar *command);
- virtual void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
+ virtual sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
virtual void get_selection_text(sclchar **text);
protected:
std::string m_backend_identifier;
}
}
-void CSCLCore::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const
+sclint CSCLCore::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const
{
+ sclint ret = -1;
if (m_impl) {
- m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
+ ret = m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
}
+ return ret;
}
void CSCLCore::delete_surrounding_text(sclint offset, sclint len) const
* @param[in] maxlen_after The max length of after.
* @param[out] text The surrounding text.
* @param[out] cursor The cursor position.
+ *
+ * @return 0 on success, otherwise a negative error value
*/
- void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const;
+ sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const;
/**
* @brief Get the selected text.
m_connection.get_surrounding_text(ic_uuid, maxlen_before, maxlen_after);
}
-void CSCLCoreImpl::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
+sclint CSCLCoreImpl::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
{
- m_connection.get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
+ return m_connection.get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
}
void CSCLCoreImpl::delete_surrounding_text(sclint offset, sclint len) const
void set_selection(sclint start, sclint end);
void send_private_command(const sclchar *command);
- void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
+ sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
void get_selection_text(sclchar **text);
private: