#define DALI_INPUT_METHOD_CONTEXT_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
COMMIT, ///< Commit recieved
DELETE_SURROUNDING, ///< Event to delete a range of characters from the string
GET_SURROUNDING, ///< Event to query string and cursor position
- PRIVATE_COMMAND ///< Private command sent from the input panel
+ PRIVATE_COMMAND, ///< Private command sent from the input panel
+ SELECTION_SET ///< input method needs to set the selection
};
/**
: predictiveString(),
eventName(VOID),
cursorOffset(0),
- numberOfChars(0){};
+ numberOfChars(0),
+ startIndex(0),
+ endIndex(0){};
/**
* @brief Constructor
: predictiveString(aPredictiveString),
eventName(aEventName),
cursorOffset(aCursorOffset),
- numberOfChars(aNumberOfChars)
+ numberOfChars(aNumberOfChars),
+ startIndex(0),
+ endIndex(0)
+ {
+ }
+
+ /**
+ * @brief Constructor
+ *
+ * @param[in] aEventName The name of the event from the InputMethodContext.
+ * @param[in] aStartIndex The start index of selection.
+ * @param[in] aEndIndex The end index of selection.
+ */
+ EventData(EventType aEventName, int aStartIndex, int aEndIndex)
+ : predictiveString(),
+ eventName(aEventName),
+ cursorOffset(0),
+ numberOfChars(0),
+ startIndex(aStartIndex),
+ endIndex(aEndIndex)
{
}
EventType eventName; ///< The name of the event from the InputMethodContext.
int cursorOffset; ///< Start position from the current cursor position to start deleting characters.
int numberOfChars; ///< number of characters to delete from the cursorOffset.
+ int startIndex; ///< The start index of selection.
+ int endIndex; ///< The end index of selection.
};
/**
#define DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_IMPL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
}
+ /**
+ * @copydoc Dali::InputMethodContext::SendSelectionSet()
+ */
+ virtual void SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo)
+ {
+ }
+
// Cursor related
/**
* @copydoc Dali::InputMethodContext::NotifyCursorPosition()
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextGeneric::SendCommitContent\n");
}
+void InputMethodContextGeneric::SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo)
+{
+ DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextGeneric::SendSelectionSet\n");
+}
+
void InputMethodContextGeneric::NotifyCursorPosition()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextGeneric::NotifyCursorPosition\n");
#define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_GENERIC_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void SendCommitContent(void* data, ImfContext* imfContext, void* eventInfo) override;
+ /**
+ * @copydoc Dali::InputMethodContext::SendSelectionSet()
+ */
+ void SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo) override;
+
// Cursor related
/**
* @copydoc Dali::InputMethodContext::NotifyCursorPosition()
#pragma once
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
}
+ /**
+ * @copydoc Dali::InputMethodContext::SendSelectionSet()
+ */
+ void SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo) override
+ {
+ }
+
// Cursor related
/**
* @copydoc Dali::InputMethodContext::NotifyCursorPosition()
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
}
+/**
+ * Called when the input method sends a selection set.
+ */
+void SelectionSet(void* data, Ecore_IMF_Context* imfContext, void* eventInfo)
+{
+ if(data)
+ {
+ InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
+ inputMethodContext->SendSelectionSet(data, imfContext, eventInfo);
+ }
+}
+
int GetWindowIdFromActor(Dali::Actor actor)
{
int windowId = kUninitializedWindowId;
ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this);
ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, PrivateCommand, this);
ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_COMMIT_CONTENT, CommitContent, this);
+ ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_SELECTION_SET, SelectionSet, this);
ecore_imf_context_input_panel_event_callback_add(mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, InputPanelStateChangeCallback, this);
ecore_imf_context_input_panel_event_callback_add(mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback, this);
ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding);
ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, PrivateCommand);
ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_COMMIT_CONTENT, CommitContent);
+ ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_SELECTION_SET, SelectionSet);
ecore_imf_context_input_panel_event_callback_del(mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, InputPanelStateChangeCallback);
ecore_imf_context_input_panel_event_callback_del(mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback);
}
}
+/**
+ * Called when the input method selection set.
+ */
+void InputMethodContextEcoreWl::SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo)
+{
+ DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendCommitContent\n");
+
+ if(Dali::Adaptor::IsAvailable())
+ {
+ Ecore_IMF_Event_Selection* selection = static_cast<Ecore_IMF_Event_Selection*>(eventInfo);
+ if(selection)
+ {
+ DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendSelectionSet selection start index : %d, end index : %d\n", selection->start, selection->end);
+ Dali::InputMethodContext::EventData imfData(Dali::InputMethodContext::SELECTION_SET, selection->start, selection->end);
+ Dali::InputMethodContext handle(this);
+ mEventSignal.Emit(handle, imfData);
+ }
+ }
+}
+
void InputMethodContextEcoreWl::NotifyCursorPosition()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::NotifyCursorPosition\n");
#define DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_ECORE_WL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void SendCommitContent(void* data, ImfContext* imfContext, void* eventInfo) override;
+ /**
+ * @copydoc Dali::InputMethodContext::SendSelectionSet()
+ */
+ void SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo) override;
+
// Cursor related
/**
* @copydoc Dali::InputMethodContext::NotifyCursorPosition()
#define DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_X_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
}
+ /**
+ * @copydoc Dali::InputMethodContext::SendSelectionSet()
+ */
+ void SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo) override
+ {
+ }
+
// Cursor related
/**
* @copydoc Dali::InputMethodContext::NotifyCursorPosition()
#define DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_WIN_H\r
\r
/*\r
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
{\r
}\r
\r
+ /**\r
+ * @copydoc Dali::InputMethodContext::SendSelectionSet()\r
+ */\r
+ void SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo) override\r
+ {\r
+ }\r
+\r
// Cursor related\r
/**\r
* @copydoc Dali::InputMethodContext::NotifyCursorPosition()\r