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

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() && !native_region->isEmpty()) {
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 } else {
503 window_shape_ = XCreateRegion();
504 }
505 } else {
506 window_shape_ = gfx::CreateRegionFromSkRegion(*native_region);
507 }
508
495 custom_window_shape_ = true; 509 custom_window_shape_ = true;
496 window_shape_ = gfx::CreateRegionFromSkRegion(*native_region);
497 delete native_region; 510 delete native_region;
498 } 511 }
499 ResetWindowRegion(); 512 ResetWindowRegion();
500 } 513 }
501 514
502 void DesktopWindowTreeHostX11::Activate() { 515 void DesktopWindowTreeHostX11::Activate() {
503 if (!window_mapped_) 516 if (!window_mapped_)
504 return; 517 return;
505 518
506 X11DesktopHandler::get()->ActivateWindow(xwindow_); 519 X11DesktopHandler::get()->ActivateWindow(xwindow_);
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 if (linux_ui) { 1999 if (linux_ui) {
1987 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); 2000 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window);
1988 if (native_theme) 2001 if (native_theme)
1989 return native_theme; 2002 return native_theme;
1990 } 2003 }
1991 2004
1992 return ui::NativeTheme::instance(); 2005 return ui::NativeTheme::instance();
1993 } 2006 }
1994 2007
1995 } // namespace views 2008 } // 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