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

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

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

Powered by Google App Engine
This is Rietveld 408576698