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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 bool origin_changed = bounds_.origin() != bounds.origin(); | 484 bool origin_changed = bounds_.origin() != bounds.origin(); |
485 bounds_ = bounds; | 485 bounds_ = bounds; |
486 // Always update barrier and mouse location because |bounds_| might | 486 // Always update barrier and mouse location because |bounds_| might |
487 // have already been updated in |SetBounds|. | 487 // have already been updated in |SetBounds|. |
488 if (pointer_barriers_.get()) { | 488 if (pointer_barriers_.get()) { |
489 UnConfineCursor(); | 489 UnConfineCursor(); |
490 RootWindow* root = delegate_->AsRootWindow(); | 490 RootWindow* root = delegate_->AsRootWindow(); |
491 client::ScreenPositionClient* client = | 491 client::ScreenPositionClient* client = |
492 client::GetScreenPositionClient(root); | 492 client::GetScreenPositionClient(root); |
493 if (client) { | 493 if (client) { |
494 gfx::Point p = gfx::Screen::GetCursorScreenPoint(); | 494 gfx::Point p = gfx::Screen::GetScreenFor(root)-> |
| 495 GetCursorScreenPoint(); |
495 client->ConvertPointFromScreen(root, &p); | 496 client->ConvertPointFromScreen(root, &p); |
496 if (root->ContainsPoint(p)) { | 497 if (root->ContainsPoint(p)) { |
497 root->ConvertPointToNativeScreen(&p); | 498 root->ConvertPointToNativeScreen(&p); |
498 XWarpPointer( | 499 XWarpPointer( |
499 xdisplay_, None, x_root_window_, 0, 0, 0, 0, p.x(), p.y()); | 500 xdisplay_, None, x_root_window_, 0, 0, 0, 0, p.x(), p.y()); |
500 } | 501 } |
501 } | 502 } |
502 ConfineCursorToRootWindow(); | 503 ConfineCursorToRootWindow(); |
503 } | 504 } |
504 if (size_changed) | 505 if (size_changed) |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 } | 741 } |
741 | 742 |
742 gfx::Rect RootWindowHostLinux::GetBounds() const { | 743 gfx::Rect RootWindowHostLinux::GetBounds() const { |
743 return bounds_; | 744 return bounds_; |
744 } | 745 } |
745 | 746 |
746 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { | 747 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { |
747 // Even if the host window's size doesn't change, aura's root window | 748 // Even if the host window's size doesn't change, aura's root window |
748 // size, which is in DIP, changes when the scale changes. | 749 // size, which is in DIP, changes when the scale changes. |
749 float current_scale = delegate_->GetDeviceScaleFactor(); | 750 float current_scale = delegate_->GetDeviceScaleFactor(); |
750 float new_scale = gfx::Screen::GetDisplayNearestWindow( | 751 float new_scale = gfx::Screen::GetScreenFor(delegate_->AsRootWindow())-> |
751 delegate_->AsRootWindow()).device_scale_factor(); | 752 GetDisplayNearestWindow(delegate_->AsRootWindow()).device_scale_factor(); |
752 bool origin_changed = bounds_.origin() != bounds.origin(); | 753 bool origin_changed = bounds_.origin() != bounds.origin(); |
753 bool size_changed = bounds_.size() != bounds.size(); | 754 bool size_changed = bounds_.size() != bounds.size(); |
754 XWindowChanges changes = {0}; | 755 XWindowChanges changes = {0}; |
755 unsigned value_mask = 0; | 756 unsigned value_mask = 0; |
756 | 757 |
757 if (size_changed) { | 758 if (size_changed) { |
758 changes.width = bounds.width(); | 759 changes.width = bounds.width(); |
759 changes.height = bounds.height(); | 760 changes.height = bounds.height(); |
760 value_mask = CWHeight | CWWidth; | 761 value_mask = CWHeight | CWWidth; |
761 } | 762 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); | 1022 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); |
1022 } | 1023 } |
1023 | 1024 |
1024 // static | 1025 // static |
1025 gfx::Size RootWindowHost::GetNativeScreenSize() { | 1026 gfx::Size RootWindowHost::GetNativeScreenSize() { |
1026 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 1027 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
1027 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 1028 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
1028 } | 1029 } |
1029 | 1030 |
1030 } // namespace aura | 1031 } // namespace aura |
OLD | NEW |