enum { kLeftButton = 1, kMiddleButton = 2, kRightButton = 3 };
-#if BUILDFLAG(IS_TIZEN_TV)
static void TranslateEvasCoordToWebKitCoord(Evas_Object* web_view,
gfx::PointF* point) {
Evas_Coord tmpX, tmpY;
evas_object_geometry_get(web_view, &tmpX, &tmpY, 0, 0);
point->Offset(-tmpX, -tmpY);
}
-#endif
EventFlags EvasToUIMouseButton(int button) {
if (button == kLeftButton)
}
template <class EVT>
-MouseEvent MakeWebMouseEvent(EventType type, const EVT* ev, int delta_y) {
- gfx::PointF root_location(ev->canvas.x, ev->canvas.y);
- gfx::PointF location(ev->canvas.x, ev->canvas.y);
- location.Offset(0, -delta_y);
+MouseEvent MakeWebMouseEvent(EventType type,
+ const EVT* ev,
+ Evas* evas,
+ Evas_Object* obj) {
+ const float sf = GetDeviceScaleFactor();
+ gfx::PointF root_location(
+ evas_coord_world_x_to_screen(evas, ev->canvas.x) / sf,
+ evas_coord_world_y_to_screen(evas, ev->canvas.y) / sf);
+ gfx::PointF location(ev->canvas.x / sf, ev->canvas.y / sf);
+ TranslateEvasCoordToWebKitCoord(obj, &location);
int button = EvasToUIMouseButton(ev->button);
int event_flags = EvasModifiersToEventFlags(ev->modifiers);
event_flags |= button;
if (thiz->GetTouchEventsEnabled(ev)) {
thiz->ProcessTouchEvents(ev->timestamp, false);
} else {
- MouseEvent event =
- MakeWebMouseEvent(ET_MOUSE_PRESSED, ev, thiz->GetTopControlsHeight());
+ MouseEvent event = MakeWebMouseEvent(ET_MOUSE_PRESSED, ev, evas, obj);
#if BUILDFLAG(IS_TIZEN_TV)
// Handle Mouse Event For Lock
if (thiz->pointer_lock_ && thiz->pointer_lock_->IsPointLockEnabled())
if (thiz->GetTouchEventsEnabled(ev)) {
thiz->ProcessTouchEvents(ev->timestamp, false);
} else {
- MouseEvent event =
- MakeWebMouseEvent(ET_MOUSE_RELEASED, ev, thiz->GetTopControlsHeight());
+ MouseEvent event = MakeWebMouseEvent(ET_MOUSE_RELEASED, ev, evas, obj);
#if BUILDFLAG(IS_TIZEN_TV)
// Handle Mouse Event For Lock
if (thiz->GetTouchEventsEnabled(ev)) {
thiz->ProcessTouchEvents(ev->timestamp, false);
} else {
- gfx::PointF location(ev->cur.canvas.x, ev->cur.canvas.y);
- gfx::PointF root_location(ev->cur.canvas.x, ev->cur.canvas.y);
- location.Offset(0, -thiz->GetTopControlsHeight());
+ const float sf = GetDeviceScaleFactor();
+ gfx::PointF location(ev->cur.canvas.x / sf, ev->cur.canvas.y / sf);
+ gfx::PointF root_location(
+ evas_coord_world_x_to_screen(evas, ev->cur.canvas.x) / sf,
+ evas_coord_world_y_to_screen(evas, ev->cur.canvas.y) / sf);
+ TranslateEvasCoordToWebKitCoord(obj, &location);
int button = EvasToUIMouseButton(ev->buttons);
int event_flags = EvasModifiersToEventFlags(ev->modifiers);
event_flags |= button;
if (thiz->pointer_lock_ && thiz->pointer_lock_->IsPointLockEnabled()) {
thiz->pointer_lock_->HandleMouseEventForLock(&event);
} else {
- const float sf = GetDeviceScaleFactor();
ui::MouseEvent::DispatcherApi(&event).set_movement(
gfx::Vector2dF((ev->cur.canvas.x / sf - ev->prev.canvas.x / sf),
(ev->cur.canvas.y / sf - ev->prev.canvas.y / sf)));
}
#else
- const float sf = GetDeviceScaleFactor();
ui::MouseEvent::DispatcherApi(&event).set_movement(
gfx::Vector2dF((ev->cur.canvas.x / sf - ev->prev.canvas.x / sf),
(ev->cur.canvas.y / sf - ev->prev.canvas.y / sf)));
thiz->window_->UpdateFocus(false);
#endif
Evas_Event_Mouse_Out* ev = static_cast<Evas_Event_Mouse_Out*>(event_info);
+ const float sf = GetDeviceScaleFactor();
- gfx::PointF root_location(ev->canvas.x, ev->canvas.y);
- gfx::PointF location(ev->canvas.x, ev->canvas.y);
- location.Offset(0, -thiz->GetTopControlsHeight());
+ gfx::PointF root_location(
+ evas_coord_world_x_to_screen(evas, ev->canvas.x) / sf,
+ evas_coord_world_y_to_screen(evas, ev->canvas.y) / sf);
+ gfx::PointF location(ev->canvas.x / sf, ev->canvas.y / sf);
+ TranslateEvasCoordToWebKitCoord(obj, &location);
int button = EvasToUIMouseButton(ev->buttons);
int event_flags = EvasModifiersToEventFlags(ev->modifiers);
event_flags |= button;
else
offset.set_y(-(ev->z * kDefaultScrollStep));
- gfx::PointF root_location(ev->canvas.x, ev->canvas.y);
- gfx::PointF location(ev->canvas.x, ev->canvas.y);
- location.Offset(0, -thiz->GetTopControlsHeight());
+ const float sf = GetDeviceScaleFactor();
+ gfx::PointF root_location(
+ evas_coord_world_x_to_screen(evas, ev->canvas.x) / sf,
+ evas_coord_world_y_to_screen(evas, ev->canvas.y) / sf);
+ gfx::PointF location(ev->canvas.x / sf, ev->canvas.y / sf);
+ TranslateEvasCoordToWebKitCoord(obj, &location);
int event_flags = EvasModifiersToEventFlags(ev->modifiers);
MouseWheelEvent event(offset, location, root_location, base::TimeTicks::Now(),
event_flags, 0);