EcoreEventCB, listener_);
visibility_change_ = ecore_event_handler_add(
ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE,
- EcoreEventCB, listener_);
+ EcoreEventCB, listener_);
pre_visibility_change_ = ecore_event_handler_add(
ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE,
EcoreEventCB, listener_);
wl_fixed_t pressure, wl_fixed_t angle,
uint32_t clas, uint32_t subclas,
const char *identifier, uint32_t time) = 0;
+ virtual void TransferKeyEvent(uint32_t event_type, int32_t keycode,
+ uint32_t clas, uint32_t subclas,
+ const char *identifier, uint32_t time) = 0;
virtual void TransferMouseWheel(uint32_t direction, int32_t z, uint32_t clas,
uint32_t subclas, const char *identifier,
uint32_t time) = 0;
identifier, time);
}
+ void TransferKeyEvent(uint32_t event_type, int32_t keycode,
+ uint32_t clas, uint32_t subclas,
+ const char *identifier, uint32_t time) override {
+ tizen_remote_surface_transfer_key_event(GetRaw(), event_type, keycode, clas,
+ subclas, identifier, time);
+ }
+
void TransferMouseEvent(uint32_t event_type, int32_t device,
int32_t button, int32_t x, int32_t y,
wl_fixed_t radius_x, wl_fixed_t radius_y,
const char *identifier, uint32_t time) override {
}
+ void TransferKeyEvent(uint32_t event_type, int32_t keycode,
+ uint32_t clas, uint32_t subclas,
+ const char *identifier, uint32_t time) override {
+ }
+
void TransferMouseWheel(uint32_t direction, int32_t z, uint32_t clas,
uint32_t subclas, const char *identifier,
uint32_t time) override {
namespace screen_connector {
ImageEventListener::ImageEventListener(RemoteSurface* parent)
- : parent_(parent), is_flick_enabled_(parent->GetType() == RemoteSurface::Type::WATCH) {
+ : parent_(parent),
+ is_flick_enabled_(parent->GetType() == RemoteSurface::Type::WATCH) {
+ if (is_flick_enabled_) {
+ key_down_ = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+ KeyDownCb, this);
+ key_up_ = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
+ KeyUpCb, this);
+ }
+}
+
+ImageEventListener::~ImageEventListener() {
+ if (key_down_)
+ ecore_event_handler_del(key_down_);
+ if (key_up_)
+ ecore_event_handler_del(key_up_);
+}
+
+Eina_Bool ImageEventListener::KeyUpCb(void* data, int type, void* event) {
+ ImageEventListener* listener = static_cast<ImageEventListener*>(data);
+ Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
+ listener->OnUpKey(keyEvent);
+ return ECORE_CALLBACK_RENEW;
+}
+
+Eina_Bool ImageEventListener::KeyDownCb(void* data, int type, void* event) {
+ ImageEventListener* listener = static_cast<ImageEventListener*>(data);
+ Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
+ listener->OnDownKey(keyEvent);
+ return ECORE_CALLBACK_RENEW;
+}
+
+void ImageEventListener::OnDownKey(void* eventInfo) {
+ if (eventInfo == nullptr) {
+ LOGE("Null eventinfo");
+ return;
+ }
+
+ Ecore_Event_Key* info = static_cast<Ecore_Event_Key*>(eventInfo);
+ LOGI("Down key (%d)", info->keycode);
+
+ const char* desc = ecore_device_description_get(info->dev);
+ if (desc == nullptr)
+ desc = "";
+ parent_->GetRaw()->TransferKeyEvent(TIZEN_REMOTE_SURFACE_EVENT_TYPE_KEY_DOWN,
+ info->keycode,
+ ecore_device_class_get(info->dev),
+ ecore_device_subclass_get(info->dev),
+ desc,
+ info->timestamp);
+}
+
+void ImageEventListener::OnUpKey(void* eventInfo) {
+ if (eventInfo == nullptr) {
+ LOGE("Null eventinfo");
+ return;
+ }
+ Ecore_Event_Key* info = static_cast<Ecore_Event_Key*>(eventInfo);
+ LOGI("Up key (%d)", info->keycode);
+
+ const char* desc = ecore_device_description_get(info->dev);
+ if (desc == nullptr)
+ desc = "";
+ parent_->GetRaw()->TransferKeyEvent(TIZEN_REMOTE_SURFACE_EVENT_TYPE_KEY_UP,
+ info->keycode,
+ ecore_device_class_get(info->dev),
+ ecore_device_subclass_get(info->dev),
+ desc,
+ info->timestamp);
}
void ImageEventListener::OnMouseIn(const EvasObject& obj,
#include <memory>
#include <string>
+#include <Ecore_Wl2.h>
+
#include "screen_connector_remote_surface_evas/evas_object.h"
#include "screen_connector_remote_surface/remote_surface.h"
#include "screen_connector_remote_surface/trs_interface.h"
class EXPORT_API ImageEventListener {
public:
ImageEventListener(RemoteSurface* parent);
+ virtual ~ImageEventListener();
virtual void OnMouseIn(const EvasObject& obj, void* eventInfo);
virtual void OnMouseOut(const EvasObject& obj, void* eventInfo);
virtual void OnMouseDown(const EvasObject& obj, void* eventInfo);
virtual void OnShow(const EvasObject& obj, void* eventInfo);
virtual void OnHide(const EvasObject& obj, void* eventInfo);
virtual void OnResize(const EvasObject& obj, void* eventInfo);
+ virtual void OnDownKey(void* eventInfo);
+ virtual void OnUpKey(void* eventInfo);
void SetInputEventFilter(uint32_t filter);
bool IsDisabledInput(ITRS::InputType type);
bool IsFlickEnabled(bool enable);
private:
+ static Eina_Bool KeyUpCb(void* data, int type, void* event);
+ static Eina_Bool KeyDownCb(void* data, int type, void* event);
+
+ private:
RemoteSurface* parent_ = nullptr;
bool is_flick_enabled_ = false;
uint32_t input_event_filter_ = 0;
bool flick_ = false;
int prev_y_ = 0;
+ Ecore_Event_Handler* key_down_ = nullptr;
+ Ecore_Event_Handler* key_up_ = nullptr;
};
}
wl_fixed_t pressure, wl_fixed_t angle,
uint32_t clas, uint32_t subclas,
const char *identifier, uint32_t time) = 0;
+ virtual void TransferKeyEvent(uint32_t event_type, int32_t keycode,
+ uint32_t clas, uint32_t subclas,
+ const char *identifier, uint32_t time) = 0;
virtual void TransferMouseWheel(uint32_t direction, int32_t z, uint32_t clas,
uint32_t subclas, const char *identifier,
uint32_t time) = 0;