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

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: move mouse to far away 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 22 matching lines...) Expand all
33 #include "ui/base/x/valuators.h" 33 #include "ui/base/x/valuators.h"
34 #include "ui/base/x/x11_util.h" 34 #include "ui/base/x/x11_util.h"
35 #include "ui/compositor/layer.h" 35 #include "ui/compositor/layer.h"
36 #include "ui/gfx/codec/png_codec.h" 36 #include "ui/gfx/codec/png_codec.h"
37 #include "ui/gfx/screen.h" 37 #include "ui/gfx/screen.h"
38 38
39 #if defined(OS_CHROMEOS) 39 #if defined(OS_CHROMEOS)
40 #include "base/chromeos/chromeos_version.h" 40 #include "base/chromeos/chromeos_version.h"
41 #endif 41 #endif
42 42
43 #include "base/debug/stack_trace.h"
oshima 2012/09/18 15:32:09 i'll remove this.
44
43 using std::max; 45 using std::max;
44 using std::min; 46 using std::min;
45 47
46 namespace aura { 48 namespace aura {
47 49
48 namespace { 50 namespace {
49 51
50 // Standard Linux mouse buttons for going back and forward. 52 // Standard Linux mouse buttons for going back and forward.
51 const int kBackMouseButton = 8; 53 const int kBackMouseButton = 8;
52 const int kForwardMouseButton = 9; 54 const int kForwardMouseButton = 9;
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 } 743 }
742 744
743 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { 745 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) {
744 // Even if the host window's size doesn't change, aura's root window 746 // 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. 747 // size, which is in DIP, changes when the scale changes.
746 float current_scale = delegate_->GetDeviceScaleFactor(); 748 float current_scale = delegate_->GetDeviceScaleFactor();
747 float new_scale = gfx::Screen::GetDisplayNearestWindow( 749 float new_scale = gfx::Screen::GetDisplayNearestWindow(
748 delegate_->AsRootWindow()).device_scale_factor(); 750 delegate_->AsRootWindow()).device_scale_factor();
749 bool size_changed = bounds_.size() != bounds.size() || 751 bool size_changed = bounds_.size() != bounds.size() ||
750 current_scale != new_scale; 752 current_scale != new_scale;
753 XWindowChanges changes = {0};
754 unsigned value_mask = 0;
751 755
752 if (bounds.size() != bounds_.size()) 756 if (bounds.size() != bounds_.size()) {
753 XResizeWindow(xdisplay_, xwindow_, bounds.width(), bounds.height()); 757 changes.width = bounds.width();
758 changes.height = bounds.height();
759 value_mask = CWHeight | CWWidth;
760 }
754 761
755 if (bounds.origin() != bounds_.origin()) 762 if (bounds.origin() != bounds_.origin()) {
756 XMoveWindow(xdisplay_, xwindow_, bounds.x(), bounds.y()); 763 changes.x = bounds.x();
764 changes.y = bounds.y();
765 value_mask |= CWX | CWY;
766 }
767 if (value_mask)
768 XConfigureWindow(xdisplay_, xwindow_, value_mask, &changes);
oshima 2012/09/18 15:32:09 This fixed two configure event issue.
757 769
758 // Assume that the resize will go through as requested, which should be the 770 // 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 771 // 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 772 // 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 773 // (possibly synthetic) ConfigureNotify about the actual size and correct
762 // |bounds_| later. 774 // |bounds_| later.
763 bounds_ = bounds; 775 bounds_ = bounds;
764 if (size_changed) { 776 if (size_changed) {
765 delegate_->OnHostResized(bounds.size()); 777 delegate_->OnHostResized(bounds.size());
766 } else { 778 } else {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); 1001 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey));
990 } 1002 }
991 1003
992 // static 1004 // static
993 gfx::Size RootWindowHost::GetNativeScreenSize() { 1005 gfx::Size RootWindowHost::GetNativeScreenSize() {
994 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); 1006 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay();
995 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 1007 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
996 } 1008 }
997 1009
998 } // namespace aura 1010 } // 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