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/platform_window/x11/x11_window.h" | 5 #include "ui/platform_window/x11/x11_window.h" |
6 | 6 |
7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/Xutil.h> | 10 #include <X11/Xutil.h> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // will ignore toplevel XMoveWindow commands. | 193 // will ignore toplevel XMoveWindow commands. |
194 XSizeHints size_hints; | 194 XSizeHints size_hints; |
195 size_hints.flags = PPosition | PWinGravity; | 195 size_hints.flags = PPosition | PWinGravity; |
196 size_hints.x = requested_bounds_.x(); | 196 size_hints.x = requested_bounds_.x(); |
197 size_hints.y = requested_bounds_.y(); | 197 size_hints.y = requested_bounds_.y(); |
198 // Set StaticGravity so that the window position is not affected by the | 198 // Set StaticGravity so that the window position is not affected by the |
199 // frame width when running with window manager. | 199 // frame width when running with window manager. |
200 size_hints.win_gravity = StaticGravity; | 200 size_hints.win_gravity = StaticGravity; |
201 XSetWMNormalHints(xdisplay_, xwindow_, &size_hints); | 201 XSetWMNormalHints(xdisplay_, xwindow_, &size_hints); |
202 | 202 |
203 // TODO(sky): provide real scale factor. | |
204 delegate_->OnAcceleratedWidgetAvailable(xwindow_, 1.f); | |
205 | |
206 XMapWindow(xdisplay_, xwindow_); | 203 XMapWindow(xdisplay_, xwindow_); |
207 | 204 |
208 // We now block until our window is mapped. Some X11 APIs will crash and | 205 // We now block until our window is mapped. Some X11 APIs will crash and |
209 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is | 206 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is |
210 // asynchronous. | 207 // asynchronous. |
211 if (X11EventSource::GetInstance()) | 208 if (X11EventSource::GetInstance()) |
212 X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_); | 209 X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_); |
213 window_mapped_ = true; | 210 window_mapped_ = true; |
| 211 |
| 212 // TODO(sky): provide real scale factor. |
| 213 delegate_->OnAcceleratedWidgetAvailable(xwindow_, 1.f); |
214 } | 214 } |
215 | 215 |
216 void X11Window::Hide() { | 216 void X11Window::Hide() { |
217 if (!window_mapped_) | 217 if (!window_mapped_) |
218 return; | 218 return; |
219 XWithdrawWindow(xdisplay_, xwindow_, 0); | 219 XWithdrawWindow(xdisplay_, xwindow_, 0); |
220 window_mapped_ = false; | 220 window_mapped_ = false; |
221 } | 221 } |
222 | 222 |
223 void X11Window::Close() { | 223 void X11Window::Close() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 namespace test { | 374 namespace test { |
375 | 375 |
376 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 376 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
377 g_override_redirect = override_redirect; | 377 g_override_redirect = override_redirect; |
378 } | 378 } |
379 | 379 |
380 } // namespace test | 380 } // namespace test |
381 } // namespace ui | 381 } // namespace ui |
OLD | NEW |