OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_WAYLAND_WAYLAND_DISPLAY_H_ | |
6 #define UI_WAYLAND_WAYLAND_DISPLAY_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <list> | |
11 | |
12 #include "base/basictypes.h" | |
13 | |
14 struct wl_compositor; | |
15 struct wl_display; | |
16 struct wl_shell; | |
17 struct wl_shm; | |
18 struct wl_surface; | |
19 struct wl_visual; | |
20 | |
21 namespace ui { | |
22 | |
23 class WaylandBuffer; | |
24 class WaylandInputDevice; | |
25 class WaylandScreen; | |
26 | |
27 // WaylandDisplay is a wrapper around wl_display. Once we get a valid | |
28 // wl_display, the Wayland server will send different events to register | |
29 // the Wayland compositor, shell, visuals, screens, input devices, ... | |
30 class WaylandDisplay { | |
31 public: | |
32 // Attempt to create a connection to the display. If it fails this returns | |
33 // NULL | |
34 static WaylandDisplay* Connect(char* name); | |
35 // Get the WaylandDisplay associated with the native Wayland display | |
36 static WaylandDisplay* GetDisplay(wl_display* display); | |
37 | |
38 ~WaylandDisplay(); | |
39 | |
40 // Creates a wayland surface. This is used to create a window surface. | |
41 // The returned pointer should be deleted by the caller. | |
42 wl_surface* CreateSurface(); | |
43 // Sets the specified buffer as the surface for the cursor. (x, y) is | |
44 // the hotspot for the cursor. | |
45 void SetCursor(WaylandBuffer* buffer, int32_t x, int32_t y); | |
46 | |
47 // Returns a pointer to the wl_display. | |
48 wl_display* GetNativeDisplay() const; | |
49 | |
50 // Returns a list of the registered screens. | |
51 std::list<WaylandScreen*> GetScreenList() const; | |
52 | |
53 wl_shell* GetShell() const; | |
tfarina
2011/07/25 18:34:27
Same thing here for these simple getter accessors?
| |
54 | |
55 wl_shm* GetShm() const; | |
56 | |
57 wl_visual* GetVisual() const; | |
58 | |
59 private: | |
60 WaylandDisplay(char* name); | |
61 | |
62 // This handler resolves all server events used in initialization. It also | |
63 // handles input device registration, screen registration. | |
64 static void DisplayHandleGlobal(wl_display* display, | |
65 uint32_t id, | |
66 const char* interface, | |
67 uint32_t version, | |
68 void* data); | |
69 // Used by the compositor initialization to register the different visuals. | |
tfarina
2011/07/25 18:34:27
please, separate which method with a blank line be
| |
70 static void CompositorHandleVisual(void* data, | |
71 wl_compositor* compositor, | |
72 uint32_t id, | |
73 uint32_t token); | |
74 // Used when the shell requires configuration. This is called when a | |
75 // window is configured and receives its size. | |
76 // TODO(dnicoara) Need to look if there is one shell per window. Then it | |
77 // makes more sense to move this into the WaylandWindow and it would keep | |
78 // track of the shell. | |
79 static void ShellHandleConfigure(void* data, | |
80 wl_shell* shell, | |
81 uint32_t time, | |
82 uint32_t edges, | |
83 wl_surface* surface, | |
84 int32_t width, | |
85 int32_t height); | |
86 | |
87 // WaylandDisplay manages the memory of all these pointers. | |
88 wl_display* display_; | |
89 wl_compositor* compositor_; | |
90 wl_shell* shell_; | |
91 wl_shm* shm_; | |
92 wl_visual* visual_; | |
93 std::list<WaylandScreen*> screen_list_; | |
94 std::list<WaylandInputDevice*> input_list_; | |
95 | |
96 DISALLOW_COPY_AND_ASSIGN(WaylandDisplay); | |
97 }; | |
98 | |
99 } // namespace ui | |
100 | |
101 #endif // UI_WAYLAND_WAYLAND_DISPLAY_H_ | |
OLD | NEW |