| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <X11/extensions/shape.h> | 8 #include <X11/extensions/shape.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomsToCache)); | 61 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomsToCache)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 ~WMStateWaiter() override {} | 64 ~WMStateWaiter() override {} |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 // X11PropertyChangeWaiter: | 67 // X11PropertyChangeWaiter: |
| 68 bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { | 68 bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { |
| 69 std::vector<Atom> hints; | 69 std::vector<Atom> hints; |
| 70 if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &hints)) { | 70 if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &hints)) { |
| 71 std::vector<Atom>::iterator it = std::find( | 71 auto it = std::find(hints.cbegin(), hints.cend(), |
| 72 hints.begin(), | 72 atom_cache_->GetAtom(hint_)); |
| 73 hints.end(), | 73 bool hint_set = (it != hints.cend()); |
| 74 atom_cache_->GetAtom(hint_)); | |
| 75 bool hint_set = (it != hints.end()); | |
| 76 return hint_set != wait_till_set_; | 74 return hint_set != wait_till_set_; |
| 77 } | 75 } |
| 78 return true; | 76 return true; |
| 79 } | 77 } |
| 80 | 78 |
| 81 scoped_ptr<ui::X11AtomCache> atom_cache_; | 79 scoped_ptr<ui::X11AtomCache> atom_cache_; |
| 82 | 80 |
| 83 // The name of the hint to wait to get set or unset. | 81 // The name of the hint to wait to get set or unset. |
| 84 const char* hint_; | 82 const char* hint_; |
| 85 | 83 |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 EXPECT_EQ(ui::ET_MOUSEWHEEL, second_recorder.mouse_events()[0].type()); | 642 EXPECT_EQ(ui::ET_MOUSEWHEEL, second_recorder.mouse_events()[0].type()); |
| 645 EXPECT_EQ(gfx::Point(-25, -25).ToString(), | 643 EXPECT_EQ(gfx::Point(-25, -25).ToString(), |
| 646 second_recorder.mouse_events()[0].location().ToString()); | 644 second_recorder.mouse_events()[0].location().ToString()); |
| 647 | 645 |
| 648 PretendCapture(nullptr); | 646 PretendCapture(nullptr); |
| 649 first.GetNativeWindow()->RemovePreTargetHandler(&first_recorder); | 647 first.GetNativeWindow()->RemovePreTargetHandler(&first_recorder); |
| 650 second.GetNativeWindow()->RemovePreTargetHandler(&second_recorder); | 648 second.GetNativeWindow()->RemovePreTargetHandler(&second_recorder); |
| 651 } | 649 } |
| 652 | 650 |
| 653 } // namespace views | 651 } // namespace views |
| OLD | NEW |