summaryrefslogtreecommitdiffstats
path: root/ash/ui_controls_ash.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 09:15:45 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 09:15:45 +0000
commit6675e1ca1873419b431878bdf31a8616ef8d6a44 (patch)
tree2b7a3617cb1161149440caf5ed770907e95105f3 /ash/ui_controls_ash.cc
parent1561a015d42e119c7da3c69ca6f6326970110426 (diff)
downloadchromium_src-6675e1ca1873419b431878bdf31a8616ef8d6a44.zip
chromium_src-6675e1ca1873419b431878bdf31a8616ef8d6a44.tar.gz
chromium_src-6675e1ca1873419b431878bdf31a8616ef8d6a44.tar.bz2
Cancel drag if display configuration changes.
* Removed debug specific shortcut to emulate display change. * fixed ui_controls to use the correct position * a few minor clean ups (removing unnecessary namesapce, rename Monitor -> Display) BUG=14457 TEST=covered by test Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=155762 Review URL: https://chromiumcodereview.appspot.com/10909043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/ui_controls_ash.cc')
-rw-r--r--ash/ui_controls_ash.cc50
1 files changed, 29 insertions, 21 deletions
diff --git a/ash/ui_controls_ash.cc b/ash/ui_controls_ash.cc
index 7463a53..f2aba71 100644
--- a/ash/ui_controls_ash.cc
+++ b/ash/ui_controls_ash.cc
@@ -7,6 +7,7 @@
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/window_properties.h"
#include "ui/aura/client/capture_client.h"
+#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/ui_controls_aura.h"
#include "ui/gfx/screen.h"
@@ -32,18 +33,25 @@ ui_controls::UIControlsAura* GetUIControlsForRootWindow(
}
// Returns the UIControls object for the RootWindow at the |point| in
-// absolute screen coordinates. NULL if there is no RootWindow under the
-// |point|.
-ui_controls::UIControlsAura* GetUIControlsAt(const gfx::Point& point) {
+// virtual screen coordinates, and updates the |point| relative to the
+// UIControlsAura's root window. NULL if there is no RootWindow under
+// the |point|.
+ui_controls::UIControlsAura* GetUIControlsAt(gfx::Point* point) {
// If there is a capture events must be relative to it.
aura::client::CaptureClient* capture_client =
GetCaptureClient(ash::Shell::GetInstance()->GetPrimaryRootWindow());
- if (capture_client && capture_client->GetCaptureWindow()) {
- return GetUIControlsForRootWindow(
- capture_client->GetCaptureWindow()->GetRootWindow());
- }
- aura::RootWindow* root = wm::GetRootWindowAt(point);
- return root ? GetUIControlsForRootWindow(root) : NULL;
+ aura::RootWindow* root = NULL;
+ if (capture_client && capture_client->GetCaptureWindow())
+ root = capture_client->GetCaptureWindow()->GetRootWindow();
+ else
+ root = wm::GetRootWindowAt(*point);
+
+ aura::client::ScreenPositionClient* screen_position_client =
+ aura::client::GetScreenPositionClient(root);
+ if (screen_position_client)
+ screen_position_client->ConvertPointFromScreen(root, point);
+
+ return GetUIControlsForRootWindow(root);
}
} // namespace
@@ -82,25 +90,25 @@ class UIControlsAsh : public ui_controls::UIControlsAura {
}
virtual bool SendMouseMove(long x, long y) OVERRIDE {
- ui_controls::UIControlsAura* ui_controls =
- GetUIControlsAt(gfx::Point(x, y));
- return ui_controls && ui_controls->SendMouseMove(x, y);
+ gfx::Point p(x, y);
+ ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
+ return ui_controls && ui_controls->SendMouseMove(p.x(), p.y());
}
virtual bool SendMouseMoveNotifyWhenDone(
long x,
long y,
const base::Closure& closure) OVERRIDE {
- ui_controls::UIControlsAura* ui_controls =
- GetUIControlsAt(gfx::Point(x, y));
+ gfx::Point p(x, y);
+ ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
return ui_controls &&
- ui_controls->SendMouseMoveNotifyWhenDone(x, y, closure);
+ ui_controls->SendMouseMoveNotifyWhenDone(p.x(), p.y(), closure);
}
virtual bool SendMouseEvents(ui_controls::MouseButton type,
int state) OVERRIDE {
- ui_controls::UIControlsAura* ui_controls =
- GetUIControlsAt(gfx::Screen::GetCursorScreenPoint());
+ gfx::Point p(gfx::Screen::GetCursorScreenPoint());
+ ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
return ui_controls && ui_controls->SendMouseEvents(type, state);
}
@@ -108,15 +116,15 @@ class UIControlsAsh : public ui_controls::UIControlsAura {
ui_controls::MouseButton type,
int state,
const base::Closure& closure) OVERRIDE {
- ui_controls::UIControlsAura* ui_controls =
- GetUIControlsAt(gfx::Screen::GetCursorScreenPoint());
+ gfx::Point p(gfx::Screen::GetCursorScreenPoint());
+ ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
return ui_controls && ui_controls->SendMouseEventsNotifyWhenDone(
type, state, closure);
}
virtual bool SendMouseClick(ui_controls::MouseButton type) OVERRIDE {
- ui_controls::UIControlsAura* ui_controls =
- GetUIControlsAt(gfx::Screen::GetCursorScreenPoint());
+ gfx::Point p(gfx::Screen::GetCursorScreenPoint());
+ ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
return ui_controls && ui_controls->SendMouseClick(type);
}