summaryrefslogtreecommitdiffstats
path: root/ui/aura/root_window.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 17:26:37 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 17:26:37 +0000
commit379b0d60d227f67a2c6960128a289ac81ccc00f8 (patch)
tree4a1be7e7be3d9c3f70daa723b78311350dce8e14 /ui/aura/root_window.cc
parent7781d121ca4b546f3989e00fe113c989ac479417 (diff)
downloadchromium_src-379b0d60d227f67a2c6960128a289ac81ccc00f8.zip
chromium_src-379b0d60d227f67a2c6960128a289ac81ccc00f8.tar.gz
chromium_src-379b0d60d227f67a2c6960128a289ac81ccc00f8.tar.bz2
Short term workaround to deal with calculation error caused by inverted matrix.
I'll work on better fix for m28 as described in the bug. BUG=222483 TEST=autohide launcher works on any side (lefr,right,top,bottom) when display is rotated. Review URL: https://chromiumcodereview.appspot.com/12423007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/root_window.cc')
-rw-r--r--ui/aura/root_window.cc28
1 files changed, 24 insertions, 4 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 7c95443..ac66bdf 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -669,8 +669,28 @@ void RootWindow::ClearMouseHandlers() {
////////////////////////////////////////////////////////////////////////////////
// RootWindow, private:
-void RootWindow::TransformEventForDeviceScaleFactor(ui::LocatedEvent* event) {
+void RootWindow::TransformEventForDeviceScaleFactor(bool keep_inside_root,
+ ui::LocatedEvent* event) {
event->UpdateForRootTransform(GetRootTransform());
+#if defined(OS_CHROMEOS)
+ const gfx::Rect& root_bounds = bounds();
+ if (keep_inside_root &
+ host_->GetBounds().Contains(event->system_location()) &&
+ !root_bounds.Contains(event->root_location())) {
+ // Make sure that the mouse location inside the host window gets
+ // translated inside root window.
+ // TODO(oshima): This is (hopefully) short term bandaid to deal
+ // with calculation error in inverted matrix. We'll try better
+ // alternative (crbug.com/222483) for m28.
+ int x = event->location().x();
+ int y = event->location().y();
+ x = std::min(std::max(x, root_bounds.x()), root_bounds.right());
+ y = std::min(std::max(y, root_bounds.y()), root_bounds.bottom());
+ const gfx::Point new_location(x, y);
+ event->set_location(new_location);
+ event->set_root_location(new_location);
+ }
+#endif // defined(OS_CHROMEOS)
}
void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) {
@@ -884,7 +904,7 @@ bool RootWindow::OnHostMouseEvent(ui::MouseEvent* event) {
bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) {
DispatchHeldEvents();
- TransformEventForDeviceScaleFactor(event);
+ TransformEventForDeviceScaleFactor(false, event);
SetLastMouseLocation(this, event->location());
synthesize_mouse_move_ = false;
@@ -930,7 +950,7 @@ bool RootWindow::OnHostTouchEvent(ui::TouchEvent* event) {
default:
break;
}
- TransformEventForDeviceScaleFactor(event);
+ TransformEventForDeviceScaleFactor(false, event);
bool handled = false;
Window* target = client::GetCaptureWindow(this);
if (!target) {
@@ -1031,7 +1051,7 @@ RootWindow* RootWindow::AsRootWindow() {
// RootWindow, private:
bool RootWindow::DispatchMouseEventImpl(ui::MouseEvent* event) {
- TransformEventForDeviceScaleFactor(event);
+ TransformEventForDeviceScaleFactor(true, event);
Window* target = mouse_pressed_handler_ ?
mouse_pressed_handler_ : client::GetCaptureWindow(this);
if (!target)