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

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

Issue 17265006: wayland patch for inspection Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « ui/wayland/wayland_widget.h ('k') | ui/wayland/wayland_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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_WINDOW_H_
6 #define UI_WAYLAND_WAYLAND_WINDOW_H_
7
8 #include <stdint.h>
9
10 #include "base/basictypes.h"
11 #include "ui/gfx/point.h"
12 #include "ui/gfx/rect.h"
13 #include "ui/wayland/wayland_display.h"
14 #include <vector>
15
16 struct wl_surface;
17 struct wl_shell_surface;
18 struct wl_egl_window;
19
20 namespace ui {
21
22 class WaylandDisplay;
23 class WaylandDelegate;
24
25 // WaylandWindow wraps a wl_surface and some basic operations for the surface.
26 // WaylandWindow also keeps track of the WaylandDelegate that will process all
27 // events related to the window.
28 class WaylandWindow {
29 public:
30 typedef std::vector<WaylandWindow*> Windows;
31
32 // Creates a toplevel window.
33 WaylandWindow(WaylandDelegate* delegate, WaylandDisplay* display);
34
35 ~WaylandWindow();
36
37 bool IsVisible() const;
38
39 // Sets the window to fullscreen if |fullscreen| is true. Otherwise it sets
40 // it as a normal window.
41 void set_fullscreen(bool fullscreen) { fullscreen_ = fullscreen; }
42 bool fullscreen() const { return fullscreen_; }
43
44 void SetUserData(void *user_data) { user_data_ = user_data; }
45 void* GetUserData() const { return user_data_; }
46
47 // Returns a pointer to the parent window. NULL is this window doesn't have
48 // a parent.
49 WaylandWindow* GetToplevelWindow() { return this; }
50 WaylandWindow* GetParentWindow() const { return parent_window_; }
51 void SetParentWindow(WaylandWindow* parent_window);
52
53 WaylandDelegate* delegate() const { return delegate_; }
54
55 // Returns the pointer to the surface associated with the window.
56 // The WaylandWindow object owns the pointer.
57 wl_surface* surface() const { return surface_; }
58 wl_shell_surface* shell_surface() const { return shell_surface_; }
59 void set_egl_window(wl_egl_window* egl_window) { window_ = egl_window; }
60 wl_egl_window* egl_window() const { return window_; }
61
62 void SetBounds(const gfx::Rect& new_bounds);
63 gfx::Rect GetBounds() const;
64 void Flush();
65 void GetResizeDelta(int &x, int &y);
66
67 void ScheduleResize(int32_t width, int32_t height);
68 void SchedulePaintInRect(const gfx::Rect& rect);
69 void ScheduleRedraw();
70
71 virtual void OnResize();
72 virtual void OnRedraw();
73
74 const Windows& GetChildren() const { return children_; }
75 void AddChild(WaylandWindow* child);
76 void RemoveChild(WaylandWindow* child);
77
78 void Show();
79 void Hide();
80 void SetType();
81
82 static void HandleConfigure(void *data, struct wl_shell_surface *shell_surface ,
83 uint32_t edges, int32_t width, int32_t height);
84 static void HandlePopupDone(void *data, struct wl_shell_surface *shell_surface );
85 static void HandlePing(void *data, struct wl_shell_surface *shell_surface, uin t32_t serial);
86
87 private:
88 static void FreeSurface(void *data, wl_callback *callback, uint32_t time);
89
90 enum WindowBufferType {
91 WINDOW_BUFFER_TYPE_EGL_WINDOW,
92 WINDOW_BUFFER_TYPE_EGL_IMAGE,
93 WINDOW_BUFFER_TYPE_SHM,
94 };
95
96 enum WindowType{
97 TYPE_TOPLEVEL,
98 TYPE_FULLSCREEN,
99 TYPE_TRANSIENT,
100 TYPE_MENU,
101 TYPE_CUSTOM
102 };
103
104 enum WindowLocation {
105 WINDOW_INTERIOR = 0,
106 WINDOW_RESIZING_TOP = 1,
107 WINDOW_RESIZING_BOTTOM = 2,
108 WINDOW_RESIZING_LEFT = 4,
109 WINDOW_RESIZING_TOP_LEFT = 5,
110 WINDOW_RESIZING_BOTTOM_LEFT = 6,
111 WINDOW_RESIZING_RIGHT = 8,
112 WINDOW_RESIZING_TOP_RIGHT = 9,
113 WINDOW_RESIZING_BOTTOM_RIGHT = 10,
114 WINDOW_RESIZING_MASK = 15,
115 WINDOW_EXTERIOR = 16,
116 WINDOW_TITLEBAR = 17,
117 WINDOW_CLIENT_AREA = 18,
118 };
119
120 // The delegate that will process events for this window. This is not owned
121 // by the window.
122 WaylandDelegate* delegate_;
123
124 // Pointer to the display this window is using. This doesn't own the pointer
125 // to the display.
126 WaylandDisplay* display_;
127
128 // When creating a transient window, |parent_window_| is set to point to the
129 // parent of this window. We will then use |parent_window_| to align this
130 // window at the specified offset in |relative_position_|.
131 // |parent_window_| is not owned by this window.
132 WaylandWindow* parent_window_;
133
134 // Position relative to parent window. This is only used by
135 // a transient window.
136 gfx::Point relative_position_;
137
138 // The native wayland surface associated with this window.
139 wl_surface* surface_;
140 wl_shell_surface* shell_surface_;
141
142 // Whether the window is in fullscreen mode.
143 bool fullscreen_;
144
145 int resize_edges_;
146 gfx::Rect allocation_;
147 gfx::Rect saved_allocation_;
148 gfx::Rect server_allocation_;
149 gfx::Rect pending_allocation_;
150 bool transparent_;
151 WindowBufferType buffer_type_;
152 WindowType type_;
153 bool resize_scheduled_;
154 bool redraw_scheduled_;
155 wl_egl_window *window_;
156
157 // Child windows. Topmost is last.
158 Windows children_;
159
160 void *user_data_;
161
162 DISALLOW_COPY_AND_ASSIGN(WaylandWindow);
163 };
164
165 } // namespace ui
166
167 #endif // UI_WAYLAND_WAYLAND_WINDOW_H_
OLDNEW
« no previous file with comments | « ui/wayland/wayland_widget.h ('k') | ui/wayland/wayland_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698