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

Side by Side Diff: ui/aura/window_tree_host_x11.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
« no previous file with comments | « ui/aura/window_tree_host_win.cc ('k') | ui/aura/window_tree_host_x11.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) 2012 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_AURA_WINDOW_TREE_HOST_X11_H_
6 #define UI_AURA_WINDOW_TREE_HOST_X11_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/aura_export.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"
13 #include "ui/gfx/insets.h"
14 #include "ui/gfx/rect.h"
15 #include "ui/gfx/x/x11_atom_cache.h"
16
17 // X forward decls to avoid including Xlib.h in a header file.
18 typedef struct _XDisplay XDisplay;
19 typedef unsigned long XID;
20 typedef XID Window;
21
22 namespace ui {
23 class MouseEvent;
24 }
25
26 namespace aura {
27
28 namespace internal {
29 class TouchEventCalibrate;
30 }
31
32 class AURA_EXPORT WindowTreeHostX11 : public WindowTreeHost,
33 public ui::EventSource,
34 public ui::PlatformEventDispatcher {
35
36 public:
37 explicit WindowTreeHostX11(const gfx::Rect& bounds);
38 virtual ~WindowTreeHostX11();
39
40 // ui::PlatformEventDispatcher:
41 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override;
42 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override;
43
44 // WindowTreeHost:
45 virtual ui::EventSource* GetEventSource() override;
46 virtual gfx::AcceleratedWidget GetAcceleratedWidget() override;
47 virtual void Show() override;
48 virtual void Hide() override;
49 virtual gfx::Rect GetBounds() const override;
50 virtual void SetBounds(const gfx::Rect& bounds) override;
51 virtual gfx::Point GetLocationOnNativeScreen() const override;
52 virtual void SetCapture() override;
53 virtual void ReleaseCapture() override;
54 virtual void PostNativeEvent(const base::NativeEvent& event) override;
55 virtual void SetCursorNative(gfx::NativeCursor cursor_type) override;
56 virtual void MoveCursorToNative(const gfx::Point& location) override;
57 virtual void OnCursorVisibilityChangedNative(bool show) override;
58
59 // ui::EventSource overrides.
60 virtual ui::EventProcessor* GetEventProcessor() override;
61
62 protected:
63 // Called when X Configure Notify event is recevied.
64 virtual void OnConfigureNotify();
65
66 // Translates the native mouse location into screen coordinates and
67 // dispatches the event via WindowEventDispatcher.
68 virtual void TranslateAndDispatchLocatedEvent(ui::LocatedEvent* event);
69
70 ::Window x_root_window() { return x_root_window_; }
71 XDisplay* xdisplay() { return xdisplay_; }
72 const gfx::Rect bounds() const { return bounds_; }
73 ui::X11AtomCache* atom_cache() { return &atom_cache_; }
74
75 private:
76 // Dispatches XI2 events. Note that some events targetted for the X root
77 // window are dispatched to the aura root window (e.g. touch events after
78 // calibration).
79 void DispatchXI2Event(const base::NativeEvent& event);
80
81 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update
82 // |current_cursor_|.
83 void SetCursorInternal(gfx::NativeCursor cursor);
84
85 // The display and the native X window hosting the root window.
86 XDisplay* xdisplay_;
87 ::Window xwindow_;
88
89 // The native root window.
90 ::Window x_root_window_;
91
92 // Current Aura cursor.
93 gfx::NativeCursor current_cursor_;
94
95 // Is the window mapped to the screen?
96 bool window_mapped_;
97
98 // The bounds of |xwindow_|.
99 gfx::Rect bounds_;
100
101 scoped_ptr<internal::TouchEventCalibrate> touch_calibrate_;
102
103 ui::X11AtomCache atom_cache_;
104
105 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostX11);
106 };
107
108 namespace test {
109
110 // Set the default value of the override redirect flag used to
111 // create a X window for WindowTreeHostX11.
112 AURA_EXPORT void SetUseOverrideRedirectWindowByDefault(bool override_redirect);
113
114 } // namespace test
115 } // namespace aura
116
117 #endif // UI_AURA_WINDOW_TREE_HOST_X11_H_
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_win.cc ('k') | ui/aura/window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698