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

Side by Side Diff: ui/views/test/x11_property_change_waiter.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 | « ui/platform_window/x11/x11_window_base.cc ('k') | ui/views/test/x11_property_change_waiter.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_ 5 #ifndef UI_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_
6 #define UI_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_ 6 #define UI_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "ui/events/platform/platform_event_dispatcher.h" 14 #include "ui/events/platform/platform_event_dispatcher.h"
15 #include "ui/events/platform/platform_event_types.h" 15 #include "ui/events/platform/platform_event_types.h"
16 #include "ui/gfx/x/x11_types.h" 16 #include "ui/gfx/x/x11_types.h"
17 17
18 namespace ui { 18 namespace ui {
19 class ScopedEventDispatcher; 19 class ScopedEventDispatcher;
20 class X11AtomCache; 20 class X11AtomCache;
21 class XScopedEventSelector;
21 } 22 }
22 23
23 namespace views { 24 namespace views {
24 25
25 // Blocks till the value of |property| on |window| changes. 26 // Blocks till the value of |property| on |window| changes.
26 class X11PropertyChangeWaiter : public ui::PlatformEventDispatcher { 27 class X11PropertyChangeWaiter : public ui::PlatformEventDispatcher {
27 public: 28 public:
28 X11PropertyChangeWaiter(XID window, const char* property); 29 X11PropertyChangeWaiter(XID window, const char* property);
29 ~X11PropertyChangeWaiter() override; 30 ~X11PropertyChangeWaiter() override;
30 31
31 // Blocks till the value of |property_| changes. 32 // Blocks till the value of |property_| changes.
32 virtual void Wait(); 33 virtual void Wait();
33 34
34 protected: 35 protected:
35 // Returns whether the run loop can exit. 36 // Returns whether the run loop can exit.
36 virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event); 37 virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event);
37 38
38 XID xwindow() const { 39 XID xwindow() const {
39 return x_window_; 40 return x_window_;
40 } 41 }
41 42
42 private: 43 private:
43 // ui::PlatformEventDispatcher: 44 // ui::PlatformEventDispatcher:
44 bool CanDispatchEvent(const ui::PlatformEvent& event) override; 45 bool CanDispatchEvent(const ui::PlatformEvent& event) override;
45 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; 46 uint32_t DispatchEvent(const ui::PlatformEvent& event) override;
46 47
47 XID x_window_; 48 XID x_window_;
48 const char* property_; 49 const char* property_;
49 50
51 std::unique_ptr<ui::XScopedEventSelector> x_window_events_;
52
50 // Whether Wait() should block. 53 // Whether Wait() should block.
51 bool wait_; 54 bool wait_;
52 55
53 // Ends the run loop. 56 // Ends the run loop.
54 base::Closure quit_closure_; 57 base::Closure quit_closure_;
55 58
56 // The event mask to be restored upon X11PropertyChangeWaiter's destruction.
57 long old_event_mask_;
58
59 std::unique_ptr<ui::ScopedEventDispatcher> dispatcher_; 59 std::unique_ptr<ui::ScopedEventDispatcher> dispatcher_;
60 60
61 std::unique_ptr<ui::X11AtomCache> atom_cache_; 61 std::unique_ptr<ui::X11AtomCache> atom_cache_;
62 62
63 DISALLOW_COPY_AND_ASSIGN(X11PropertyChangeWaiter); 63 DISALLOW_COPY_AND_ASSIGN(X11PropertyChangeWaiter);
64 }; 64 };
65 65
66 } // namespace views 66 } // namespace views
67 67
68 #endif // UI_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_ 68 #endif // UI_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_
OLDNEW
« no previous file with comments | « ui/platform_window/x11/x11_window_base.cc ('k') | ui/views/test/x11_property_change_waiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698