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

Side by Side Diff: views/widget/native_widget_wayland.h

Issue 7464027: Wayland support for views. views_desktop on Wayland. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated native_widget_wayland.cc to match compositor changes Created 9 years, 4 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 | « views/views.gyp ('k') | views/widget/native_widget_wayland.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 (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 VIEWS_WIDGET_NATIVE_WIDGET_WAYLAND_H_
6 #define VIEWS_WIDGET_NATIVE_WIDGET_WAYLAND_H_
7 #pragma once
8
9 #include <wayland-client.h>
10
11 #include "base/memory/scoped_vector.h"
12 #include "ui/gfx/gl/gl_context.h"
13 #include "ui/gfx/gl/gl_surface.h"
14 #include "ui/gfx/size.h"
15 #include "ui/wayland/wayland_widget.h"
16 #include "views/widget/native_widget_private.h"
17 #include "views/widget/widget.h"
18
19 typedef struct _cairo_device cairo_device_t;
20 typedef struct _cairo_surface cairo_surface_t;
21
22 namespace gfx {
23 class Rect;
24 }
25
26 namespace ui {
27 class ViewProp;
28 class WaylandDisplay;
29 class WaylandInputDevice;
30 class WaylandWindow;
31 }
32
33 namespace views {
34
35 namespace internal {
36 class NativeWidgetDelegate;
37 }
38
39 // Widget implementation for Wayland
40 class NativeWidgetWayland : public internal::NativeWidgetPrivate,
41 public ui::WaylandWidget {
42 public:
43 explicit NativeWidgetWayland(internal::NativeWidgetDelegate* delegate);
44 virtual ~NativeWidgetWayland();
45
46 // Overridden from NativeWidget:
47 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE;
48 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
49 virtual void UpdateFrameAfterFrameChange() OVERRIDE;
50 virtual bool ShouldUseNativeFrame() const OVERRIDE;
51 virtual void FrameTypeChanged() OVERRIDE;
52 virtual Widget* GetWidget() OVERRIDE;
53 virtual const Widget* GetWidget() const OVERRIDE;
54 virtual gfx::NativeView GetNativeView() const OVERRIDE;
55 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
56 virtual Widget* GetTopLevelWidget() OVERRIDE;
57 virtual const ui::Compositor* GetCompositor() const OVERRIDE;
58 virtual ui::Compositor* GetCompositor() OVERRIDE;
59 virtual void MarkLayerDirty() OVERRIDE;
60 virtual void CalculateOffsetToAncestorWithLayer(gfx::Point* offset,
61 View** ancestor) OVERRIDE;
62 virtual void ViewRemoved(View* view) OVERRIDE;
63 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
64 virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE;
65 virtual TooltipManager* GetTooltipManager() const OVERRIDE;
66 virtual bool IsScreenReaderActive() const OVERRIDE;
67 virtual void SendNativeAccessibilityEvent(
68 View* view,
69 ui::AccessibilityTypes::Event event_type) OVERRIDE;
70 virtual void SetMouseCapture() OVERRIDE;
71 virtual void ReleaseMouseCapture() OVERRIDE;
72 virtual bool HasMouseCapture() const OVERRIDE;
73 virtual InputMethod* CreateInputMethod() OVERRIDE;
74 virtual void CenterWindow(const gfx::Size& size) OVERRIDE;
75 virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds,
76 bool* maximized) const OVERRIDE;
77 virtual void SetWindowTitle(const std::wstring& title) OVERRIDE;
78 virtual void SetWindowIcons(const SkBitmap& window_icon,
79 const SkBitmap& app_icon) OVERRIDE;
80 virtual void SetAccessibleName(const std::wstring& name) OVERRIDE;
81 virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
82 virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
83 virtual void BecomeModal() OVERRIDE;
84 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
85 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
86 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
87 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
88 virtual void SetSize(const gfx::Size& size) OVERRIDE;
89 virtual void SetBoundsConstrained(const gfx::Rect& bounds,
90 Widget* other_widget) OVERRIDE;
91 virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE;
92 virtual void MoveToTop() OVERRIDE;
93 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
94 virtual void Close() OVERRIDE;
95 virtual void CloseNow() OVERRIDE;
96 virtual void EnableClose(bool enable) OVERRIDE;
97 virtual void Show() OVERRIDE;
98 virtual void Hide() OVERRIDE;
99 virtual void ShowMaximizedWithBounds(
100 const gfx::Rect& restored_bounds) OVERRIDE;
101 virtual void ShowWithState(ShowState state) OVERRIDE;
102 virtual bool IsVisible() const OVERRIDE;
103 virtual void Activate() OVERRIDE;
104 virtual void Deactivate() OVERRIDE;
105 virtual bool IsActive() const OVERRIDE;
106 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
107 virtual void Maximize() OVERRIDE;
108 virtual void Minimize() OVERRIDE;
109 virtual bool IsMaximized() const OVERRIDE;
110 virtual bool IsMinimized() const OVERRIDE;
111 virtual void Restore() OVERRIDE;
112 virtual void SetFullscreen(bool fullscreen) OVERRIDE;
113 virtual bool IsFullscreen() const OVERRIDE;
114 virtual void SetOpacity(unsigned char opacity) OVERRIDE;
115 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE;
116 virtual bool IsAccessibleWidget() const OVERRIDE;
117 virtual void RunShellDrag(View* view,
118 const ui::OSExchangeData& data,
119 int operation) OVERRIDE;
120 virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE;
121 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE;
122 virtual void ClearNativeFocus() OVERRIDE;
123 virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE;
124 virtual bool ConvertPointFromAncestor(
125 const Widget* ancestor, gfx::Point* point) const OVERRIDE;
126
127 virtual void OnMotionNotify(ui::WaylandEvent event) OVERRIDE;
128 virtual void OnButtonNotify(ui::WaylandEvent event) OVERRIDE;
129 virtual void OnKeyNotify(ui::WaylandEvent event) OVERRIDE;
130 virtual void OnPointerFocus(ui::WaylandEvent event) OVERRIDE;
131 virtual void OnKeyboardFocus(ui::WaylandEvent event) OVERRIDE;
132
133 virtual void OnGeometryChange(ui::WaylandEvent event) OVERRIDE;
134
135 private:
136 typedef ScopedVector<ui::ViewProp> ViewProps;
137
138 // Overridden from NativeWidget
139 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
140
141 // Overridden from internal::InputMethodDelegate
142 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
143
144 void OnPaint(gfx::Rect damage_area);
145
146 static gboolean IdleRedraw(void* ptr);
147
148 // A delegate implementation that handles events received here.
149 // See class documentation for Widget in widget.h for a note about ownership.
150 internal::NativeWidgetDelegate* delegate_;
151
152 scoped_ptr<TooltipManager> tooltip_manager_;
153
154 // The following factory is used to delay destruction.
155 ScopedRunnableMethodFactory<NativeWidgetWayland> close_widget_factory_;
156
157 // See class documentation for Widget in widget.h for a note about ownership.
158 Widget::InitParams::Ownership ownership_;
159
160 // Keeps track of mause capture for this widget.
161 bool has_mouse_capture_;
162
163 // Current window allocation
164 gfx::Rect allocation_;
165 // Previous allocation. Used to restore the size and location.
166 gfx::Rect saved_allocation_;
167
168 // The compositor for accelerated drawing.
169 scoped_refptr<ui::Compositor> compositor_;
170
171 ViewProps props_;
172
173 // Pointer to the Wayland display. This object doesn't own the pointer.
174 ui::WaylandDisplay* wayland_display_;
175
176 // Wayland window associated with this widget.
177 ui::WaylandWindow* wayland_window_;
178
179 // The accelerated surface associated with a Wayland window.
180 struct wl_egl_window* egl_window_;
181
182 cairo_device_t* device_;
183
184 // Cairo surface associated with the Wayland accelerated surface. This is
185 // used when we're not using the accelerated painting path.
186 cairo_surface_t* cairo_surface_;
187 const cairo_user_data_key_t surface_data_key_;
188
189 // Used to accumulate damaged area between repaints.
190 // Necessary since Wayland seems to expect at most one paint per frame.
191 gfx::Rect damage_area_;
192
193 // The GL surface and context used to render when we're using unaccelerated
194 // rendering. If we're using accelerated rendering, we'll have a compositor
195 // and the compositor will have these, so we don't need to worry about them.
196 scoped_refptr<gfx::GLSurface> surface_;
197 scoped_refptr<gfx::GLContext> context_;
198
199 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWayland);
200 };
201
202 } // namespace views
203
204 #endif // VIEWS_WIDGET_NATIVE_WIDGET_WAYLAND_H_
OLDNEW
« no previous file with comments | « views/views.gyp ('k') | views/widget/native_widget_wayland.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698