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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc

Issue 11818065: OK, here's john's patch plus my sync stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Redisable PlatformAppBrowserTest.WebContentsHasFocus on aura Created 7 years, 10 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 | « chrome/test/base/chrome_test_launcher.cc ('k') | ui/views/widget/widget.cc » ('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/views/widget/desktop_aura/desktop_root_window_host_linux.h" 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_linux.h"
6 6
7 #include <X11/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 #include <X11/Xatom.h> 8 #include <X11/Xatom.h>
9 #include <X11/Xutil.h> 9 #include <X11/Xutil.h>
10 10
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return gfx::Rect(); 444 return gfx::Rect();
445 } 445 }
446 446
447 gfx::Rect DesktopRootWindowHostLinux::GetWorkAreaBoundsInScreen() const { 447 gfx::Rect DesktopRootWindowHostLinux::GetWorkAreaBoundsInScreen() const {
448 std::vector<int> value; 448 std::vector<int> value;
449 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) && 449 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) &&
450 value.size() >= 4) { 450 value.size() >= 4) {
451 return gfx::Rect(value[0], value[1], value[2], value[3]); 451 return gfx::Rect(value[0], value[1], value[2], value[3]);
452 } 452 }
453 453
454 // TODO(erg): As a fallback, we should return the bounds for the current 454 // Fetch the geometry of the root window.
455 // monitor. However, that's pretty difficult and requires futzing with XRR. 455 Window root;
456 NOTIMPLEMENTED(); 456 int x, y;
457 return gfx::Rect(); 457 unsigned int width, height;
458 unsigned int border_width, depth;
459 if (!XGetGeometry(xdisplay_, x_root_window_, &root, &x, &y,
460 &width, &height, &border_width, &depth)) {
461 NOTIMPLEMENTED();
462 return gfx::Rect(0, 0, 10, 10);
463 }
464
465 return gfx::Rect(x, y, width, height);
458 } 466 }
459 467
460 void DesktopRootWindowHostLinux::SetShape(gfx::NativeRegion native_region) { 468 void DesktopRootWindowHostLinux::SetShape(gfx::NativeRegion native_region) {
461 // TODO(erg): 469 // TODO(erg):
462 NOTIMPLEMENTED(); 470 NOTIMPLEMENTED();
463 } 471 }
464 472
465 void DesktopRootWindowHostLinux::Activate() { 473 void DesktopRootWindowHostLinux::Activate() {
466 X11DesktopHandler::get()->ActivateWindow(xwindow_); 474 X11DesktopHandler::get()->ActivateWindow(xwindow_);
467 } 475 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 return bounds_; 693 return bounds_;
686 } 694 }
687 695
688 void DesktopRootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { 696 void DesktopRootWindowHostLinux::SetBounds(const gfx::Rect& bounds) {
689 bool origin_changed = bounds_.origin() != bounds.origin(); 697 bool origin_changed = bounds_.origin() != bounds.origin();
690 bool size_changed = bounds_.size() != bounds.size(); 698 bool size_changed = bounds_.size() != bounds.size();
691 XWindowChanges changes = {0}; 699 XWindowChanges changes = {0};
692 unsigned value_mask = 0; 700 unsigned value_mask = 0;
693 701
694 if (size_changed) { 702 if (size_changed) {
703 // X11 will send an XError at our process if have a 0 sized window.
704 DCHECK_GT(bounds.width(), 0);
705 DCHECK_GT(bounds.height(), 0);
706
695 changes.width = bounds.width(); 707 changes.width = bounds.width();
696 changes.height = bounds.height(); 708 changes.height = bounds.height();
697 value_mask |= CWHeight | CWWidth; 709 value_mask |= CWHeight | CWWidth;
698 } 710 }
699 711
700 if (origin_changed) { 712 if (origin_changed) {
701 changes.x = bounds.x(); 713 changes.x = bounds.x();
702 changes.y = bounds.y(); 714 changes.y = bounds.y();
703 value_mask |= CWX | CWY; 715 value_mask |= CWX | CWY;
704 } 716 }
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 DesktopRootWindowHost* DesktopRootWindowHost::Create( 1113 DesktopRootWindowHost* DesktopRootWindowHost::Create(
1102 internal::NativeWidgetDelegate* native_widget_delegate, 1114 internal::NativeWidgetDelegate* native_widget_delegate,
1103 DesktopNativeWidgetAura* desktop_native_widget_aura, 1115 DesktopNativeWidgetAura* desktop_native_widget_aura,
1104 const gfx::Rect& initial_bounds) { 1116 const gfx::Rect& initial_bounds) {
1105 return new DesktopRootWindowHostLinux(native_widget_delegate, 1117 return new DesktopRootWindowHostLinux(native_widget_delegate,
1106 desktop_native_widget_aura, 1118 desktop_native_widget_aura,
1107 initial_bounds); 1119 initial_bounds);
1108 } 1120 }
1109 1121
1110 } // namespace views 1122 } // namespace views
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_test_launcher.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698