blob: b2442b1bcaa0ce2b65a4031e9ca67cbebe2e2fa9 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/android/view_client.h"
namespace ui {
MotionEventData::MotionEventData(float dip_scale,
jobject jevent,
long time,
int action,
int pointer_count,
int history_size,
int action_index,
float pos_x0,
float pos_y0,
float pos_x1,
float pos_y1,
int pointer_id_0,
int pointer_id_1,
float touch_major_0,
float touch_major_1,
float touch_minor_0,
float touch_minor_1,
float orientation_0,
float orientation_1,
float tilt_0,
float tilt_1,
float raw_pos_x,
float raw_pos_y,
int tool_type_0,
int tool_type_1,
int button_state,
int meta_state,
bool is_touch_handle_event) :
dip_scale_(dip_scale),
jevent_(jevent),
time_(time),
action_(action),
pointer_count_(pointer_count),
history_size_(history_size),
action_index_(action_index),
pos_x0_(pos_x0),
pos_y0_(pos_y0),
pos_x1_(pos_x1),
pos_y1_(pos_y1),
pointer_id_0_(pointer_id_0),
pointer_id_1_(pointer_id_1),
touch_major_0_(touch_major_0),
touch_major_1_(touch_major_1),
touch_minor_0_(touch_minor_0),
touch_minor_1_(touch_minor_1),
orientation_0_(orientation_0),
orientation_1_(orientation_1),
tilt_0_(tilt_0),
tilt_1_(tilt_1),
raw_pos_x_(raw_pos_x),
raw_pos_y_(raw_pos_y),
tool_type_0_(tool_type_0),
tool_type_1_(tool_type_1),
button_state_(button_state),
meta_state_(meta_state),
is_touch_handle_event_(is_touch_handle_event) {}
MotionEventData::MotionEventData(const MotionEventData& other) :
dip_scale_(other.dip_scale_),
jevent_(other.jevent_),
time_(other.time_),
action_(other.action_),
pointer_count_(other.pointer_count_),
history_size_(other.history_size_),
action_index_(other.action_index_),
pos_x0_(other.pos_x0_),
pos_y0_(other.pos_y0_),
pos_x1_(other.pos_x1_),
pos_y1_(other.pos_y1_),
pointer_id_0_(other.pointer_id_0_),
pointer_id_1_(other.pointer_id_1_),
touch_major_0_(other.touch_major_0_),
touch_major_1_(other.touch_major_1_),
touch_minor_0_(other.touch_minor_0_),
touch_minor_1_(other.touch_minor_1_),
orientation_0_(other.orientation_0_),
orientation_1_(other.orientation_1_),
tilt_0_(other.tilt_0_),
tilt_1_(other.tilt_1_),
raw_pos_x_(other.raw_pos_x_),
raw_pos_y_(other.raw_pos_y_),
tool_type_0_(other.tool_type_0_),
tool_type_1_(other.tool_type_1_),
button_state_(other.button_state_),
meta_state_(other.meta_state_),
is_touch_handle_event_(other.is_touch_handle_event_) {}
MotionEventData MotionEventData::Offset(float delta_x, float delta_y) const {
return MotionEventData(dip_scale_,
jevent_,
time_,
action_,
pointer_count_,
history_size_,
action_index_,
pos_x0_ + delta_x,
pos_y0_ + delta_y,
pos_x1_ + delta_x,
pos_y1_ + delta_y,
pointer_id_0_,
pointer_id_1_,
touch_major_0_,
touch_major_1_,
touch_minor_0_,
touch_minor_1_,
orientation_0_,
orientation_1_,
tilt_0_,
tilt_1_,
raw_pos_x_,
raw_pos_y_,
tool_type_0_,
tool_type_1_,
button_state_,
meta_state_,
is_touch_handle_event_);
}
bool ViewClient::OnTouchEvent(const MotionEventData& event) { return false; }
} // namespace ui