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