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

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

Issue 174943003: Revert 252502 "Fixes DesktopScreenX11::GetWindowAtScreenPoint() ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ui/views/widget/desktop_aura/desktop_screen_x11.cc
===================================================================
--- trunk/src/ui/views/widget/desktop_aura/desktop_screen_x11.cc (revision 252520)
+++ trunk/src/ui/views/widget/desktop_aura/desktop_screen_x11.cc (working copy)
@@ -63,50 +63,6 @@
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 {
- aura::Window* window =
- views::DesktopWindowTreeHostX11::GetContentWindowForXID(xid);
- if (window) {
- if (window->IsVisible() &&
- window->GetBoundsInScreen().Contains(screen_loc_)) {
- toplevel_ = window;
- return true;
- }
- return false;
- }
-
- if (ui::IsWindowVisible(xid) &&
- 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 {
@@ -226,8 +182,16 @@
gfx::NativeWindow DesktopScreenX11::GetWindowAtScreenPoint(
const gfx::Point& point) {
- ToplevelWindowFinder finder;
- return finder.FindAt(point);
+ std::vector<aura::Window*> windows =
+ DesktopWindowTreeHostX11::GetAllOpenWindows();
+
+ for (std::vector<aura::Window*>::const_iterator it = windows.begin();
+ it != windows.end(); ++it) {
+ if ((*it)->GetBoundsInScreen().Contains(point))
+ return *it;
+ }
+
+ return NULL;
}
int DesktopScreenX11::GetNumDisplays() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698