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

Unified Diff: ui/views/widget/desktop_aura/desktop_screen_x11.cc

Issue 260263002: Merge three implementations for getting the topmost x11 window at a point (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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: ui/views/widget/desktop_aura/desktop_screen_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
index 99ca833d9aae81000245f764dfe7a83c6f4d16a5..d9277807d443470b824144ab0ff48af2ccfcadfe 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
@@ -26,6 +26,7 @@
#include "ui/gfx/x/x11_types.h"
#include "ui/views/widget/desktop_aura/desktop_screen.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
+#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
namespace {
@@ -64,54 +65,6 @@ std::vector<gfx::Display> GetFallbackDisplayList() {
return std::vector<gfx::Display>(1, gfx_display);
}
-// Helper class to GetWindowAtScreenPoint() which returns the topmost window at
-// the location passed to FindAt(). NULL is returned if a window which does not
-// belong to Chromium is topmost at the passed in location.
-class ToplevelWindowFinder : public ui::EnumerateWindowsDelegate {
- public:
- ToplevelWindowFinder() : toplevel_(NULL) {
- }
-
- virtual ~ToplevelWindowFinder() {
- }
-
- aura::Window* FindAt(const gfx::Point& screen_loc) {
- screen_loc_ = screen_loc;
- ui::EnumerateTopLevelWindows(this);
- return toplevel_;
- }
-
- protected:
- virtual bool ShouldStopIterating(XID xid) OVERRIDE {
- if (!ui::IsWindowVisible(xid))
- return false;
-
- aura::Window* window =
- views::DesktopWindowTreeHostX11::GetContentWindowForXID(xid);
- if (window) {
- // Currently |window|->IsVisible() always returns true.
- // TODO(pkotwicz): Fix this. crbug.com/353038
- if (window->IsVisible() &&
- window->GetBoundsInScreen().Contains(screen_loc_)) {
- toplevel_ = window;
- return true;
- }
- return false;
- }
-
- if (ui::WindowContainsPoint(xid, screen_loc_)) {
- // toplevel_ = NULL
- return true;
- }
- return false;
- }
-
- gfx::Point screen_loc_;
- aura::Window* toplevel_;
-
- DISALLOW_COPY_AND_ASSIGN(ToplevelWindowFinder);
-};
-
} // namespace
namespace views {
@@ -236,8 +189,8 @@ gfx::NativeWindow DesktopScreenX11::GetWindowUnderCursor() {
gfx::NativeWindow DesktopScreenX11::GetWindowAtScreenPoint(
const gfx::Point& point) {
- ToplevelWindowFinder finder;
- return finder.FindAt(point);
+ X11TopmostWindowFinder finder;
+ return finder.FindLocalProcessWindowAt(point, std::set<aura::Window*>());
}
int DesktopScreenX11::GetNumDisplays() const {

Powered by Google App Engine
This is Rietveld 408576698