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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/exo/display.cc » ('j') | components/exo/shell_surface.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_EXO_DISPLAY_H_ 5 #ifndef COMPONENTS_EXO_DISPLAY_H_
6 #define COMPONENTS_EXO_DISPLAY_H_ 6 #define COMPONENTS_EXO_DISPLAY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/shared_memory_handle.h" 14 #include "base/memory/shared_memory_handle.h"
15 #include "ui/gfx/geometry/point.h"
15 16
16 #if defined(USE_OZONE) 17 #if defined(USE_OZONE)
17 #include "base/files/scoped_file.h" 18 #include "base/files/scoped_file.h"
18 #include "ui/gfx/buffer_types.h" 19 #include "ui/gfx/buffer_types.h"
19 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
20 #include "ui/gfx/native_pixmap_handle.h" 21 #include "ui/gfx/native_pixmap_handle.h"
21 #endif 22 #endif
22 23
23 namespace gfx {
24 class Point;
25 }
26
27 namespace exo { 24 namespace exo {
28 class NotificationSurface; 25 class NotificationSurface;
29 class NotificationSurfaceManager; 26 class NotificationSurfaceManager;
30 class SharedMemory; 27 class SharedMemory;
31 class ShellSurface; 28 class ShellSurface;
32 class SubSurface; 29 class SubSurface;
33 class Surface; 30 class Surface;
34 31
35 #if defined(USE_OZONE) 32 #if defined(USE_OZONE)
36 class Buffer; 33 class Buffer;
37 #endif 34 #endif
38 35
39 // The core display class. This class provides functions for creating surfaces 36 // The core display class. This class provides functions for creating surfaces
40 // and is in charge of combining the contents of multiple surfaces into one 37 // and is in charge of combining the contents of multiple surfaces into one
41 // displayable output. 38 // displayable output.
oshima 2016/10/12 01:56:54 can you add documentation how coordinates work bet
Dominik Laskowski 2016/10/13 03:21:16 Done.
42 class Display { 39 class Display {
43 public: 40 public:
44 Display(); 41 Display();
45 explicit Display(NotificationSurfaceManager* notification_surface_manager); 42 explicit Display(NotificationSurfaceManager* notification_surface_manager);
46 ~Display(); 43 ~Display();
47 44
45 void set_virtual_origin(const gfx::Point& virtual_origin) {
46 virtual_origin_ = virtual_origin;
47 }
48
49 template <typename Point>
50 void ConvertFromVirtualToScreen(Point* point) const {
51 *point += virtual_origin_.OffsetFromOrigin();
52 }
53
54 template <typename Point>
55 void ConvertFromScreenToVirtual(Point* point) const {
56 *point -= virtual_origin_.OffsetFromOrigin();
57 }
58
48 // Creates a new surface. 59 // Creates a new surface.
49 std::unique_ptr<Surface> CreateSurface(); 60 std::unique_ptr<Surface> CreateSurface();
50 61
51 // Creates a shared memory segment from |handle| of |size| with the 62 // Creates a shared memory segment from |handle| of |size| with the
52 // given |id|. This function takes ownership of |handle|. 63 // given |id|. This function takes ownership of |handle|.
53 std::unique_ptr<SharedMemory> CreateSharedMemory( 64 std::unique_ptr<SharedMemory> CreateSharedMemory(
54 const base::SharedMemoryHandle& handle, 65 const base::SharedMemoryHandle& handle,
55 size_t size); 66 size_t size);
56 67
57 #if defined(USE_OZONE) 68 #if defined(USE_OZONE)
(...skipping 23 matching lines...) Expand all
81 // a child of |parent|. 92 // a child of |parent|.
82 std::unique_ptr<SubSurface> CreateSubSurface(Surface* surface, 93 std::unique_ptr<SubSurface> CreateSubSurface(Surface* surface,
83 Surface* parent); 94 Surface* parent);
84 95
85 // Creates a notification surface for a surface and notification id. 96 // Creates a notification surface for a surface and notification id.
86 std::unique_ptr<NotificationSurface> CreateNotificationSurface( 97 std::unique_ptr<NotificationSurface> CreateNotificationSurface(
87 Surface* surface, 98 Surface* surface,
88 const std::string& notification_id); 99 const std::string& notification_id);
89 100
90 private: 101 private:
102 // Origin of the virtual screen relative to the primary display.
103 gfx::Point virtual_origin_;
104
91 NotificationSurfaceManager* const notification_surface_manager_; 105 NotificationSurfaceManager* const notification_surface_manager_;
92 106
93 DISALLOW_COPY_AND_ASSIGN(Display); 107 DISALLOW_COPY_AND_ASSIGN(Display);
94 }; 108 };
95 109
96 } // namespace exo 110 } // namespace exo
97 111
98 #endif // COMPONENTS_EXO_DISPLAY_H_ 112 #endif // COMPONENTS_EXO_DISPLAY_H_
OLDNEW
« 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