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

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

Issue 985993002: linux/x11: Fix setting custom window shapes in High DPI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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_window_tree_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xregion.h> 10 #include <X11/Xregion.h>
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 return ToDIPRect(GetWorkAreaBoundsInPixels()); 485 return ToDIPRect(GetWorkAreaBoundsInPixels());
486 } 486 }
487 487
488 void DesktopWindowTreeHostX11::SetShape(gfx::NativeRegion native_region) { 488 void DesktopWindowTreeHostX11::SetShape(gfx::NativeRegion native_region) {
489 if (window_shape_) 489 if (window_shape_)
490 XDestroyRegion(window_shape_); 490 XDestroyRegion(window_shape_);
491 custom_window_shape_ = false; 491 custom_window_shape_ = false;
492 window_shape_ = NULL; 492 window_shape_ = NULL;
493 493
494 if (native_region) { 494 if (native_region) {
495 gfx::Transform transform = GetRootTransform();
496 if (!transform.IsIdentity()) {
497 SkPath path_in_dip;
498 if (native_region->getBoundaryPath(&path_in_dip)) {
499 SkPath path_in_pixels;
500 path_in_dip.transform(transform.matrix(), &path_in_pixels);
501 window_shape_ = gfx::CreateRegionFromSkPath(path_in_pixels);
502 }
pkotwicz 2015/03/08 23:44:57 I getBoundaryPath() returns false, you can just do
sadrul 2015/03/09 17:20:10 Done.
503 }
pkotwicz 2015/03/08 23:33:26 Move "window_shape_ = gfx::CreateRegionFromSkRegio
sadrul 2015/03/09 17:20:10 Done.
504
495 custom_window_shape_ = true; 505 custom_window_shape_ = true;
496 window_shape_ = gfx::CreateRegionFromSkRegion(*native_region); 506 if (!window_shape_)
507 window_shape_ = gfx::CreateRegionFromSkRegion(*native_region);
497 delete native_region; 508 delete native_region;
498 } 509 }
499 ResetWindowRegion(); 510 ResetWindowRegion();
500 } 511 }
501 512
502 void DesktopWindowTreeHostX11::Activate() { 513 void DesktopWindowTreeHostX11::Activate() {
503 if (!window_mapped_) 514 if (!window_mapped_)
504 return; 515 return;
505 516
506 X11DesktopHandler::get()->ActivateWindow(xwindow_); 517 X11DesktopHandler::get()->ActivateWindow(xwindow_);
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 if (linux_ui) { 1997 if (linux_ui) {
1987 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); 1998 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window);
1988 if (native_theme) 1999 if (native_theme)
1989 return native_theme; 2000 return native_theme;
1990 } 2001 }
1991 2002
1992 return ui::NativeTheme::instance(); 2003 return ui::NativeTheme::instance();
1993 } 2004 }
1994 2005
1995 } // namespace views 2006 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698