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

Unified Diff: ui/views/mus/native_widget_mus.cc

Issue 1918183003: mash: Close the system tray bubble on click outside its bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pointerwatcher
Patch Set: rebase Created 4 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
« no previous file with comments | « ash/system/web_notification/web_notification_tray.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/native_widget_mus.cc
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
index 44c7550552c39d4e054064bf37547afa8522591a..45b07ff1e59a67e70d17e61f686552691452a5c2 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -108,6 +108,33 @@ class NativeWidgetMusWindowTreeClient : public aura::client::WindowTreeClient {
DISALLOW_COPY_AND_ASSIGN(NativeWidgetMusWindowTreeClient);
};
+// A screen position client that applies the offset of the mus::Window.
+class ScreenPositionClientMus : public wm::DefaultScreenPositionClient {
+ public:
+ explicit ScreenPositionClientMus(mus::Window* mus_window)
+ : mus_window_(mus_window) {}
+ ~ScreenPositionClientMus() override {}
+
+ // wm::DefaultScreenPositionClient:
+ void ConvertPointToScreen(const aura::Window* window,
+ gfx::Point* point) override {
+ wm::DefaultScreenPositionClient::ConvertPointToScreen(window, point);
+ gfx::Rect mus_bounds = mus_window_->GetBoundsInRoot();
+ point->Offset(-mus_bounds.x(), -mus_bounds.y());
+ }
+ void ConvertPointFromScreen(const aura::Window* window,
+ gfx::Point* point) override {
+ gfx::Rect mus_bounds = mus_window_->GetBoundsInRoot();
+ point->Offset(mus_bounds.x(), mus_bounds.y());
+ wm::DefaultScreenPositionClient::ConvertPointFromScreen(window, point);
+ }
+
+ private:
+ mus::Window* mus_window_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScreenPositionClientMus);
+};
+
// As the window manager renderers the non-client decorations this class does
// very little but honor the client area insets from the window manager.
class ClientSideNonClientFrameView : public NonClientFrameView {
@@ -397,7 +424,7 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
focus_client_.get());
aura::client::SetActivationClient(window_tree_host_->window(),
focus_client_.get());
- screen_position_client_.reset(new wm::DefaultScreenPositionClient());
+ screen_position_client_.reset(new ScreenPositionClientMus(window_));
aura::client::SetScreenPositionClient(window_tree_host_->window(),
screen_position_client_.get());
« no previous file with comments | « ash/system/web_notification/web_notification_tray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698