Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: ash/mus/screen_mus.cc

Issue 2726603003: mus+ash: Copy parts of ScreenAsh to ScreenMus. (Closed)
Patch Set: Add unit tests. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/mus/screen_mus.cc
diff --git a/ash/mus/screen_mus.cc b/ash/mus/screen_mus.cc
index 260bd952a51c03215c729783b892b8656222ce7c..e58cff9dd26d15818891a9bbf459d8ce99a135d9 100644
--- a/ash/mus/screen_mus.cc
+++ b/ash/mus/screen_mus.cc
@@ -4,7 +4,10 @@
#include "ash/mus/screen_mus.h"
+#include "ash/common/wm/root_window_finder.h"
+#include "ash/common/wm_window.h"
#include "services/ui/public/interfaces/display/display_controller.mojom.h"
+#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
@@ -49,4 +52,21 @@ gfx::Point ScreenMus::GetCursorScreenPoint() {
return aura::Env::GetInstance()->last_mouse_location();
}
+bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) {
+ return GetWindowAtScreenPoint(GetCursorScreenPoint()) == window;
+}
+
+gfx::NativeWindow ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) {
+ aura::Window* root_window =
+ WmWindow::GetAuraWindow(wm::GetRootWindowAt(point));
+ aura::client::ScreenPositionClient* position_client =
+ aura::client::GetScreenPositionClient(root_window);
+
+ gfx::Point local_point = point;
+ if (position_client)
+ position_client->ConvertPointFromScreen(root_window, &local_point);
+
+ return root_window->GetTopWindowContainingPoint(local_point);
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698