| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const ui::PlatformEvent& event) { | 58 const ui::PlatformEvent& event) { |
| 59 // Stop waiting once we get a property change. | 59 // Stop waiting once we get a property change. |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool X11PropertyChangeWaiter::CanDispatchEvent(const ui::PlatformEvent& event) { | 63 bool X11PropertyChangeWaiter::CanDispatchEvent(const ui::PlatformEvent& event) { |
| 64 NOTREACHED(); | 64 NOTREACHED(); |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 uint32_t X11PropertyChangeWaiter::DispatchEvent( | 68 ui::PostDispatchAction X11PropertyChangeWaiter::DispatchEvent( |
| 69 const ui::PlatformEvent& event) { | 69 const ui::PlatformEvent& event) { |
| 70 if (!wait_ || | 70 if (!wait_ || |
| 71 event->type != PropertyNotify || | 71 event->type != PropertyNotify || |
| 72 event->xproperty.window != x_window_ || | 72 event->xproperty.window != x_window_ || |
| 73 event->xproperty.atom != atom_cache_->GetAtom(property_) || | 73 event->xproperty.atom != atom_cache_->GetAtom(property_) || |
| 74 ShouldKeepOnWaiting(event)) { | 74 ShouldKeepOnWaiting(event)) { |
| 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 |