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/aura/window_tree_host_x11.h" | 5 #include "ui/aura/window_tree_host_x11.h" |
6 | 6 |
7 #include <strings.h> | 7 #include <strings.h> |
8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 int bottom_; | 231 int bottom_; |
232 | 232 |
233 DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate); | 233 DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate); |
234 }; | 234 }; |
235 | 235 |
236 } // namespace internal | 236 } // namespace internal |
237 | 237 |
238 //////////////////////////////////////////////////////////////////////////////// | 238 //////////////////////////////////////////////////////////////////////////////// |
239 // WindowTreeHostX11 | 239 // WindowTreeHostX11 |
240 | 240 |
241 WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds) | 241 WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds, |
| 242 ui::ContextFactory* context_factory) |
242 : xdisplay_(gfx::GetXDisplay()), | 243 : xdisplay_(gfx::GetXDisplay()), |
243 xwindow_(0), | 244 xwindow_(0), |
244 x_root_window_(DefaultRootWindow(xdisplay_)), | 245 x_root_window_(DefaultRootWindow(xdisplay_)), |
245 current_cursor_(ui::kCursorNull), | 246 current_cursor_(ui::kCursorNull), |
246 window_mapped_(false), | 247 window_mapped_(false), |
247 bounds_(bounds), | 248 bounds_(bounds), |
248 touch_calibrate_(new internal::TouchEventCalibrate), | 249 touch_calibrate_(new internal::TouchEventCalibrate), |
249 atom_cache_(xdisplay_, kAtomsToCache) { | 250 atom_cache_(xdisplay_, kAtomsToCache) { |
250 XSetWindowAttributes swa; | 251 XSetWindowAttributes swa; |
251 memset(&swa, 0, sizeof(swa)); | 252 memset(&swa, 0, sizeof(swa)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 XA_CARDINAL, | 301 XA_CARDINAL, |
301 32, | 302 32, |
302 PropModeReplace, | 303 PropModeReplace, |
303 reinterpret_cast<unsigned char*>(&pid), 1); | 304 reinterpret_cast<unsigned char*>(&pid), 1); |
304 | 305 |
305 // Allow subclasses to create and cache additional atoms. | 306 // Allow subclasses to create and cache additional atoms. |
306 atom_cache_.allow_uncached_atoms(); | 307 atom_cache_.allow_uncached_atoms(); |
307 | 308 |
308 XRRSelectInput(xdisplay_, x_root_window_, | 309 XRRSelectInput(xdisplay_, x_root_window_, |
309 RRScreenChangeNotifyMask | RROutputChangeNotifyMask); | 310 RRScreenChangeNotifyMask | RROutputChangeNotifyMask); |
310 CreateCompositor(GetAcceleratedWidget()); | 311 CreateCompositor(GetAcceleratedWidget(), context_factory); |
311 } | 312 } |
312 | 313 |
313 WindowTreeHostX11::~WindowTreeHostX11() { | 314 WindowTreeHostX11::~WindowTreeHostX11() { |
314 if (ui::PlatformEventSource::GetInstance()) | 315 if (ui::PlatformEventSource::GetInstance()) |
315 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 316 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
316 | 317 |
317 DestroyCompositor(); | 318 DestroyCompositor(); |
318 DestroyDispatcher(); | 319 DestroyDispatcher(); |
319 XDestroyWindow(xdisplay_, xwindow_); | 320 XDestroyWindow(xdisplay_, xwindow_); |
320 } | 321 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 } | 706 } |
706 | 707 |
707 void WindowTreeHostX11::OnConfigureNotify() {} | 708 void WindowTreeHostX11::OnConfigureNotify() {} |
708 | 709 |
709 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent( | 710 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent( |
710 ui::LocatedEvent* event) { | 711 ui::LocatedEvent* event) { |
711 SendEventToProcessor(event); | 712 SendEventToProcessor(event); |
712 } | 713 } |
713 | 714 |
714 // static | 715 // static |
715 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | 716 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds, |
716 return new WindowTreeHostX11(bounds); | 717 ui::ContextFactory* context_factory) { |
| 718 return new WindowTreeHostX11(bounds, context_factory); |
717 } | 719 } |
718 | 720 |
719 // static | 721 // static |
720 gfx::Size WindowTreeHost::GetNativeScreenSize() { | 722 gfx::Size WindowTreeHost::GetNativeScreenSize() { |
721 ::XDisplay* xdisplay = gfx::GetXDisplay(); | 723 ::XDisplay* xdisplay = gfx::GetXDisplay(); |
722 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 724 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
723 } | 725 } |
724 | 726 |
725 namespace test { | 727 namespace test { |
726 | 728 |
727 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 729 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
728 default_override_redirect = override_redirect; | 730 default_override_redirect = override_redirect; |
729 } | 731 } |
730 | 732 |
731 } // namespace test | 733 } // namespace test |
732 } // namespace aura | 734 } // namespace aura |
OLD | NEW |