Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: ui/aura/root_window_host_linux.cc

Issue 10905288: Switch primary display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/display_manager.h ('k') | ui/aura/single_display_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 } 741 }
742 742
743 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { 743 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) {
744 // Even if the host window's size doesn't change, aura's root window 744 // Even if the host window's size doesn't change, aura's root window
745 // size, which is in DIP, changes when the scale changes. 745 // size, which is in DIP, changes when the scale changes.
746 float current_scale = delegate_->GetDeviceScaleFactor(); 746 float current_scale = delegate_->GetDeviceScaleFactor();
747 float new_scale = gfx::Screen::GetDisplayNearestWindow( 747 float new_scale = gfx::Screen::GetDisplayNearestWindow(
748 delegate_->AsRootWindow()).device_scale_factor(); 748 delegate_->AsRootWindow()).device_scale_factor();
749 bool size_changed = bounds_.size() != bounds.size() || 749 bool size_changed = bounds_.size() != bounds.size() ||
750 current_scale != new_scale; 750 current_scale != new_scale;
751 XWindowChanges changes = {0};
752 unsigned value_mask = 0;
751 753
752 if (bounds.size() != bounds_.size()) 754 if (bounds.size() != bounds_.size()) {
753 XResizeWindow(xdisplay_, xwindow_, bounds.width(), bounds.height()); 755 changes.width = bounds.width();
756 changes.height = bounds.height();
757 value_mask = CWHeight | CWWidth;
758 }
754 759
755 if (bounds.origin() != bounds_.origin()) 760 if (bounds.origin() != bounds_.origin()) {
756 XMoveWindow(xdisplay_, xwindow_, bounds.x(), bounds.y()); 761 changes.x = bounds.x();
762 changes.y = bounds.y();
763 value_mask |= CWX | CWY;
764 }
765 if (value_mask)
766 XConfigureWindow(xdisplay_, xwindow_, value_mask, &changes);
757 767
758 // Assume that the resize will go through as requested, which should be the 768 // Assume that the resize will go through as requested, which should be the
759 // case if we're running without a window manager. If there's a window 769 // case if we're running without a window manager. If there's a window
760 // manager, it can modify or ignore the request, but (per ICCCM) we'll get a 770 // manager, it can modify or ignore the request, but (per ICCCM) we'll get a
761 // (possibly synthetic) ConfigureNotify about the actual size and correct 771 // (possibly synthetic) ConfigureNotify about the actual size and correct
762 // |bounds_| later. 772 // |bounds_| later.
763 bounds_ = bounds; 773 bounds_ = bounds;
764 if (size_changed) { 774 if (size_changed) {
765 delegate_->OnHostResized(bounds.size()); 775 delegate_->OnHostResized(bounds.size());
766 } else { 776 } else {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); 999 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey));
990 } 1000 }
991 1001
992 // static 1002 // static
993 gfx::Size RootWindowHost::GetNativeScreenSize() { 1003 gfx::Size RootWindowHost::GetNativeScreenSize() {
994 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); 1004 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay();
995 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 1005 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
996 } 1006 }
997 1007
998 } // namespace aura 1008 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/display_manager.h ('k') | ui/aura/single_display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698