#ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_HANDLE_H_
#define SCREEN_CONNECTOR_REMOTE_SURFACE_HANDLE_H_
-#include <Ecore_Wl2.h>
#include <wayland-extension/tizen-extension-client-protocol.h>
#include <tizen-remote-surface-client-protocol.h>
#include <tbm_surface.h>
TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM |TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE}
};
-std::map<int, uint32_t> RemoteSurface::Impl::input_type_table_ = {
- {MOUSE_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_UP_DOWN},
- {MOUSE_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X},
- {MOUSE_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_Y},
- {MOUSE_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X_Y},
- {MOUSE_WHEEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_WHEEL_ALL},
- {TOUCH_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_UP_DOWN},
- {TOUCH_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X},
- {TOUCH_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_Y},
- {TOUCH_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X_Y},
- {TOUCH_CANCEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_CANCEL_ALL},
- {KEY, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_KEY_ALL}
-};
-
void RemoteSurface::InitManager() {
(void)RemoteSurfaceManager::GetInst();
}
impl_->block_ = is_block;
}
-bool RemoteSurface::IsDisabledInput(InputType type) const {
- return ((impl_->input_event_filter_ & impl_->input_type_table_[type]) > 0);
-}
-
void RemoteSurface::OnBufferAdded(const std::string& appId,
const std::string& instId, int pid) {
}
FILTER_ALL
};
- enum InputType {
- MOUSE_UP_DOWN,
- MOUSE_MOVE_X,
- MOUSE_MOVE_Y,
- MOUSE_MOVE_X_Y,
- MOUSE_WHEEL,
- TOUCH_UP_DOWN,
- TOUCH_MOVE_X,
- TOUCH_MOVE_Y,
- TOUCH_MOVE_X_Y,
- TOUCH_CANCEL,
- KEY
- };
-
RemoteSurface(const std::string& id, Type type,
std::shared_ptr<WlSurface> wl_surface, bool mock = false);
RemoteSurface(int rid, const std::string& id, Type type,
void Freeze(bool visible);
void Thaw();
virtual void SetChangedEventFilter(ChangedEventFilter filter);
- bool IsDisabledInput(InputType type) const;
bool IsRemoteRender() const;
void ClearRemoteRender();
int SetRemoteRender();
Name: screen_connector_remote_surface
Description: Support development of the screen connector remote surface library
Version: @VERSION@
+Requires: ecore-wl2
Libs: -L${libdir} -lscreen_connector_remote_surface
Cflags: -I${includedir}
cppflags: -I${includedir}
virtual void OnInputFilterChanged(uint32_t event_filter) = 0;
};
+ enum InputType {
+ MOUSE_UP_DOWN,
+ MOUSE_MOVE_X,
+ MOUSE_MOVE_Y,
+ MOUSE_MOVE_X_Y,
+ MOUSE_WHEEL,
+ TOUCH_UP_DOWN,
+ TOUCH_MOVE_X,
+ TOUCH_MOVE_Y,
+ TOUCH_MOVE_X_Y,
+ TOUCH_CANCEL,
+ KEY
+ };
+
virtual ~ITRS() = default;
virtual struct tizen_remote_surface* GetHandle() const = 0;
virtual void TransferVisibility(bool visible) = 0;
virtual void SetChangedBufferEventFilter(int filter) = 0;
virtual void AddListener(IEventListener* listener) = 0;
virtual void Redirect() = 0;
+ virtual uint32_t GetRawInputType(InputType type) = 0;
virtual void TransferTouchEvent(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,
#define SCREEN_CONNECTOR_REMOTE_SURFACE_TRS_INTERNAL_H_
#include <unistd.h>
-
+#include <map>
#include <memory>
#include "screen_connector_remote_surface/handle.h"
subclas, identifier, time);
}
+ uint32_t GetRawInputType(InputType type) override {
+ return input_type_table_[type];
+ }
+
private:
+ std::map<int, uint32_t> input_type_table_ = {
+ {MOUSE_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_UP_DOWN},
+ {MOUSE_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X},
+ {MOUSE_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_Y},
+ {MOUSE_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X_Y},
+ {MOUSE_WHEEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_WHEEL_ALL},
+ {TOUCH_UP_DOWN, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_UP_DOWN},
+ {TOUCH_MOVE_X, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X},
+ {TOUCH_MOVE_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_Y},
+ {TOUCH_MOVE_X_Y, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_MOVE_X_Y},
+ {TOUCH_CANCEL, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_TOUCH_CANCEL_ALL},
+ {KEY, TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_KEY_ALL}
+ };
+
static void BufferUpdatedCB(void* data, struct tizen_remote_surface* trs,
struct wl_buffer* buffer, uint32_t time) {
}
#include <dlog.h>
-#include "screen_connector_remote_surface_evas/image_internal.h"
+#include "screen_connector_remote_surface_evas/image.h"
#ifdef LOG_TAG
#undef LOG_TAG
namespace screen_connector {
-Image::Image(Evas_Object* raw, IEventListener* listener,
+Image::Image(Evas_Object* raw, ImageEventListener* listener,
const std::string& instId, int pid, void* tag)
: EvasObject(raw, true), listener_(listener) {
evas_object_image_alpha_set(GetRaw(), 1);
* limitations under the License.
*/
-#ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_INTERNAL_H_
-#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_INTERNAL_H_
+#ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_H_
+#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_H_
#include <memory>
#include <string>
#include "screen_connector_remote_surface_evas/evas_object.h"
+#include "screen_connector_remote_surface_evas/image_event_listener.h"
namespace screen_connector {
-class Image : public EvasObject {
+class EXPORT_API Image : public EvasObject {
public:
- class IEventListener {
- public:
- virtual void OnMouseIn(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnMouseOut(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnMouseDown(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnMouseUp(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnTouchMultiDown(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnTouchMultiUp(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnMouseMove(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnMouseWheel(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnMove(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnShow(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnHide(const EvasObject& obj, void* eventInfo) = 0;
- virtual void OnResize(const EvasObject& obj, void* eventInfo) = 0;
- };
-
- Image(Evas_Object* raw, IEventListener* listener, const std::string& instId,
+ Image(Evas_Object* raw, ImageEventListener* listener, const std::string& instId,
int pid, void* tag);
virtual ~Image();
static void MoveCB(void* data, Evas* e, Evas_Object* obj, void* eventInfo);
private:
- IEventListener* listener_;
+ ImageEventListener* listener_;
std::shared_ptr<WlBuffer> prev_buf_;
};
} // namespace screen_connector
-#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_INTERNAL_H_
+#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_H_
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dlog.h>
+
+#include "screen_connector_remote_surface_evas/image_event_listener.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "SC_REMOTE_SURFACE"
+#define SC_TOOLKIT_HANDLE_TAG "SC_TOOLKIT_HANDLE_TAG"
+
+namespace screen_connector {
+
+ImageEventListener::ImageEventListener(RemoteSurface* parent)
+ : parent_(parent), is_flick_enabled_(parent->GetType() == RemoteSurface::Type::WATCH) {
+}
+
+void ImageEventListener::OnMouseIn(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Mouse_In* ev =
+ static_cast<Evas_Event_Mouse_In*>(eventInfo);
+ const char* desc = evas_device_description_get(ev->dev);
+ int x;
+ int y;
+ int w;
+ int h;
+
+ evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
+ if (desc == NULL)
+ desc = "";
+
+ LOGD("mouse in: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+ parent_->GetRaw()->TransferMouseEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_IN,
+ 0,
+ 0,
+ ev->canvas.x - x,
+ ev->canvas.y - y,
+ 0,
+ 0,
+ 0,
+ 0,
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnMouseOut(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Mouse_Out* ev =
+ static_cast<Evas_Event_Mouse_Out*>(eventInfo);
+ const char* desc = evas_device_description_get(ev->dev);
+ int x;
+ int y;
+ int w;
+ int h;
+
+ evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
+ if (desc == NULL)
+ desc = "";
+
+ LOGD("mouse out: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+ parent_->GetRaw()->TransferMouseEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_OUT,
+ 0,
+ 0,
+ ev->canvas.x - x,
+ ev->canvas.y - y,
+ 0,
+ 0,
+ 0,
+ 0,
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnMouseDown(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Mouse_Down* ev =
+ static_cast<Evas_Event_Mouse_Down*>(eventInfo);
+ const char* desc = evas_device_description_get(ev->dev);
+ int x;
+ int y;
+ int w;
+ int h;
+
+ if (IsDisabledInput(ITRS::MOUSE_UP_DOWN)) {
+ LOGD("mouse down disabled");
+ return;
+ }
+
+ evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
+
+ LOGD("mouse down: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+ flick_ = false;
+
+ if (is_flick_enabled_)
+ prev_y_ = ev->canvas.y - y;
+
+ if (desc == NULL)
+ desc = "";
+
+ parent_->GetRaw()->TransferMouseEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_DOWN,
+ 0,
+ ev->button,
+ ev->canvas.x - x,
+ ev->canvas.y - y,
+ wl_fixed_from_double(ev->radius_x),
+ wl_fixed_from_double(ev->radius_y),
+ wl_fixed_from_double(ev->pressure),
+ wl_fixed_from_double(ev->angle),
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnMouseUp(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Mouse_Up* ev =
+ static_cast<Evas_Event_Mouse_Up*>(eventInfo);
+ const char *desc = evas_device_description_get(ev->dev);
+ int x;
+ int y;
+ int w;
+ int h;
+
+ if (IsDisabledInput(ITRS::MOUSE_UP_DOWN)) {
+ LOGD("mouse up disabled");
+ return;
+ }
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
+ LOGD("Event canceled");
+ parent_->GetRaw()->TransferTouchCancel();
+ }
+
+ evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
+ LOGD("mouse up: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+
+ if (desc == NULL)
+ desc = "";
+
+ parent_->GetRaw()->TransferMouseEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE,
+ 0,
+ 0,
+ ev->canvas.x - x,
+ ev->canvas.y - y,
+ wl_fixed_from_double(ev->radius_x),
+ wl_fixed_from_double(ev->radius_y),
+ wl_fixed_from_double(ev->pressure),
+ wl_fixed_from_double(ev->angle),
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+
+ parent_->GetRaw()->TransferMouseEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP,
+ 0,
+ ev->button,
+ ev->canvas.x - x,
+ ev->canvas.y - y,
+ wl_fixed_from_double(ev->radius_x),
+ wl_fixed_from_double(ev->radius_y),
+ wl_fixed_from_double(ev->pressure),
+ wl_fixed_from_double(ev->angle),
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnTouchMultiDown(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Multi_Down* ev =
+ static_cast<Evas_Event_Multi_Down*>(eventInfo);
+ const char *desc = evas_device_description_get(ev->dev);
+ int x;
+ int y;
+ int w;
+ int h;
+
+ if (IsDisabledInput(ITRS::TOUCH_UP_DOWN)) {
+ LOGD("touch-multi-down disabled");
+ return;
+ }
+
+ evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
+ LOGD("multi down: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+
+ if (desc == NULL)
+ desc = "";
+
+ parent_->GetRaw()->TransferTouchEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_DOWN,
+ ev->device,
+ 1,
+ ev->canvas.x - x,
+ ev->canvas.y - y,
+ wl_fixed_from_double(ev->radius_x),
+ wl_fixed_from_double(ev->radius_y),
+ wl_fixed_from_double(ev->pressure),
+ wl_fixed_from_double(ev->angle),
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnTouchMultiUp(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Multi_Up* ev =
+ static_cast<Evas_Event_Multi_Up*>(eventInfo);
+ const char *desc = evas_device_description_get(ev->dev);
+ int x;
+ int y;
+ int w;
+ int h;
+
+ if (IsDisabledInput(ITRS::TOUCH_UP_DOWN)) {
+ LOGD("touch-multi-up disabled");
+ return;
+ }
+
+ evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
+ LOGD("multi up: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+
+ if (desc == NULL)
+ desc = "";
+
+ parent_->GetRaw()->TransferTouchEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_UP,
+ ev->device,
+ 1,
+ ev->canvas.x - x,
+ ev->canvas.y - y,
+ wl_fixed_from_double(ev->radius_x),
+ wl_fixed_from_double(ev->radius_y),
+ wl_fixed_from_double(ev->pressure),
+ wl_fixed_from_double(ev->angle),
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnMouseMove(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Mouse_Move* ev =
+ static_cast<Evas_Event_Mouse_Move*>(eventInfo);
+ const char *desc = evas_device_description_get(ev->dev);
+ int x;
+ int y;
+ int w;
+ int h;
+
+ if (IsDisabledInput(ITRS::MOUSE_MOVE_X_Y)) {
+ LOGD("mouse-move disabled");
+ return;
+ }
+
+ evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
+ LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y);
+
+ if (desc == NULL)
+ desc = "";
+
+ if (is_flick_enabled_) {
+ if (flick_) {
+ LOGD("flick event");
+ return;
+ }
+
+ int deltaY = ev->cur.canvas.y - y - prev_y_;
+ if (deltaY < 0)
+ deltaY *= -1;
+
+ if (deltaY > 10) {
+ flick_ = true;
+ return;
+ }
+
+ prev_y_ = ev->cur.canvas.y - y;
+ }
+
+ parent_->GetRaw()->TransferMouseEvent(
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE,
+ 0,
+ 0,
+ ev->cur.canvas.x - x,
+ ev->cur.canvas.y - y,
+ wl_fixed_from_double(ev->radius_x),
+ wl_fixed_from_double(ev->radius_y),
+ wl_fixed_from_double(ev->pressure),
+ wl_fixed_from_double(ev->angle),
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnMouseWheel(const EvasObject& obj,
+ void* eventInfo) {
+ Evas_Event_Mouse_Wheel* ev =
+ static_cast<Evas_Event_Mouse_Wheel*>(eventInfo);
+ const char *desc = evas_device_description_get(ev->dev);
+
+ if (IsDisabledInput(ITRS::MOUSE_WHEEL)) {
+ LOGD("mouse-wheel disabled");
+ return;
+ }
+
+ LOGD("mouse wheel");
+ if (desc == NULL)
+ desc = "";
+
+ parent_->GetRaw()->TransferMouseWheel(
+ ev->direction,
+ ev->z,
+ evas_device_class_get(ev->dev),
+ evas_device_subclass_get(ev->dev),
+ desc,
+ ev->timestamp);
+}
+
+void ImageEventListener::OnShow(const EvasObject& obj, void* eventInfo) {
+ LOGD("show");
+}
+
+void ImageEventListener::OnHide(const EvasObject& obj, void* eventInfo) {
+ LOGD("hide");
+}
+
+void ImageEventListener::OnResize(const EvasObject& obj, void* eventInfo) {
+ LOGD("resize");
+}
+
+void ImageEventListener::OnMove(const EvasObject& obj, void *eventInfo) {
+}
+
+void ImageEventListener::SetInputEventFilter(uint32_t filter) {
+ input_event_filter_ = filter;
+}
+
+bool ImageEventListener::IsDisabledInput(ITRS::InputType type) {
+ return ((input_event_filter_ & parent_->GetRaw()->GetRawInputType(type)) > 0);
+}
+
+bool ImageEventListener::IsFlickEnabled(bool enable) {
+ return is_flick_enabled_;
+}
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_EVENT_LISTENER_H_
+#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_EVENT_LISTENER_H_
+
+#include <memory>
+#include <string>
+
+#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"
+
+namespace screen_connector {
+
+class EXPORT_API ImageEventListener {
+ public:
+ ImageEventListener(RemoteSurface* parent);
+ 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 OnMouseUp(const EvasObject& obj, void* eventInfo);
+ virtual void OnTouchMultiDown(const EvasObject& obj, void* eventInfo);
+ virtual void OnTouchMultiUp(const EvasObject& obj, void* eventInfo);
+ virtual void OnMouseMove(const EvasObject& obj, void* eventInfo);
+ virtual void OnMouseWheel(const EvasObject& obj, void* eventInfo);
+ virtual void OnMove(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);
+ void SetInputEventFilter(uint32_t filter);
+ bool IsDisabledInput(ITRS::InputType type);
+ bool IsFlickEnabled(bool enable);
+
+ private:
+ RemoteSurface* parent_ = nullptr;
+ bool is_flick_enabled_ = false;
+ uint32_t input_event_filter_ = 0;
+ bool flick_ = false;
+ int prev_y_ = 0;
+};
+}
+
+#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_IMAGE_EVENT_LISTENER_H_
\ No newline at end of file
#include <memory>
#include <string>
-#include "screen_connector_remote_surface_evas/image_internal.h"
+#include "screen_connector_remote_surface_evas/image.h"
namespace screen_connector {
namespace test {
class ImageMock : public Image {
public:
- ImageMock(Evas_Object* raw, IEventListener* listener,
+ ImageMock(Evas_Object* raw, ImageEventListener* listener,
const std::string& instId, int pid, void* tag)
: Image(raw, listener, instId, pid, tag) {}
virtual ~ImageMock() {}
RemoteSurfaceEvas::Impl::Impl(RemoteSurfaceEvas* parent,
std::shared_ptr<EvasObject> viewerWin, bool mock)
- : viewer_win_(viewerWin), parent_(parent), mock_(mock),
- win_ctx_(mock ? nullptr : new WindowContext()) {
+ : ImageEventListener((RemoteSurface*)parent),
+ viewer_win_(viewerWin), parent_(parent), mock_(mock),
+ win_ctx_(mock ? nullptr : new WindowContext()) {
}
-void RemoteSurfaceEvas::Impl::OnMouseIn(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Mouse_In* ev =
- static_cast<Evas_Event_Mouse_In*>(eventInfo);
- const char* desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
- if (desc == NULL)
- desc = "";
-
- LOGD("mouse in: %d %d", ev->canvas.x - x, ev->canvas.y - y);
- parent_->GetRaw()->TransferMouseEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_IN,
- 0,
- 0,
- ev->canvas.x - x,
- ev->canvas.y - y,
- 0,
- 0,
- 0,
- 0,
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnMouseOut(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Mouse_Out* ev =
- static_cast<Evas_Event_Mouse_Out*>(eventInfo);
- const char* desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
- if (desc == NULL)
- desc = "";
-
- LOGD("mouse out: %d %d", ev->canvas.x - x, ev->canvas.y - y);
- parent_->GetRaw()->TransferMouseEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_OUT,
- 0,
- 0,
- ev->canvas.x - x,
- ev->canvas.y - y,
- 0,
- 0,
- 0,
- 0,
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnMouseDown(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Mouse_Down* ev =
- static_cast<Evas_Event_Mouse_Down*>(eventInfo);
- const char* desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- if (parent_->IsDisabledInput(RemoteSurface::MOUSE_UP_DOWN)) {
- LOGD("mouse down disabled");
- return;
- }
-
- evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
-
- LOGD("mouse down: %d %d", ev->canvas.x - x, ev->canvas.y - y);
- flick_ = false;
-
- if (parent_->GetType() == RemoteSurface::WATCH)
- prev_y_ = ev->canvas.y - y;
-
- if (desc == NULL)
- desc = "";
-
- parent_->GetRaw()->TransferMouseEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_DOWN,
- 0,
- ev->button,
- ev->canvas.x - x,
- ev->canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnMouseUp(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Mouse_Up* ev =
- static_cast<Evas_Event_Mouse_Up*>(eventInfo);
- const char *desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- if (parent_->IsDisabledInput(RemoteSurface::MOUSE_UP_DOWN)) {
- LOGD("mouse up disabled");
- return;
- }
-
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
- LOGD("Event canceled");
- parent_->SendTouchCancel();
- }
-
- evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
- LOGD("mouse up: %d %d", ev->canvas.x - x, ev->canvas.y - y);
-
- if (desc == NULL)
- desc = "";
-
- parent_->GetRaw()->TransferMouseEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE,
- 0,
- 0,
- ev->canvas.x - x,
- ev->canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-
- parent_->GetRaw()->TransferMouseEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP,
- 0,
- ev->button,
- ev->canvas.x - x,
- ev->canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnTouchMultiDown(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Multi_Down* ev =
- static_cast<Evas_Event_Multi_Down*>(eventInfo);
- const char *desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- if (parent_->IsDisabledInput(RemoteSurface::TOUCH_UP_DOWN)) {
- LOGD("touch-multi-down disabled");
- return;
- }
-
- evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
- LOGD("multi down: %d %d", ev->canvas.x - x, ev->canvas.y - y);
-
- if (desc == NULL)
- desc = "";
-
- parent_->GetRaw()->TransferTouchEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_DOWN,
- ev->device,
- 1,
- ev->canvas.x - x,
- ev->canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnTouchMultiUp(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Multi_Up* ev =
- static_cast<Evas_Event_Multi_Up*>(eventInfo);
- const char *desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- if (parent_->IsDisabledInput(RemoteSurface::TOUCH_UP_DOWN)) {
- LOGD("touch-multi-up disabled");
- return;
- }
-
- evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
- LOGD("multi up: %d %d", ev->canvas.x - x, ev->canvas.y - y);
-
- if (desc == NULL)
- desc = "";
-
- parent_->GetRaw()->TransferTouchEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_UP,
- ev->device,
- 1,
- ev->canvas.x - x,
- ev->canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnMouseMove(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Mouse_Move* ev =
- static_cast<Evas_Event_Mouse_Move*>(eventInfo);
- const char *desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- if (parent_->IsDisabledInput(RemoteSurface::MOUSE_MOVE_X_Y)) {
- LOGD("mouse-move disabled");
- return;
- }
-
- evas_object_geometry_get(obj.GetRaw(), &x, &y, &w, &h);
- LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y);
-
- if (desc == NULL)
- desc = "";
-
- if (parent_->GetType() == RemoteSurface::WATCH) {
- if (flick_) {
- LOGD("flick event");
- return;
- }
-
- int deltaY = ev->cur.canvas.y - y - prev_y_;
- if (deltaY < 0)
- deltaY *= -1;
-
- if (deltaY > 10) {
- flick_ = true;
- return;
- }
-
- prev_y_ = ev->cur.canvas.y - y;
- }
-
- parent_->GetRaw()->TransferMouseEvent(
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE,
- 0,
- 0,
- ev->cur.canvas.x - x,
- ev->cur.canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnMouseWheel(const EvasObject& obj,
- void* eventInfo) {
- Evas_Event_Mouse_Wheel* ev =
- static_cast<Evas_Event_Mouse_Wheel*>(eventInfo);
- const char *desc = evas_device_description_get(ev->dev);
-
- if (parent_->IsDisabledInput(RemoteSurface::MOUSE_WHEEL)) {
- LOGD("mouse-wheel disabled");
- return;
- }
-
- LOGD("mouse wheel");
- if (desc == NULL)
- desc = "";
-
- parent_->GetRaw()->TransferMouseWheel(
- ev->direction,
- ev->z,
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-void RemoteSurfaceEvas::Impl::OnShow(const EvasObject& obj, void* eventInfo) {
- LOGD("show");
- OnMove(obj, eventInfo);
-}
-
-void RemoteSurfaceEvas::Impl::OnHide(const EvasObject& obj, void* eventInfo) {
- LOGD("hide");
-}
-
-void RemoteSurfaceEvas::Impl::OnResize(const EvasObject& obj, void* eventInfo) {
- LOGD("resize");
- OnMove(obj, eventInfo);
-}
-
-void RemoteSurfaceEvas::Impl::OnMove(const EvasObject& obj, void *eventInfo) {
- if (!is_init_) {
- is_init_ = true;
- return;
- }
-
- if (!auto_visibility_)
- return;
-
- Ecore_Wl2_Window *window = NULL;
- Ecore_Evas *ee;
- ee = ecore_evas_ecore_evas_get(
- evas_object_evas_get(viewer_win_->GetRaw()));
- window = ecore_evas_wayland2_window_get(ee);
-
- unsigned int win_id = ecore_wl2_window_id_get(window);
- if (parent_->IsVisibleArea() && !parent_->impl_->win_ctx_->IsFullyObscured(win_id)) {
- parent_->SendVisibility(true);
- visibility_ = RemoteSurfaceEvas::UNOBSCURED;
- } else {
- parent_->SendVisibility(false);
- visibility_ = RemoteSurfaceEvas::FULLY_OBSCURED;
- }
-}
bool RemoteSurfaceEvas::IsVisibleArea() const {
int x, y, w, h;
#include "screen_connector_remote_surface_evas/evas_event_interface.h"
#include "screen_connector_remote_surface/remote_surface.h"
#include "screen_connector_remote_surface_evas/remote_surface_evas.h"
-#include "screen_connector_remote_surface_evas/image_internal.h"
+#include "screen_connector_remote_surface_evas/image.h"
#include "screen_connector_remote_surface/window_context.h"
namespace screen_connector {
-class RemoteSurfaceEvas::Impl : public Image::IEventListener {
+class RemoteSurfaceEvas::Impl : public ImageEventListener {
public:
- void OnMouseIn(const EvasObject& obj, void* eventInfo) override;
- void OnMouseOut(const EvasObject& obj, void* eventInfo) override;
- void OnMouseDown(const EvasObject& obj, void* eventInfo) override;
- void OnMouseUp(const EvasObject& obj, void* eventInfo) override;
- void OnTouchMultiDown(const EvasObject& obj, void* eventInfo) override;
- void OnTouchMultiUp(const EvasObject& obj, void* eventInfo) override;
- void OnMouseMove(const EvasObject& obj, void* eventInfo) override;
- void OnMouseWheel(const EvasObject& obj, void* eventInfo) override;
- void OnMove(const EvasObject& obj, void* eventInfo) override;
- void OnShow(const EvasObject& obj, void* eventInfo) override;
- void OnHide(const EvasObject& obj, void* eventInfo) override;
- void OnResize(const EvasObject& obj, void* eventInfo) override;
-
virtual ~Impl() = default;
private:
RemoteSurfaceEvas::Visibility visibility_ = RemoteSurfaceEvas::UNKNOWN;
std::map<int, RemoteSurfaceEvas::Visibility> winVisibility_map_;
int bind_win_id_ = 0;
- bool flick_ = false;
- int prev_y_ = 0;
RemoteSurfaceEvas* parent_;
bool auto_visibility_ = true;
int no_render_timer_ = 0;
*/
#include <dlog.h>
+#include <Ecore_Wl2.h>
#include "screen_connector_remote_surface_evas/util.h"
return std::shared_ptr<WlSurface>(new WlSurface(surface, false));
}
+ std::shared_ptr<WlSurface> GetWlSurface(Evas_Object* win) {
+ struct wl_surface* surface;
+ Ecore_Wl2_Window* wl_win;
+ Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win));
+
+ wl_win = ecore_evas_wayland2_window_get(ee);
+ if (!wl_win) {
+ LOGE("failed to get wl_win");
+ return nullptr;
+ }
+
+ surface = ecore_wl2_window_surface_get(wl_win);
+ if (!surface) {
+ LOGE("failed to get surface");
+ return nullptr;
+ }
+ return std::shared_ptr<WlSurface>(new WlSurface(surface, false));
+ }
+
} // namespace util
} // namespace watchface_complication
namespace util {
EXPORT_API std::shared_ptr<WlSurface> GetWlSurface(const EvasObject& win,
bool mock = false);
+ EXPORT_API std::shared_ptr<WlSurface> GetWlSurface(Evas_Object* win);
} // namespace util
} // namespace screen_connector