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

Side by Side Diff: ui/wayland/wayland_display.h

Issue 7457023: Adding a Wayland basic toolkit (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed naming for consts Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
(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 struct wl_compositor;
14 struct wl_display;
15 struct wl_shell;
16 struct wl_shm;
17 struct wl_surface;
18 struct wl_visual;
19
20 namespace ui {
21
22 class WaylandBuffer;
23 class WaylandInputDevice;
24 class WaylandScreen;
25
26 // WaylandDisplay is a wrapper around wl_display. Once we get a valid
27 // wl_display, the Wayland server will send different events to register
28 // the Wayland compositor, shell, visuals, screens, input devices, ...
29 class WaylandDisplay {
30 public:
31 // Attempt to create a connection to the display. If it fails this returns
32 // NULL
33 static WaylandDisplay* Connect(char* name);
34 // Get the WaylandDisplay associated with the native Wayland display
35 static WaylandDisplay* GetDisplay(wl_display* display);
36
37 ~WaylandDisplay();
38
39 // Creates a wayland surface. This is used to create a window surface.
40 // The returned pointer should be deleted by the caller.
41 wl_surface* CreateSurface();
42 // Sets the specified buffer as the surface for the cursor. (x, y) is
43 // the hotspot for the cursor.
44 void SetCursor(WaylandBuffer* buffer, int32_t x, int32_t y);
45
46 // Returns a pointer to the wl_display.
47 wl_display* GetNativeDisplay() const;
48
49 // Returns a list of the registered screens.
50 std::list<WaylandScreen*> GetScreenList() const;
51
52 wl_shell* GetShell() const;
53
54 wl_shm* GetShm() const;
55
56 wl_visual* GetVisual() const;
57
58 private:
59 WaylandDisplay(char* name);
60
61 // This handler resolves all server events used in initialization. It also
62 // handles input device registration, screen registration.
63 static void DisplayHandleGlobal(wl_display* display,
64 uint32_t id,
65 const char* interface,
66 uint32_t version,
67 void* data);
68 // Used by the compositor initialization to register the different visuals.
69 static void CompositorHandleVisual(void* data,
70 wl_compositor* compositor,
71 uint32_t id,
72 uint32_t token);
73 // Used when the shell requires configuration. This is called when a
74 // window is configured and receives its size.
75 // TODO(dnicoara) Need to look if there is one shell per window. Then it
76 // makes more sense to move this into the WaylandWindow and it would keep
77 // track of the shell.
78 static void ShellHandleConfigure(void* data,
79 wl_shell* shell,
80 uint32_t time,
81 uint32_t edges,
82 wl_surface* surface,
83 int32_t width,
84 int32_t height);
85
86 // WaylandDisplay manages the memory of all these pointers.
87 wl_display* display_;
88 wl_compositor* compositor_;
89 wl_shell* shell_;
90 wl_shm* shm_;
91 wl_visual* visual_;
92 std::list<WaylandScreen*> screen_list_;
93 std::list<WaylandInputDevice*> input_list_;
94
95 DISALLOW_COPY_AND_ASSIGN(WaylandDisplay);
96 };
97
98 } // namespace ui
99
100 #endif // UI_WAYLAND_WAYLAND_DISPLAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698