| 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/base/x/x11_util.h" | |
| 11 #include "ui/base/x/x11_window_event_manager.h" | 10 #include "ui/base/x/x11_window_event_manager.h" |
| 12 #include "ui/events/platform/platform_event_source.h" | 11 #include "ui/events/platform/platform_event_source.h" |
| 13 #include "ui/events/platform/scoped_event_dispatcher.h" | 12 #include "ui/events/platform/scoped_event_dispatcher.h" |
| 13 #include "ui/gfx/x/x11_atom_cache.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 X11PropertyChangeWaiter::X11PropertyChangeWaiter(XID window, | 17 X11PropertyChangeWaiter::X11PropertyChangeWaiter(XID window, |
| 18 const char* property) | 18 const char* property) |
| 19 : x_window_(window), property_(property), wait_(true) { | 19 : x_window_(window), property_(property), wait_(true) { |
| 20 // Ensure that we are listening to PropertyNotify events for |window|. This | 20 // Ensure that we are listening to PropertyNotify events for |window|. This |
| 21 // is not the case for windows which were not created by | 21 // is not the case for windows which were not created by |
| 22 // DesktopWindowTreeHostX11. | 22 // DesktopWindowTreeHostX11. |
| 23 x_window_events_.reset( | 23 x_window_events_.reset( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 | 51 |
| 52 bool X11PropertyChangeWaiter::CanDispatchEvent(const ui::PlatformEvent& event) { | 52 bool X11PropertyChangeWaiter::CanDispatchEvent(const ui::PlatformEvent& event) { |
| 53 NOTREACHED(); | 53 NOTREACHED(); |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 | 56 |
| 57 uint32_t X11PropertyChangeWaiter::DispatchEvent( | 57 uint32_t X11PropertyChangeWaiter::DispatchEvent( |
| 58 const ui::PlatformEvent& event) { | 58 const ui::PlatformEvent& event) { |
| 59 if (!wait_ || event->type != PropertyNotify || | 59 if (!wait_ || event->type != PropertyNotify || |
| 60 event->xproperty.window != x_window_ || | 60 event->xproperty.window != x_window_ || |
| 61 event->xproperty.atom != ui::GetAtom(property_) || | 61 event->xproperty.atom != gfx::GetAtom(property_) || |
| 62 ShouldKeepOnWaiting(event)) { | 62 ShouldKeepOnWaiting(event)) { |
| 63 return ui::POST_DISPATCH_PERFORM_DEFAULT; | 63 return ui::POST_DISPATCH_PERFORM_DEFAULT; |
| 64 } | 64 } |
| 65 | 65 |
| 66 wait_ = false; | 66 wait_ = false; |
| 67 if (!quit_closure_.is_null()) | 67 if (!quit_closure_.is_null()) |
| 68 quit_closure_.Run(); | 68 quit_closure_.Run(); |
| 69 return ui::POST_DISPATCH_PERFORM_DEFAULT; | 69 return ui::POST_DISPATCH_PERFORM_DEFAULT; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace views | 72 } // namespace views |
| OLD | NEW |