OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WINDOW_TREE_HOST_X11_H_ | 5 #ifndef UI_AURA_WINDOW_TREE_HOST_X11_H_ |
6 #define UI_AURA_WINDOW_TREE_HOST_X11_H_ | 6 #define UI_AURA_WINDOW_TREE_HOST_X11_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
10 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
11 #include "ui/events/event_source.h" | 11 #include "ui/events/event_source.h" |
12 #include "ui/events/platform/platform_event_dispatcher.h" | 12 #include "ui/events/platform/platform_event_dispatcher.h" |
13 #include "ui/gfx/insets.h" | 13 #include "ui/gfx/insets.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 #include "ui/gfx/x/x11_atom_cache.h" | 15 #include "ui/gfx/x/x11_atom_cache.h" |
| 16 #include "ui/window/platform_window.h" |
16 | 17 |
17 // X forward decls to avoid including Xlib.h in a header file. | 18 // X forward decls to avoid including Xlib.h in a header file. |
18 typedef struct _XDisplay XDisplay; | 19 typedef struct _XDisplay XDisplay; |
19 typedef unsigned long XID; | 20 typedef unsigned long XID; |
20 typedef XID Window; | 21 typedef XID Window; |
21 | 22 |
22 namespace ui { | 23 namespace ui { |
23 class MouseEvent; | 24 class MouseEvent; |
| 25 class PlatformWindow; |
24 } | 26 } |
25 | 27 |
26 namespace aura { | 28 namespace aura { |
27 | 29 |
28 namespace internal { | 30 namespace internal { |
29 class TouchEventCalibrate; | 31 class TouchEventCalibrate; |
30 } | 32 } |
31 | 33 |
32 class AURA_EXPORT WindowTreeHostX11 : public WindowTreeHost, | 34 class AURA_EXPORT WindowTreeHostX11 : public WindowTreeHost, |
33 public ui::EventSource, | 35 public ui::EventSource, |
34 public ui::PlatformEventDispatcher { | 36 public ui::PlatformEventDispatcher, |
35 | 37 public ui::PlatformWindowDelegate { |
36 public: | 38 public: |
37 explicit WindowTreeHostX11(const gfx::Rect& bounds); | 39 explicit WindowTreeHostX11(const gfx::Rect& bounds); |
38 virtual ~WindowTreeHostX11(); | 40 virtual ~WindowTreeHostX11(); |
39 | 41 |
40 // ui::PlatformEventDispatcher: | 42 // ui::PlatformEventDispatcher: |
41 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; | 43 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
42 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; | 44 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
43 | 45 |
44 // WindowTreeHost: | 46 // WindowTreeHost: |
45 virtual ui::EventSource* GetEventSource() OVERRIDE; | 47 virtual ui::EventSource* GetEventSource() OVERRIDE; |
46 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 48 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
47 virtual void Show() OVERRIDE; | 49 virtual void Show() OVERRIDE; |
48 virtual void Hide() OVERRIDE; | 50 virtual void Hide() OVERRIDE; |
49 virtual gfx::Rect GetBounds() const OVERRIDE; | 51 virtual gfx::Rect GetBounds() const OVERRIDE; |
50 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 52 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
51 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 53 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
52 virtual void SetCapture() OVERRIDE; | 54 virtual void SetCapture() OVERRIDE; |
53 virtual void ReleaseCapture() OVERRIDE; | 55 virtual void ReleaseCapture() OVERRIDE; |
54 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; | 56 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
55 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; | 57 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; |
56 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 58 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
57 virtual void SetCursorNative(gfx::NativeCursor cursor_type) OVERRIDE; | 59 virtual void SetCursorNative(gfx::NativeCursor cursor_type) OVERRIDE; |
58 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; | 60 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; |
59 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; | 61 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |
60 | 62 |
61 // ui::EventSource overrides. | 63 // ui::EventSource overrides. |
62 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 64 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
63 | 65 |
| 66 // ui::PlatformWindowDelegate: |
| 67 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE; |
| 68 virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE; |
| 69 virtual void DispatchEvent(ui::Event* event) OVERRIDE; |
| 70 virtual void OnCloseRequest() OVERRIDE; |
| 71 virtual void OnClosed() OVERRIDE; |
| 72 virtual void OnWindowStateChanged(ui::PlatformWindowState new_state) OVERRIDE; |
| 73 virtual void OnLostCapture() OVERRIDE; |
| 74 |
64 protected: | 75 protected: |
65 // Called when X Configure Notify event is recevied. | 76 // Called when X Configure Notify event is recevied. |
66 virtual void OnConfigureNotify(); | 77 virtual void OnConfigureNotify(); |
67 | 78 |
68 // Translates the native mouse location into screen coordinates and and | 79 // Translates the native mouse location into screen coordinates and and |
69 // dispatches the event via WindowEventDispatcher. | 80 // dispatches the event via WindowEventDispatcher. |
70 virtual void TranslateAndDispatchLocatedEvent(ui::LocatedEvent* event); | 81 virtual void TranslateAndDispatchLocatedEvent(ui::LocatedEvent* event); |
71 | 82 |
72 ::Window x_root_window() { return x_root_window_; } | 83 ::Window x_root_window() { return x_root_window_; } |
73 XDisplay* xdisplay() { return xdisplay_; } | 84 XDisplay* xdisplay() { return xdisplay_; } |
(...skipping 26 matching lines...) Expand all Loading... |
100 gfx::NativeCursor current_cursor_; | 111 gfx::NativeCursor current_cursor_; |
101 | 112 |
102 // Is the window mapped to the screen? | 113 // Is the window mapped to the screen? |
103 bool window_mapped_; | 114 bool window_mapped_; |
104 | 115 |
105 // The bounds of |xwindow_|. | 116 // The bounds of |xwindow_|. |
106 gfx::Rect bounds_; | 117 gfx::Rect bounds_; |
107 | 118 |
108 ui::X11AtomCache atom_cache_; | 119 ui::X11AtomCache atom_cache_; |
109 | 120 |
| 121 scoped_ptr<ui::PlatformWindow> platform_window_; |
| 122 |
110 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostX11); | 123 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostX11); |
111 }; | 124 }; |
112 | 125 |
113 namespace test { | 126 namespace test { |
114 | 127 |
115 // Set the default value of the override redirect flag used to | 128 // Set the default value of the override redirect flag used to |
116 // create a X window for WindowTreeHostX11. | 129 // create a X window for WindowTreeHostX11. |
117 AURA_EXPORT void SetUseOverrideRedirectWindowByDefault(bool override_redirect); | 130 AURA_EXPORT void SetUseOverrideRedirectWindowByDefault(bool override_redirect); |
118 | 131 |
119 } // namespace test | 132 } // namespace test |
120 } // namespace aura | 133 } // namespace aura |
121 | 134 |
122 #endif // UI_AURA_WINDOW_TREE_HOST_X11_H_ | 135 #endif // UI_AURA_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |