Skip to content

Commit

Permalink
Use evas_object_image as mouse event target (#329)
Browse files Browse the repository at this point in the history
Use ecore_evas_window_get instead of ecore_evas_window_get.

Signed-off-by: Boram Bae <[email protected]>
  • Loading branch information
bbrto21 authored Aug 19, 2022
1 parent 0948a08 commit 5d13715
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions shell/platform/tizen/tizen_window_elementary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void TizenWindowElementary::RegisterEventHandlers() {
[](void* data, Evas* evas, Evas_Object* object, void* event_info) {
auto* self = reinterpret_cast<TizenWindowElementary*>(data);
if (self->view_delegate_) {
if (self->elm_win_ == object) {
if (self->image_ == object) {
auto* mouse_event =
reinterpret_cast<Evas_Event_Mouse_Down*>(event_info);
self->view_delegate_->OnPointerDown(
Expand All @@ -184,15 +184,15 @@ void TizenWindowElementary::RegisterEventHandlers() {
}
};
evas_object_event_callback_add(
elm_win_, EVAS_CALLBACK_MOUSE_DOWN,
image_, EVAS_CALLBACK_MOUSE_DOWN,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_DOWN], this);

evas_object_callbacks_[EVAS_CALLBACK_MOUSE_UP] = [](void* data, Evas* evas,
Evas_Object* object,
void* event_info) {
auto* self = reinterpret_cast<TizenWindowElementary*>(data);
if (self->view_delegate_) {
if (self->elm_win_ == object) {
if (self->image_ == object) {
auto* mouse_event = reinterpret_cast<Evas_Event_Mouse_Up*>(event_info);
self->view_delegate_->OnPointerUp(
mouse_event->canvas.x, mouse_event->canvas.y,
Expand All @@ -201,15 +201,15 @@ void TizenWindowElementary::RegisterEventHandlers() {
}
}
};
evas_object_event_callback_add(elm_win_, EVAS_CALLBACK_MOUSE_UP,
evas_object_event_callback_add(image_, EVAS_CALLBACK_MOUSE_UP,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_UP],
this);

evas_object_callbacks_[EVAS_CALLBACK_MOUSE_MOVE] =
[](void* data, Evas* evas, Evas_Object* object, void* event_info) {
auto* self = reinterpret_cast<TizenWindowElementary*>(data);
if (self->view_delegate_) {
if (self->elm_win_ == object) {
if (self->image_ == object) {
auto* mouse_event =
reinterpret_cast<Evas_Event_Mouse_Move*>(event_info);
self->view_delegate_->OnPointerMove(
Expand All @@ -220,14 +220,14 @@ void TizenWindowElementary::RegisterEventHandlers() {
}
};
evas_object_event_callback_add(
elm_win_, EVAS_CALLBACK_MOUSE_MOVE,
image_, EVAS_CALLBACK_MOUSE_MOVE,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_MOVE], this);

evas_object_callbacks_[EVAS_CALLBACK_MOUSE_WHEEL] =
[](void* data, Evas* evas, Evas_Object* object, void* event_info) {
auto* self = reinterpret_cast<TizenWindowElementary*>(data);
if (self->view_delegate_) {
if (self->elm_win_ == object) {
if (self->image_ == object) {
auto* wheel_event =
reinterpret_cast<Ecore_Event_Mouse_Wheel*>(event_info);
double delta_x = 0.0;
Expand All @@ -247,7 +247,7 @@ void TizenWindowElementary::RegisterEventHandlers() {
}
};
evas_object_event_callback_add(
elm_win_, EVAS_CALLBACK_MOUSE_WHEEL,
image_, EVAS_CALLBACK_MOUSE_WHEEL,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_WHEEL], this);

evas_object_callbacks_[EVAS_CALLBACK_KEY_DOWN] = [](void* data, Evas* evas,
Expand Down Expand Up @@ -305,17 +305,18 @@ void TizenWindowElementary::UnregisterEventHandlers() {
rotation_changed_callback_);

evas_object_event_callback_del(
elm_win_, EVAS_CALLBACK_MOUSE_DOWN,
image_, EVAS_CALLBACK_MOUSE_DOWN,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_DOWN]);
evas_object_event_callback_del(
elm_win_, EVAS_CALLBACK_MOUSE_UP,
image_, EVAS_CALLBACK_MOUSE_UP,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_UP]);
evas_object_event_callback_del(
elm_win_, EVAS_CALLBACK_MOUSE_MOVE,
image_, EVAS_CALLBACK_MOUSE_MOVE,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_MOVE]);
evas_object_event_callback_del(
elm_win_, EVAS_CALLBACK_MOUSE_WHEEL,
image_, EVAS_CALLBACK_MOUSE_WHEEL,
evas_object_callbacks_[EVAS_CALLBACK_MOUSE_WHEEL]);

evas_object_event_callback_del(
elm_win_, EVAS_CALLBACK_KEY_DOWN,
evas_object_callbacks_[EVAS_CALLBACK_KEY_DOWN]);
Expand Down Expand Up @@ -359,7 +360,8 @@ int32_t TizenWindowElementary::GetDpi() {
}

uintptr_t TizenWindowElementary::GetWindowId() {
return elm_win_window_id_get(elm_win_);
return ecore_evas_window_get(
ecore_evas_ecore_evas_get(evas_object_evas_get(elm_win_)));
}

void TizenWindowElementary::SetPreferredOrientations(
Expand Down

0 comments on commit 5d13715

Please sign in to comment.