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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 void DesktopWindowTreeHostX11::SetVisibilityChangedAnimationsEnabled( | 777 void DesktopWindowTreeHostX11::SetVisibilityChangedAnimationsEnabled( |
778 bool value) { | 778 bool value) { |
779 // Much like the previous NativeWidgetGtk, we don't have anything to do here. | 779 // Much like the previous NativeWidgetGtk, we don't have anything to do here. |
780 } | 780 } |
781 | 781 |
782 bool DesktopWindowTreeHostX11::ShouldUseNativeFrame() const { | 782 bool DesktopWindowTreeHostX11::ShouldUseNativeFrame() const { |
783 return use_native_frame_; | 783 return use_native_frame_; |
784 } | 784 } |
785 | 785 |
786 bool DesktopWindowTreeHostX11::ShouldWindowContentsBeTransparent() const { | 786 bool DesktopWindowTreeHostX11::ShouldWindowContentsBeTransparent() const { |
787 return false; | 787 return IsTranslucentWindowOpacitySupported(); |
788 } | 788 } |
789 | 789 |
790 void DesktopWindowTreeHostX11::FrameTypeChanged() { | 790 void DesktopWindowTreeHostX11::FrameTypeChanged() { |
791 Widget::FrameType new_type = | 791 Widget::FrameType new_type = |
792 native_widget_delegate_->AsWidget()->frame_type(); | 792 native_widget_delegate_->AsWidget()->frame_type(); |
793 if (new_type == Widget::FRAME_TYPE_DEFAULT) { | 793 if (new_type == Widget::FRAME_TYPE_DEFAULT) { |
794 // The default is determined by Widget::InitParams::remove_standard_frame | 794 // The default is determined by Widget::InitParams::remove_standard_frame |
795 // and does not change. | 795 // and does not change. |
796 return; | 796 return; |
797 } | 797 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 } | 933 } |
934 | 934 |
935 void DesktopWindowTreeHostX11::OnNativeWidgetBlur() { | 935 void DesktopWindowTreeHostX11::OnNativeWidgetBlur() { |
936 } | 936 } |
937 | 937 |
938 bool DesktopWindowTreeHostX11::IsAnimatingClosed() const { | 938 bool DesktopWindowTreeHostX11::IsAnimatingClosed() const { |
939 return false; | 939 return false; |
940 } | 940 } |
941 | 941 |
942 bool DesktopWindowTreeHostX11::IsTranslucentWindowOpacitySupported() const { | 942 bool DesktopWindowTreeHostX11::IsTranslucentWindowOpacitySupported() const { |
943 return false; | 943 return use_argb_visual_; |
944 } | 944 } |
945 | 945 |
946 void DesktopWindowTreeHostX11::SizeConstraintsChanged() { | 946 void DesktopWindowTreeHostX11::SizeConstraintsChanged() { |
947 UpdateMinAndMaxSize(); | 947 UpdateMinAndMaxSize(); |
948 } | 948 } |
949 | 949 |
950 //////////////////////////////////////////////////////////////////////////////// | 950 //////////////////////////////////////////////////////////////////////////////// |
951 // DesktopWindowTreeHostX11, aura::WindowTreeHost implementation: | 951 // DesktopWindowTreeHostX11, aura::WindowTreeHost implementation: |
952 | 952 |
953 gfx::Transform DesktopWindowTreeHostX11::GetRootTransform() const { | 953 gfx::Transform DesktopWindowTreeHostX11::GetRootTransform() const { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 if (depth == 32) { | 1141 if (depth == 32) { |
1142 attribute_mask |= CWColormap; | 1142 attribute_mask |= CWColormap; |
1143 swa.colormap = | 1143 swa.colormap = |
1144 XCreateColormap(xdisplay_, x_root_window_, visual, AllocNone); | 1144 XCreateColormap(xdisplay_, x_root_window_, visual, AllocNone); |
1145 | 1145 |
1146 // x.org will BadMatch if we don't set a border when the depth isn't the | 1146 // x.org will BadMatch if we don't set a border when the depth isn't the |
1147 // same as the parent depth. | 1147 // same as the parent depth. |
1148 attribute_mask |= CWBorderPixel; | 1148 attribute_mask |= CWBorderPixel; |
1149 swa.border_pixel = 0; | 1149 swa.border_pixel = 0; |
1150 | 1150 |
1151 use_argb_visual_ = true; | 1151 // A compositing manager is required to support transparency. |
| 1152 use_argb_visual_ = |
| 1153 XGetSelectionOwner(xdisplay_, atom_cache_.GetAtom("_NET_WM_CM_S0")) != |
| 1154 None; |
1152 } | 1155 } |
1153 | 1156 |
1154 bounds_in_pixels_ = ToPixelRect(params.bounds); | 1157 bounds_in_pixels_ = ToPixelRect(params.bounds); |
1155 bounds_in_pixels_.set_size(AdjustSize(bounds_in_pixels_.size())); | 1158 bounds_in_pixels_.set_size(AdjustSize(bounds_in_pixels_.size())); |
1156 xwindow_ = XCreateWindow(xdisplay_, x_root_window_, bounds_in_pixels_.x(), | 1159 xwindow_ = XCreateWindow(xdisplay_, x_root_window_, bounds_in_pixels_.x(), |
1157 bounds_in_pixels_.y(), bounds_in_pixels_.width(), | 1160 bounds_in_pixels_.y(), bounds_in_pixels_.width(), |
1158 bounds_in_pixels_.height(), | 1161 bounds_in_pixels_.height(), |
1159 0, // border width | 1162 0, // border width |
1160 depth, InputOutput, visual, attribute_mask, &swa); | 1163 depth, InputOutput, visual, attribute_mask, &swa); |
1161 if (ui::PlatformEventSource::GetInstance()) | 1164 if (ui::PlatformEventSource::GetInstance()) |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 if (linux_ui) { | 2070 if (linux_ui) { |
2068 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2071 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
2069 if (native_theme) | 2072 if (native_theme) |
2070 return native_theme; | 2073 return native_theme; |
2071 } | 2074 } |
2072 | 2075 |
2073 return ui::NativeThemeAura::instance(); | 2076 return ui::NativeThemeAura::instance(); |
2074 } | 2077 } |
2075 | 2078 |
2076 } // namespace views | 2079 } // namespace views |
OLD | NEW |