OLD | NEW |
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 #include "ui/views/test/x11_property_change_waiter.h" | 5 #include "ui/views/test/x11_property_change_waiter.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 | 8 |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "ui/events/platform/platform_event_source.h" | 10 #include "ui/events/platform/platform_event_source.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 XGetWindowAttributes(display, x_window_, &attributes); | 28 XGetWindowAttributes(display, x_window_, &attributes); |
29 old_event_mask_ = attributes.your_event_mask; | 29 old_event_mask_ = attributes.your_event_mask; |
30 XSelectInput(display, x_window_, old_event_mask_ | PropertyChangeMask); | 30 XSelectInput(display, x_window_, old_event_mask_ | PropertyChangeMask); |
31 | 31 |
32 const char* kAtomsToCache[] = { property, NULL }; | 32 const char* kAtomsToCache[] = { property, NULL }; |
33 atom_cache_.reset(new ui::X11AtomCache(display, kAtomsToCache)); | 33 atom_cache_.reset(new ui::X11AtomCache(display, kAtomsToCache)); |
34 | 34 |
35 // Override the dispatcher so that we get events before | 35 // Override the dispatcher so that we get events before |
36 // DesktopWindowTreeHostX11 does. We must do this because | 36 // DesktopWindowTreeHostX11 does. We must do this because |
37 // DesktopWindowTreeHostX11 stops propagation. | 37 // DesktopWindowTreeHostX11 stops propagation. |
38 dispatcher_ = ui::PlatformEventSource::GetInstance()-> | 38 dispatcher_ = |
39 OverrideDispatcher(this).Pass(); | 39 ui::PlatformEventSource::GetInstance()->OverrideDispatcher(this); |
40 } | 40 } |
41 | 41 |
42 X11PropertyChangeWaiter::~X11PropertyChangeWaiter() { | 42 X11PropertyChangeWaiter::~X11PropertyChangeWaiter() { |
43 XSelectInput(gfx::GetXDisplay(), x_window_, old_event_mask_); | 43 XSelectInput(gfx::GetXDisplay(), x_window_, old_event_mask_); |
44 } | 44 } |
45 | 45 |
46 void X11PropertyChangeWaiter::Wait() { | 46 void X11PropertyChangeWaiter::Wait() { |
47 if (!wait_) | 47 if (!wait_) |
48 return; | 48 return; |
49 | 49 |
(...skipping 25 matching lines...) Expand all Loading... |
75 return ui::POST_DISPATCH_PERFORM_DEFAULT; | 75 return ui::POST_DISPATCH_PERFORM_DEFAULT; |
76 } | 76 } |
77 | 77 |
78 wait_ = false; | 78 wait_ = false; |
79 if (!quit_closure_.is_null()) | 79 if (!quit_closure_.is_null()) |
80 quit_closure_.Run(); | 80 quit_closure_.Run(); |
81 return ui::POST_DISPATCH_PERFORM_DEFAULT; | 81 return ui::POST_DISPATCH_PERFORM_DEFAULT; |
82 } | 82 } |
83 | 83 |
84 } // namespace views | 84 } // namespace views |
OLD | NEW |