| 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/root_window_host_linux.h" | 5 #include "ui/aura/root_window_host_linux.h" |
| 6 | 6 |
| 7 #include <X11/cursorfont.h> | 7 #include <X11/cursorfont.h> |
| 8 #include <X11/extensions/Xfixes.h> | 8 #include <X11/extensions/Xfixes.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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 | 325 |
| 326 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { | 326 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { |
| 327 } | 327 } |
| 328 | 328 |
| 329 DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate); | 329 DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate); |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 } // namespace internal | 332 } // namespace internal |
| 333 | 333 |
| 334 RootWindowHostLinux::RootWindowHostLinux(RootWindowHostDelegate* delegate, | 334 RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds) |
| 335 const gfx::Rect& bounds) | 335 : delegate_(NULL), |
| 336 : delegate_(delegate), | |
| 337 xdisplay_(base::MessagePumpAuraX11::GetDefaultXDisplay()), | 336 xdisplay_(base::MessagePumpAuraX11::GetDefaultXDisplay()), |
| 338 xwindow_(0), | 337 xwindow_(0), |
| 339 x_root_window_(DefaultRootWindow(xdisplay_)), | 338 x_root_window_(DefaultRootWindow(xdisplay_)), |
| 340 current_cursor_(ui::kCursorNull), | 339 current_cursor_(ui::kCursorNull), |
| 341 window_mapped_(false), | 340 window_mapped_(false), |
| 342 cursor_shown_(true), | 341 cursor_shown_(true), |
| 343 bounds_(bounds), | 342 bounds_(bounds), |
| 344 focus_when_shown_(false), | 343 focus_when_shown_(false), |
| 345 pointer_barriers_(NULL), | 344 pointer_barriers_(NULL), |
| 346 touch_calibrate_(new internal::TouchEventCalibrate), | 345 touch_calibrate_(new internal::TouchEventCalibrate), |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 break; | 690 break; |
| 692 default: | 691 default: |
| 693 NOTREACHED(); | 692 NOTREACHED(); |
| 694 } | 693 } |
| 695 | 694 |
| 696 // If we coalesced an event we need to free its cookie. | 695 // If we coalesced an event we need to free its cookie. |
| 697 if (num_coalesced > 0) | 696 if (num_coalesced > 0) |
| 698 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); | 697 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); |
| 699 } | 698 } |
| 700 | 699 |
| 700 void RootWindowHostLinux::SetDelegate(RootWindowHostDelegate* delegate) { |
| 701 delegate_ = delegate; |
| 702 } |
| 703 |
| 701 RootWindow* RootWindowHostLinux::GetRootWindow() { | 704 RootWindow* RootWindowHostLinux::GetRootWindow() { |
| 702 return delegate_->AsRootWindow(); | 705 return delegate_->AsRootWindow(); |
| 703 } | 706 } |
| 704 | 707 |
| 705 gfx::AcceleratedWidget RootWindowHostLinux::GetAcceleratedWidget() { | 708 gfx::AcceleratedWidget RootWindowHostLinux::GetAcceleratedWidget() { |
| 706 return xwindow_; | 709 return xwindow_; |
| 707 } | 710 } |
| 708 | 711 |
| 709 void RootWindowHostLinux::Show() { | 712 void RootWindowHostLinux::Show() { |
| 710 if (!window_mapped_) { | 713 if (!window_mapped_) { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 // |delegate_|'s OnHoustMouseEvent expects native coordinates relative to | 1007 // |delegate_|'s OnHoustMouseEvent expects native coordinates relative to |
| 1005 // root. | 1008 // root. |
| 1006 location = ui::ConvertPointToPixel(root->layer(), location); | 1009 location = ui::ConvertPointToPixel(root->layer(), location); |
| 1007 event->set_location(location); | 1010 event->set_location(location); |
| 1008 event->set_root_location(location); | 1011 event->set_root_location(location); |
| 1009 } | 1012 } |
| 1010 delegate_->OnHostMouseEvent(event); | 1013 delegate_->OnHostMouseEvent(event); |
| 1011 } | 1014 } |
| 1012 | 1015 |
| 1013 // static | 1016 // static |
| 1014 RootWindowHost* RootWindowHost::Create(RootWindowHostDelegate* delegate, | 1017 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { |
| 1015 const gfx::Rect& bounds) { | 1018 return new RootWindowHostLinux(bounds); |
| 1016 return new RootWindowHostLinux(delegate, bounds); | |
| 1017 } | 1019 } |
| 1018 | 1020 |
| 1019 // static | 1021 // static |
| 1020 RootWindowHost* RootWindowHost::GetForAcceleratedWidget( | 1022 RootWindowHost* RootWindowHost::GetForAcceleratedWidget( |
| 1021 gfx::AcceleratedWidget accelerated_widget) { | 1023 gfx::AcceleratedWidget accelerated_widget) { |
| 1022 return reinterpret_cast<RootWindowHost*>( | 1024 return reinterpret_cast<RootWindowHost*>( |
| 1023 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); | 1025 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); |
| 1024 } | 1026 } |
| 1025 | 1027 |
| 1026 // static | 1028 // static |
| 1027 gfx::Size RootWindowHost::GetNativeScreenSize() { | 1029 gfx::Size RootWindowHost::GetNativeScreenSize() { |
| 1028 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 1030 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| 1029 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 1031 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
| 1030 } | 1032 } |
| 1031 | 1033 |
| 1032 } // namespace aura | 1034 } // namespace aura |
| OLD | NEW |