| OLD | NEW |
| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 if (workspace_ == workspace_str) | 581 if (workspace_ == workspace_str) |
| 582 return false; | 582 return false; |
| 583 workspace_ = workspace_str; | 583 workspace_ = workspace_str; |
| 584 return true; | 584 return true; |
| 585 } | 585 } |
| 586 | 586 |
| 587 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInScreen() const { | 587 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInScreen() const { |
| 588 return ToDIPRect(GetWorkAreaBoundsInPixels()); | 588 return ToDIPRect(GetWorkAreaBoundsInPixels()); |
| 589 } | 589 } |
| 590 | 590 |
| 591 void DesktopWindowTreeHostX11::SetShape(SkRegion* native_region) { | 591 void DesktopWindowTreeHostX11::SetShape( |
| 592 std::unique_ptr<SkRegion> native_region) { |
| 592 custom_window_shape_ = false; | 593 custom_window_shape_ = false; |
| 593 window_shape_.reset(); | 594 window_shape_.reset(); |
| 594 | 595 |
| 595 if (native_region) { | 596 if (native_region) { |
| 596 gfx::Transform transform = GetRootTransform(); | 597 gfx::Transform transform = GetRootTransform(); |
| 597 if (!transform.IsIdentity() && !native_region->isEmpty()) { | 598 if (!transform.IsIdentity() && !native_region->isEmpty()) { |
| 598 SkPath path_in_dip; | 599 SkPath path_in_dip; |
| 599 if (native_region->getBoundaryPath(&path_in_dip)) { | 600 if (native_region->getBoundaryPath(&path_in_dip)) { |
| 600 SkPath path_in_pixels; | 601 SkPath path_in_pixels; |
| 601 path_in_dip.transform(transform.matrix(), &path_in_pixels); | 602 path_in_dip.transform(transform.matrix(), &path_in_pixels); |
| 602 window_shape_.reset(gfx::CreateRegionFromSkPath(path_in_pixels)); | 603 window_shape_.reset(gfx::CreateRegionFromSkPath(path_in_pixels)); |
| 603 } else { | 604 } else { |
| 604 window_shape_.reset(XCreateRegion()); | 605 window_shape_.reset(XCreateRegion()); |
| 605 } | 606 } |
| 606 } else { | 607 } else { |
| 607 window_shape_.reset(gfx::CreateRegionFromSkRegion(*native_region)); | 608 window_shape_.reset(gfx::CreateRegionFromSkRegion(*native_region)); |
| 608 } | 609 } |
| 609 | 610 |
| 610 custom_window_shape_ = true; | 611 custom_window_shape_ = true; |
| 611 delete native_region; | |
| 612 } | 612 } |
| 613 ResetWindowRegion(); | 613 ResetWindowRegion(); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void DesktopWindowTreeHostX11::Activate() { | 616 void DesktopWindowTreeHostX11::Activate() { |
| 617 if (!window_mapped_) | 617 if (!window_mapped_) |
| 618 return; | 618 return; |
| 619 | 619 |
| 620 X11DesktopHandler::get()->ActivateWindow(xwindow_); | 620 X11DesktopHandler::get()->ActivateWindow(xwindow_); |
| 621 } | 621 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 std::string utf8str = base::UTF16ToUTF8(title); | 747 std::string utf8str = base::UTF16ToUTF8(title); |
| 748 XChangeProperty(xdisplay_, | 748 XChangeProperty(xdisplay_, |
| 749 xwindow_, | 749 xwindow_, |
| 750 atom_cache_.GetAtom("_NET_WM_NAME"), | 750 atom_cache_.GetAtom("_NET_WM_NAME"), |
| 751 atom_cache_.GetAtom("UTF8_STRING"), | 751 atom_cache_.GetAtom("UTF8_STRING"), |
| 752 8, | 752 8, |
| 753 PropModeReplace, | 753 PropModeReplace, |
| 754 reinterpret_cast<const unsigned char*>(utf8str.c_str()), | 754 reinterpret_cast<const unsigned char*>(utf8str.c_str()), |
| 755 utf8str.size()); | 755 utf8str.size()); |
| 756 XTextProperty xtp; | 756 XTextProperty xtp; |
| 757 char *c_utf8_str = const_cast<char *>(utf8str.c_str()); | 757 char* c_utf8_str = const_cast<char*>(utf8str.c_str()); |
| 758 if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, | 758 if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, |
| 759 XUTF8StringStyle, &xtp) == Success) { | 759 XUTF8StringStyle, &xtp) == Success) { |
| 760 XSetWMName(xdisplay_, xwindow_, &xtp); | 760 XSetWMName(xdisplay_, xwindow_, &xtp); |
| 761 XFree(xtp.value); | 761 XFree(xtp.value); |
| 762 } | 762 } |
| 763 return true; | 763 return true; |
| 764 } | 764 } |
| 765 | 765 |
| 766 void DesktopWindowTreeHostX11::ClearNativeFocus() { | 766 void DesktopWindowTreeHostX11::ClearNativeFocus() { |
| 767 // This method is weird and misnamed. Instead of clearing the native focus, | 767 // This method is weird and misnamed. Instead of clearing the native focus, |
| (...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 if (linux_ui) { | 2094 if (linux_ui) { |
| 2095 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2095 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 2096 if (native_theme) | 2096 if (native_theme) |
| 2097 return native_theme; | 2097 return native_theme; |
| 2098 } | 2098 } |
| 2099 | 2099 |
| 2100 return ui::NativeThemeAura::instance(); | 2100 return ui::NativeThemeAura::instance(); |
| 2101 } | 2101 } |
| 2102 | 2102 |
| 2103 } // namespace views | 2103 } // namespace views |
| OLD | NEW |