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/display/chromeos/x11/native_display_delegate_x11.h" | 5 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/extensions/dpms.h> | 9 #include <X11/extensions/dpms.h> |
10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 //////////////////////////////////////////////////////////////////////////////// | 103 //////////////////////////////////////////////////////////////////////////////// |
104 // NativeDisplayDelegateX11::MessagePumpObserverX11 | 104 // NativeDisplayDelegateX11::MessagePumpObserverX11 |
105 | 105 |
106 class NativeDisplayDelegateX11::MessagePumpObserverX11 | 106 class NativeDisplayDelegateX11::MessagePumpObserverX11 |
107 : public base::MessagePumpObserver { | 107 : public base::MessagePumpObserver { |
108 public: | 108 public: |
109 MessagePumpObserverX11(HelperDelegate* delegate); | 109 MessagePumpObserverX11(HelperDelegate* delegate); |
110 virtual ~MessagePumpObserverX11(); | 110 virtual ~MessagePumpObserverX11(); |
111 | 111 |
112 // base::MessagePumpObserver overrides: | 112 // base::MessagePumpObserver overrides: |
113 virtual base::EventStatus WillProcessEvent(const base::NativeEvent& event) | 113 virtual void WillProcessEvent(const base::NativeEvent& event) OVERRIDE; |
114 OVERRIDE; | |
115 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | 114 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
116 | 115 |
117 private: | 116 private: |
118 HelperDelegate* delegate_; // Not owned. | 117 HelperDelegate* delegate_; // Not owned. |
119 | 118 |
120 DISALLOW_COPY_AND_ASSIGN(MessagePumpObserverX11); | 119 DISALLOW_COPY_AND_ASSIGN(MessagePumpObserverX11); |
121 }; | 120 }; |
122 | 121 |
123 NativeDisplayDelegateX11::MessagePumpObserverX11::MessagePumpObserverX11( | 122 NativeDisplayDelegateX11::MessagePumpObserverX11::MessagePumpObserverX11( |
124 HelperDelegate* delegate) | 123 HelperDelegate* delegate) |
125 : delegate_(delegate) {} | 124 : delegate_(delegate) {} |
126 | 125 |
127 NativeDisplayDelegateX11::MessagePumpObserverX11::~MessagePumpObserverX11() {} | 126 NativeDisplayDelegateX11::MessagePumpObserverX11::~MessagePumpObserverX11() {} |
128 | 127 |
129 base::EventStatus | 128 void NativeDisplayDelegateX11::MessagePumpObserverX11::WillProcessEvent( |
130 NativeDisplayDelegateX11::MessagePumpObserverX11::WillProcessEvent( | |
131 const base::NativeEvent& event) { | 129 const base::NativeEvent& event) { |
132 // XI_HierarchyChanged events are special. There is no window associated with | 130 // XI_HierarchyChanged events are special. There is no window associated with |
133 // these events. So process them directly from here. | 131 // these events. So process them directly from here. |
134 if (event->type == GenericEvent && | 132 if (event->type == GenericEvent && |
135 event->xgeneric.evtype == XI_HierarchyChanged) { | 133 event->xgeneric.evtype == XI_HierarchyChanged) { |
136 VLOG(1) << "Received XI_HierarchyChanged event"; | 134 VLOG(1) << "Received XI_HierarchyChanged event"; |
137 // Defer configuring outputs to not stall event processing. | 135 // Defer configuring outputs to not stall event processing. |
138 // This also takes care of same event being received twice. | 136 // This also takes care of same event being received twice. |
139 delegate_->NotifyDisplayObservers(); | 137 delegate_->NotifyDisplayObservers(); |
140 } | 138 } |
141 | |
142 return base::EVENT_CONTINUE; | |
143 } | 139 } |
144 | 140 |
145 void NativeDisplayDelegateX11::MessagePumpObserverX11::DidProcessEvent( | 141 void NativeDisplayDelegateX11::MessagePumpObserverX11::DidProcessEvent( |
146 const base::NativeEvent& event) {} | 142 const base::NativeEvent& event) {} |
147 | 143 |
148 //////////////////////////////////////////////////////////////////////////////// | 144 //////////////////////////////////////////////////////////////////////////////// |
149 // NativeDisplayDelegateX11 implementation: | 145 // NativeDisplayDelegateX11 implementation: |
150 | 146 |
151 NativeDisplayDelegateX11::NativeDisplayDelegateX11() | 147 NativeDisplayDelegateX11::NativeDisplayDelegateX11() |
152 : display_(base::MessagePumpX11::GetDefaultXDisplay()), | 148 : display_(base::MessagePumpX11::GetDefaultXDisplay()), |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 639 |
644 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) { | 640 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) { |
645 observers_.AddObserver(observer); | 641 observers_.AddObserver(observer); |
646 } | 642 } |
647 | 643 |
648 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) { | 644 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) { |
649 observers_.RemoveObserver(observer); | 645 observers_.RemoveObserver(observer); |
650 } | 646 } |
651 | 647 |
652 } // namespace ui | 648 } // namespace ui |
OLD | NEW |