Index: ash/system/tray/tray_event_filter.cc |
diff --git a/ash/system/tray/tray_event_filter.cc b/ash/system/tray/tray_event_filter.cc |
index 43f142b4cd7e4ee240918cf5f1d0762bdfb37538..873e7df1e7b615266e3df883a81bc2aeb2fb23d5 100644 |
--- a/ash/system/tray/tray_event_filter.cc |
+++ b/ash/system/tray/tray_event_filter.cc |
@@ -5,10 +5,12 @@ |
#include "ash/system/tray/tray_event_filter.h" |
#include "ash/public/cpp/shell_window_ids.h" |
+#include "ash/shell.h" |
#include "ash/shell_port.h" |
#include "ash/system/tray/tray_background_view.h" |
#include "ash/system/tray/tray_bubble_wrapper.h" |
#include "ash/wm/container_finder.h" |
+#include "ash/wm/maximize_mode/maximize_mode_controller.h" |
#include "ui/aura/window.h" |
#include "ui/views/widget/widget.h" |
@@ -73,6 +75,19 @@ void TrayEventFilter::ProcessPressedEvent(const gfx::Point& location_in_screen, |
gfx::Rect bounds = bubble_widget->GetWindowBoundsInScreen(); |
bounds.Inset(wrapper->bubble_view()->GetBorderInsets()); |
+ // System tray can be dragged to show the bubble if it is in maximize mode. |
+ // During the drag, the bubble's logical bounds can extend outside of the |
+ // work area, but its visual bounds are only within the work area. Restrict |
+ // |bounds| so that events located outside the bubble's visual bounds are |
+ // treated as outside of the bubble. |
+ int bubble_container_id = |
+ wm::GetContainerForWindow(bubble_widget->GetNativeWindow())->id(); |
+ if (Shell::Get() |
+ ->maximize_mode_controller() |
+ ->IsMaximizeModeWindowManagerEnabled() && |
+ bubble_container_id == kShellWindowId_SettingBubbleContainer) { |
+ bounds.Intersect(bubble_widget->GetWorkAreaBoundsInScreen()); |
+ } |
if (bounds.Contains(location_in_screen)) |
continue; |
if (wrapper->tray()) { |