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

Unified Diff: ui/views/widget/desktop_aura/x11_topmost_window_finder.h

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/x11_topmost_window_finder.h
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder.h b/ui/views/widget/desktop_aura/x11_topmost_window_finder.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf8498abe50f5a803a5613cb97f3cccda0348b25
--- /dev/null
+++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder.h
@@ -0,0 +1,53 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_TOPMOST_WINDOW_FINDER_H_
+#define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_TOPMOST_WINDOW_FINDER_H_
+
+#include <set>
+
+#include "ui/base/x/x11_util.h"
+#include "ui/gfx/point.h"
+#include "ui/views/views_export.h"
+
+namespace aura {
+class Window;
+}
+
+namespace views {
+
+// Utility class for finding the topmost window at a given screen position.
+class VIEWS_EXPORT X11TopmostWindowFinder
+ : public ui::EnumerateWindowsDelegate {
+ public:
+ X11TopmostWindowFinder();
+ virtual ~X11TopmostWindowFinder();
+
+ // Returns the topmost window at |screen_loc|, ignoring the windows in
+ // |ignore|. Returns NULL if the topmost window at |screen_loc| does not
+ // belong to Chrome.
+ aura::Window* FindLocalProcessWindowAt(const gfx::Point& screen_loc,
+ const std::set<aura::Window*>& ignore);
+
+ // Returns the topmost window at |screen_loc|.
+ XID FindWindowAt(const gfx::Point& screen_loc);
+
+ private:
+ // ui::EnumerateWindowsDelegate:
+ virtual bool ShouldStopIterating(XID xid) OVERRIDE;
+
+ // Returns true if |window| does not not belong to |ignore|, is visible and
+ // contains |screen_loc_|.
+ bool ShouldStopIteratingAtLocalProcessWindow(aura::Window* window);
+
+ gfx::Point screen_loc_;
+ std::set<aura::Window*> ignore_;
+ XID toplevel_;
+
+ DISALLOW_COPY_AND_ASSIGN(X11TopmostWindowFinder);
+};
+
+} // namespace
+
+#endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_TOPMOST_WINDOW_FINDER_H_

Powered by Google App Engine
This is Rietveld 408576698