OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/widget/desktop_aura/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
6 | 6 |
7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 window_parent_(NULL), | 158 window_parent_(NULL), |
159 custom_window_shape_(false), | 159 custom_window_shape_(false), |
160 urgency_hint_set_(false), | 160 urgency_hint_set_(false), |
161 has_pointer_grab_(false), | 161 has_pointer_grab_(false), |
162 activatable_(true), | 162 activatable_(true), |
163 has_pointer_(false), | 163 has_pointer_(false), |
164 has_window_focus_(false), | 164 has_window_focus_(false), |
165 has_pointer_focus_(false), | 165 has_pointer_focus_(false), |
166 modal_dialog_counter_(0), | 166 modal_dialog_counter_(0), |
167 close_widget_factory_(this), | 167 close_widget_factory_(this), |
168 weak_factory_(this) {} | 168 weak_factory_(this) { |
| 169 display::Screen::GetScreen()->AddObserver(this); |
| 170 } |
169 | 171 |
170 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { | 172 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { |
171 window()->ClearProperty(kHostForRootWindow); | 173 window()->ClearProperty(kHostForRootWindow); |
172 wm::SetWindowMoveClient(window(), NULL); | 174 wm::SetWindowMoveClient(window(), NULL); |
173 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); | 175 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); |
174 DestroyDispatcher(); | 176 DestroyDispatcher(); |
| 177 display::Screen::GetScreen()->RemoveObserver(this); |
175 } | 178 } |
176 | 179 |
177 // static | 180 // static |
178 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { | 181 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { |
179 aura::WindowTreeHost* host = | 182 aura::WindowTreeHost* host = |
180 aura::WindowTreeHost::GetForAcceleratedWidget(xid); | 183 aura::WindowTreeHost::GetForAcceleratedWidget(xid); |
181 return host ? host->window()->GetProperty(kViewsWindowForRootWindow) : NULL; | 184 return host ? host->window()->GetProperty(kViewsWindowForRootWindow) : NULL; |
182 } | 185 } |
183 | 186 |
184 // static | 187 // static |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 bounds_in_pixels_.x() + location_in_pixels.x(), | 1286 bounds_in_pixels_.x() + location_in_pixels.x(), |
1284 bounds_in_pixels_.y() + location_in_pixels.y()); | 1287 bounds_in_pixels_.y() + location_in_pixels.y()); |
1285 } | 1288 } |
1286 | 1289 |
1287 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { | 1290 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { |
1288 // TODO(erg): Conditional on us enabling touch on desktop linux builds, do | 1291 // TODO(erg): Conditional on us enabling touch on desktop linux builds, do |
1289 // the same tap-to-click disabling here that chromeos does. | 1292 // the same tap-to-click disabling here that chromeos does. |
1290 } | 1293 } |
1291 | 1294 |
1292 //////////////////////////////////////////////////////////////////////////////// | 1295 //////////////////////////////////////////////////////////////////////////////// |
| 1296 // DesktopWindowTreeHostX11, display::DisplayObserver implementation: |
| 1297 |
| 1298 void DesktopWindowTreeHostX11::OnDisplayAdded( |
| 1299 const display::Display& new_display) {} |
| 1300 |
| 1301 void DesktopWindowTreeHostX11::OnDisplayRemoved( |
| 1302 const display::Display& old_display) {} |
| 1303 |
| 1304 void DesktopWindowTreeHostX11::OnDisplayMetricsChanged( |
| 1305 const display::Display& display, |
| 1306 uint32_t changed_metrics) { |
| 1307 if ((changed_metrics & DISPLAY_METRIC_DEVICE_SCALE_FACTOR) && |
| 1308 display::Screen::GetScreen()->GetDisplayNearestWindow(window()).id() == |
| 1309 display.id()) { |
| 1310 OnHostResizedInPixels(bounds_in_pixels_.size()); |
| 1311 ResetWindowRegion(); |
| 1312 } |
| 1313 } |
| 1314 |
| 1315 //////////////////////////////////////////////////////////////////////////////// |
1293 // DesktopWindowTreeHostX11, private: | 1316 // DesktopWindowTreeHostX11, private: |
1294 | 1317 |
1295 void DesktopWindowTreeHostX11::InitX11Window( | 1318 void DesktopWindowTreeHostX11::InitX11Window( |
1296 const Widget::InitParams& params) { | 1319 const Widget::InitParams& params) { |
1297 unsigned long attribute_mask = CWBackPixmap | CWBitGravity; | 1320 unsigned long attribute_mask = CWBackPixmap | CWBitGravity; |
1298 XSetWindowAttributes swa; | 1321 XSetWindowAttributes swa; |
1299 memset(&swa, 0, sizeof(swa)); | 1322 memset(&swa, 0, sizeof(swa)); |
1300 swa.background_pixmap = None; | 1323 swa.background_pixmap = None; |
1301 swa.bit_gravity = NorthWestGravity; | 1324 swa.bit_gravity = NorthWestGravity; |
1302 | 1325 |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2280 | 2303 |
2281 // static | 2304 // static |
2282 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2305 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
2283 internal::NativeWidgetDelegate* native_widget_delegate, | 2306 internal::NativeWidgetDelegate* native_widget_delegate, |
2284 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2307 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
2285 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2308 return new DesktopWindowTreeHostX11(native_widget_delegate, |
2286 desktop_native_widget_aura); | 2309 desktop_native_widget_aura); |
2287 } | 2310 } |
2288 | 2311 |
2289 } // namespace views | 2312 } // namespace views |
OLD | NEW |