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" | |
12 #include "ui/events/platform/platform_event_dispatcher.h" | 11 #include "ui/events/platform/platform_event_dispatcher.h" |
13 #include "ui/gfx/geometry/insets.h" | 12 #include "ui/gfx/geometry/insets.h" |
14 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/gfx/x/x11_atom_cache.h" | 14 #include "ui/gfx/x/x11_atom_cache.h" |
16 | 15 |
17 // X forward decls to avoid including Xlib.h in a header file. | 16 // X forward decls to avoid including Xlib.h in a header file. |
18 typedef struct _XDisplay XDisplay; | 17 typedef struct _XDisplay XDisplay; |
19 typedef unsigned long XID; | 18 typedef unsigned long XID; |
20 typedef XID Window; | 19 typedef XID Window; |
21 | 20 |
22 namespace ui { | 21 namespace ui { |
23 class MouseEvent; | 22 class MouseEvent; |
24 } | 23 } |
25 | 24 |
26 namespace aura { | 25 namespace aura { |
27 | 26 |
28 namespace internal { | 27 namespace internal { |
29 class TouchEventCalibrate; | 28 class TouchEventCalibrate; |
30 } | 29 } |
31 | 30 |
32 class AURA_EXPORT WindowTreeHostX11 : public WindowTreeHost, | 31 class AURA_EXPORT WindowTreeHostX11 : public WindowTreeHost, |
33 public ui::EventSource, | |
34 public ui::PlatformEventDispatcher { | 32 public ui::PlatformEventDispatcher { |
35 | 33 |
36 public: | 34 public: |
37 explicit WindowTreeHostX11(const gfx::Rect& bounds); | 35 explicit WindowTreeHostX11(const gfx::Rect& bounds); |
38 ~WindowTreeHostX11() override; | 36 ~WindowTreeHostX11() override; |
39 | 37 |
40 // ui::PlatformEventDispatcher: | 38 // ui::PlatformEventDispatcher: |
41 bool CanDispatchEvent(const ui::PlatformEvent& event) override; | 39 bool CanDispatchEvent(const ui::PlatformEvent& event) override; |
42 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; | 40 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; |
43 | 41 |
44 // WindowTreeHost: | 42 // WindowTreeHost: |
45 ui::EventSource* GetEventSource() override; | 43 ui::EventSource* GetEventSource() override; |
46 gfx::AcceleratedWidget GetAcceleratedWidget() override; | 44 gfx::AcceleratedWidget GetAcceleratedWidget() override; |
47 void ShowImpl() override; | 45 void ShowImpl() override; |
48 void HideImpl() override; | 46 void HideImpl() override; |
49 gfx::Rect GetBounds() const override; | 47 gfx::Rect GetBounds() const override; |
50 void SetBounds(const gfx::Rect& bounds) override; | 48 void SetBounds(const gfx::Rect& bounds) override; |
51 gfx::Point GetLocationOnNativeScreen() const override; | 49 gfx::Point GetLocationOnNativeScreen() const override; |
52 void SetCapture() override; | 50 void SetCapture() override; |
53 void ReleaseCapture() override; | 51 void ReleaseCapture() override; |
54 void SetCursorNative(gfx::NativeCursor cursor_type) override; | 52 void SetCursorNative(gfx::NativeCursor cursor_type) override; |
55 void MoveCursorToNative(const gfx::Point& location) override; | 53 void MoveCursorToNative(const gfx::Point& location) override; |
56 void OnCursorVisibilityChangedNative(bool show) override; | 54 void OnCursorVisibilityChangedNative(bool show) override; |
57 | 55 |
58 // ui::EventSource overrides. | |
59 ui::EventProcessor* GetEventProcessor() override; | |
60 | |
61 protected: | 56 protected: |
62 // Called when X Configure Notify event is recevied. | 57 // Called when X Configure Notify event is recevied. |
63 virtual void OnConfigureNotify(); | 58 virtual void OnConfigureNotify(); |
64 | 59 |
65 // Translates the native mouse location into screen coordinates and | 60 // Translates the native mouse location into screen coordinates and |
66 // dispatches the event via WindowEventDispatcher. | 61 // dispatches the event via WindowEventDispatcher. |
67 virtual void TranslateAndDispatchLocatedEvent(ui::LocatedEvent* event); | 62 virtual void TranslateAndDispatchLocatedEvent(ui::LocatedEvent* event); |
68 | 63 |
69 ::Window x_root_window() { return x_root_window_; } | 64 ::Window x_root_window() { return x_root_window_; } |
70 XDisplay* xdisplay() { return xdisplay_; } | 65 XDisplay* xdisplay() { return xdisplay_; } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 namespace test { | 102 namespace test { |
108 | 103 |
109 // Set the default value of the override redirect flag used to | 104 // Set the default value of the override redirect flag used to |
110 // create a X window for WindowTreeHostX11. | 105 // create a X window for WindowTreeHostX11. |
111 AURA_EXPORT void SetUseOverrideRedirectWindowByDefault(bool override_redirect); | 106 AURA_EXPORT void SetUseOverrideRedirectWindowByDefault(bool override_redirect); |
112 | 107 |
113 } // namespace test | 108 } // namespace test |
114 } // namespace aura | 109 } // namespace aura |
115 | 110 |
116 #endif // UI_AURA_WINDOW_TREE_HOST_X11_H_ | 111 #endif // UI_AURA_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |