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

Side by Side Diff: ui/aura/root_window_host_wayland.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/aura/env.cc ('k') | ui/aura/root_window_host_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_AURA_ROOT_WINDOW_HOST_X11_H_ 5 #ifndef UI_AURA_ROOT_WINDOW_HOST_WAYLAND_H_
6 #define UI_AURA_ROOT_WINDOW_HOST_X11_H_ 6 #define UI_AURA_ROOT_WINDOW_HOST_WAYLAND_H_
7
8 #include <X11/Xlib.h>
9 7
10 #include <vector> 8 #include <vector>
11 9
12 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
13 #undef RootWindow
14
15 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop.h" 11 #include "base/message_loop.h"
17 #include "ui/aura/aura_export.h"
18 #include "ui/aura/env_observer.h" 12 #include "ui/aura/env_observer.h"
19 #include "ui/aura/root_window_host.h" 13 #include "ui/aura/root_window_host.h"
20 #include "ui/base/x/x11_atom_cache.h"
21 #include "ui/base/x/x11_util.h"
22 #include "ui/gfx/insets.h" 14 #include "ui/gfx/insets.h"
23 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/wayland/wayland_display.h"
17 #include "ui/wayland/wayland_window.h"
18
19 namespace base {
20 namespace wayland {
21 union WaylandEvent;
22 }
23 }
24 24
25 namespace ui { 25 namespace ui {
26 class MouseEvent; 26 class MouseEvent;
27 } 27 }
28 28
29 namespace aura { 29 namespace aura {
30 30
31 namespace internal { 31 class RootWindowHostWayland : public RootWindowHost,
32 class TouchEventCalibrate; 32 public base::MessageLoop::Dispatcher,
33 } 33 public EnvObserver {
34
35 class RootWindowHostX11 : public RootWindowHost,
36 public base::MessageLoop::Dispatcher,
37 public EnvObserver {
38 public: 34 public:
39 explicit RootWindowHostX11(const gfx::Rect& bounds); 35 explicit RootWindowHostWayland(const gfx::Rect& bounds);
40 virtual ~RootWindowHostX11(); 36 virtual ~RootWindowHostWayland();
41 37
42 // Overridden from Dispatcher overrides: 38 // Overridden from Dispatcher overrides:
43 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; 39 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE;
44 40
45 // RootWindowHost Overrides. 41 // RootWindowHost Overrides.
46 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; 42 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE;
47 virtual RootWindow* GetRootWindow() OVERRIDE; 43 virtual RootWindow* GetRootWindow() OVERRIDE;
48 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; 44 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
49 virtual void Show() OVERRIDE; 45 virtual void Show() OVERRIDE;
50 virtual void Hide() OVERRIDE; 46 virtual void Hide() OVERRIDE;
51 virtual void ToggleFullScreen() OVERRIDE; 47 virtual void ToggleFullScreen() OVERRIDE;
52 virtual gfx::Rect GetBounds() const OVERRIDE; 48 virtual gfx::Rect GetBounds() const OVERRIDE;
53 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 49 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
54 virtual gfx::Insets GetInsets() const OVERRIDE; 50 virtual gfx::Insets GetInsets() const OVERRIDE;
55 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; 51 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE;
56 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; 52 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
57 virtual void SetCapture() OVERRIDE; 53 virtual void SetCapture() OVERRIDE;
58 virtual void ReleaseCapture() OVERRIDE; 54 virtual void ReleaseCapture() OVERRIDE;
59 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; 55 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE;
60 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; 56 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE;
61 virtual bool ConfineCursorToRootWindow() OVERRIDE; 57 virtual bool ConfineCursorToRootWindow() OVERRIDE;
62 virtual void UnConfineCursor() OVERRIDE; 58 virtual void UnConfineCursor() OVERRIDE;
63 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; 59 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE;
64 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; 60 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
65 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE; 61 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE;
66 virtual bool CopyAreaToSkCanvas(const gfx::Rect& source_bounds, 62 virtual bool CopyAreaToSkCanvas(const gfx::Rect& source_bounds,
67 const gfx::Point& dest_offset, 63 const gfx::Point& dest_offset,
68 SkCanvas* canvas) OVERRIDE; 64 SkCanvas* canvas) OVERRIDE;
65 virtual bool GrabSnapshot(
66 const gfx::Rect& snapshot_bounds,
67 std::vector<unsigned char>* png_representation) OVERRIDE;
69 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; 68 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE;
70 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; 69 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
71 virtual void PrepareForShutdown() OVERRIDE; 70 virtual void PrepareForShutdown() OVERRIDE;
72 71
73 // EnvObserver overrides. 72 // EnvObserver overrides.
74 virtual void OnWindowInitialized(Window* window) OVERRIDE; 73 virtual void OnWindowInitialized(Window* window) OVERRIDE;
75 virtual void OnRootWindowInitialized(RootWindow* root_window) OVERRIDE; 74 virtual void OnRootWindowInitialized(RootWindow* root_window) OVERRIDE;
76 private: 75 private:
77 class MouseMoveFilter;
78 76
79 bool DispatchEventForRootWindow(const base::NativeEvent& event); 77 bool DispatchEventForRootWindow(const base::NativeEvent& event);
80 78
81 // Dispatches XI2 events. Note that some events targetted for the X root
82 // window are dispatched to the aura root window (e.g. touch events after
83 // calibration).
84 void DispatchXI2Event(const base::NativeEvent& event);
85
86 // Returns true if there's an X window manager present... in most cases. Some 79 // Returns true if there's an X window manager present... in most cases. Some
87 // window managers (notably, ion3) don't implement enough of ICCCM for us to 80 // window managers (notably, ion3) don't implement enough of ICCCM for us to
88 // detect that they're there. 81 // detect that they're there.
89 bool IsWindowManagerPresent(); 82 bool IsWindowManagerPresent();
90 83
91 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update 84 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update
92 // |current_cursor_|. 85 // |current_cursor_|.
93 void SetCursorInternal(gfx::NativeCursor cursor); 86 void SetCursorInternal(gfx::NativeCursor cursor);
94 87
95 // Translates the native mouse location into screen coordinates and and 88 // Translates the native mouse location into screen coordinates and and
96 // dispatches the event to RootWindowHostDelegate. 89 // dispatches the event to RootWindowHostDelegate.
97 void TranslateAndDispatchMouseEvent(ui::MouseEvent* event); 90 void TranslateAndDispatchMouseEvent(ui::MouseEvent* event);
98 91
99 // Copies and returns |snapshot_bounds| from |xwindow_|. Helper method for
100 // CopyAreaToSkCanvas() and GrabSnapshot().
101 scoped_ptr<ui::XScopedImage> GetXImage(const gfx::Rect& snapshot_bounds);
102
103 // Update is_internal_display_ based on delegate_ state 92 // Update is_internal_display_ based on delegate_ state
104 void UpdateIsInternalDisplay(); 93 void UpdateIsInternalDisplay();
105 94
106 RootWindowHostDelegate* delegate_; 95 RootWindowHostDelegate* delegate_;
107 96
108 // The display and the native X window hosting the root window. 97 // The display and the native window hosting the root window.
109 Display* xdisplay_; 98 ui::WaylandDisplay* display_;
110 ::Window xwindow_; 99 ui::WaylandWindow* window_;
111
112 // The native root window.
113 ::Window x_root_window_;
114 100
115 // Current Aura cursor. 101 // Current Aura cursor.
116 gfx::NativeCursor current_cursor_; 102 gfx::NativeCursor current_cursor_;
117 103
118 // Is the window mapped to the screen? 104 // Is the window mapped to the screen?
119 bool window_mapped_; 105 bool window_mapped_;
120 106
121 // The bounds of |xwindow_|. 107 // The bounds of |xwindow_|.
122 gfx::Rect bounds_; 108 gfx::Rect bounds_;
123 109
124 // The insets that specifies the effective area within the |window_|. 110 // The insets that specifies the effective area within the |window_|.
125 gfx::Insets insets_; 111 gfx::Insets insets_;
126 112
127 // The bounds of |x_root_window_|.
128 gfx::Rect x_root_bounds_;
129
130 // True if the root host resides on the internal display 113 // True if the root host resides on the internal display
131 bool is_internal_display_; 114 bool is_internal_display_;
132 115
133 // True if the window should be focused when the window is shown. 116 // True if the window should be focused when the window is shown.
134 bool focus_when_shown_; 117 bool focus_when_shown_;
135 118
136 scoped_ptr<XID[]> pointer_barriers_; 119 DISALLOW_COPY_AND_ASSIGN(RootWindowHostWayland);
137
138 scoped_ptr<internal::TouchEventCalibrate> touch_calibrate_;
139
140 scoped_ptr<MouseMoveFilter> mouse_move_filter_;
141
142 ui::X11AtomCache atom_cache_;
143
144 DISALLOW_COPY_AND_ASSIGN(RootWindowHostX11);
145 }; 120 };
146 121
147 namespace test {
148
149 // Set the default value of the override redirect flag used to
150 // create a X window for RootWindowHostX11.
151 AURA_EXPORT void SetUseOverrideRedirectWindowByDefault(bool override_redirect);
152
153 } // namespace test
154 } // namespace aura 122 } // namespace aura
155 123
156 #endif // UI_AURA_ROOT_WINDOW_HOST_X11_H_ 124 #endif // UI_AURA_ROOT_WINDOW_HOST_WAYLAND_H_
OLDNEW
« no previous file with comments | « ui/aura/env.cc ('k') | ui/aura/root_window_host_wayland.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698