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

Unified Diff: ash/common/system/chromeos/palette/palette_utils.cc

Issue 2303963002: cros/ash: If the partial magnifier is active, do not consume input events if over palette views. (Closed)
Patch Set: Created 4 years, 3 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: ash/common/system/chromeos/palette/palette_utils.cc
diff --git a/ash/common/system/chromeos/palette/palette_utils.cc b/ash/common/system/chromeos/palette/palette_utils.cc
index 6a76068e90e36ebb1cf76aeeedba22767956d69a..179095729f8edced3eb9cd7cf6ab44659c51ef6b 100644
--- a/ash/common/system/chromeos/palette/palette_utils.cc
+++ b/ash/common/system/chromeos/palette/palette_utils.cc
@@ -5,7 +5,16 @@
#include "ash/common/system/chromeos/palette/palette_utils.h"
#include "ash/common/ash_switches.h"
+#include "ash/common/shelf/shelf_widget.h"
+#include "ash/common/shelf/wm_shelf.h"
+#include "ash/common/system/chromeos/palette/palette_tray.h"
+#include "ash/common/system/status_area_widget.h"
+#include "ash/common/wm_root_window_controller.h"
+#include "ash/common/wm_shell.h"
+#include "ash/common/wm_window.h"
#include "base/command_line.h"
+#include "ui/events/event.h"
+#include "ui/gfx/geometry/point.h"
namespace ash {
@@ -19,4 +28,24 @@ bool ArePaletteExperimentalFeaturesEnabled() {
switches::kAshEnableExperimentalPaletteFeatures);
}
+bool PaletteContainsEvent(ui::LocatedEvent* event) {
+ ash::WmWindow* primary = ash::WmShell::Get()->GetPrimaryRootWindow();
James Cook 2016/09/01 23:16:02 no need for ash:: in this function
jdufault 2016/09/02 20:20:38 Done.
+
+ for (ash::WmWindow* window : ash::WmShell::Get()->GetAllRootWindows()) {
jdufault 2016/09/01 22:31:31 Is there a better way to figure out if an event is
James Cook 2016/09/01 23:16:02 This seems reasonable to me.
+ // Convert point so that it is relative to the primary display, which is how
+ // the view screen coordinates (for PaletteTray) are setup. Normally
+ // root_location() is relative to the window that generated it.
+ gfx::Point point =
+ window->ConvertPointToTarget(primary, event->root_location());
+
+ ash::WmShelf* shelf = window->GetRootWindowController()->GetShelf();
James Cook 2016/09/01 23:16:02 WmShelf::ForWindow() is useful here, lets you skip
jdufault 2016/09/02 20:20:38 Done.
+ ash::PaletteTray* palette_tray =
+ shelf->shelf_widget()->status_area_widget()->palette_tray();
James Cook 2016/09/01 23:16:02 nit: shelf->GetStatusAreaWidget() will let you ski
jdufault 2016/09/02 20:20:38 Done.
+ if (palette_tray && palette_tray->ContainsPointInScreen(point))
+ return true;
+ }
+
+ return false;
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698