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

Unified Diff: components/exo/display.h

Issue 2396883003: exo: Fix dragging edge cases (Closed)
Patch Set: Fix unit tests Created 4 years, 2 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 | components/exo/display.cc » ('j') | components/exo/shell_surface.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/display.h
diff --git a/components/exo/display.h b/components/exo/display.h
index d4f3b3d08065b522f902612fe7fabe6c23a806de..f841c94e74c21568f6c0ff5f04ad428e6ef09307 100644
--- a/components/exo/display.h
+++ b/components/exo/display.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/memory/shared_memory_handle.h"
+#include "ui/gfx/geometry/point.h"
#if defined(USE_OZONE)
#include "base/files/scoped_file.h"
@@ -20,10 +21,6 @@
#include "ui/gfx/native_pixmap_handle.h"
#endif
-namespace gfx {
-class Point;
-}
-
namespace exo {
class NotificationSurface;
class NotificationSurfaceManager;
@@ -45,6 +42,20 @@ class Display {
explicit Display(NotificationSurfaceManager* notification_surface_manager);
~Display();
+ void set_virtual_origin(const gfx::Point& virtual_origin) {
+ virtual_origin_ = virtual_origin;
+ }
+
+ template <typename Point>
+ void ConvertFromVirtualToScreen(Point* point) const {
+ *point += virtual_origin_.OffsetFromOrigin();
+ }
+
+ template <typename Point>
+ void ConvertFromScreenToVirtual(Point* point) const {
+ *point -= virtual_origin_.OffsetFromOrigin();
+ }
+
// Creates a new surface.
std::unique_ptr<Surface> CreateSurface();
@@ -88,6 +99,9 @@ class Display {
const std::string& notification_id);
private:
+ // Origin of the virtual screen relative to the primary display.
+ gfx::Point virtual_origin_;
+
NotificationSurfaceManager* const notification_surface_manager_;
DISALLOW_COPY_AND_ASSIGN(Display);
« no previous file with comments | « no previous file | components/exo/display.cc » ('j') | components/exo/shell_surface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698