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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } else { | 240 } else { |
241 ReleaseCapture(); | 241 ReleaseCapture(); |
242 } | 242 } |
243 | 243 |
244 desktop_native_widget_aura_->HandleActivationChanged(active); | 244 desktop_native_widget_aura_->HandleActivationChanged(active); |
245 | 245 |
246 native_widget_delegate_->AsWidget()->GetRootView()->SchedulePaint(); | 246 native_widget_delegate_->AsWidget()->GetRootView()->SchedulePaint(); |
247 } | 247 } |
248 | 248 |
249 void DesktopWindowTreeHostX11::AddObserver( | 249 void DesktopWindowTreeHostX11::AddObserver( |
250 views::DesktopWindowTreeHostObserverX11* observer) { | 250 DesktopWindowTreeHostObserverX11* observer) { |
251 observer_list_.AddObserver(observer); | 251 observer_list_.AddObserver(observer); |
252 } | 252 } |
253 | 253 |
254 void DesktopWindowTreeHostX11::RemoveObserver( | 254 void DesktopWindowTreeHostX11::RemoveObserver( |
255 views::DesktopWindowTreeHostObserverX11* observer) { | 255 DesktopWindowTreeHostObserverX11* observer) { |
256 observer_list_.RemoveObserver(observer); | 256 observer_list_.RemoveObserver(observer); |
257 } | 257 } |
258 | 258 |
259 void DesktopWindowTreeHostX11::SwapNonClientEventHandler( | 259 void DesktopWindowTreeHostX11::SwapNonClientEventHandler( |
260 std::unique_ptr<ui::EventHandler> handler) { | 260 std::unique_ptr<ui::EventHandler> handler) { |
261 wm::CompoundEventFilter* compound_event_filter = | 261 wm::CompoundEventFilter* compound_event_filter = |
262 desktop_native_widget_aura_->root_window_event_filter(); | 262 desktop_native_widget_aura_->root_window_event_filter(); |
263 if (x11_non_client_event_filter_) | 263 if (x11_non_client_event_filter_) |
264 compound_event_filter->RemoveHandler(x11_non_client_event_filter_.get()); | 264 compound_event_filter->RemoveHandler(x11_non_client_event_filter_.get()); |
265 compound_event_filter->AddHandler(handler.get()); | 265 compound_event_filter->AddHandler(handler.get()); |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 if (custom_window_shape_) { | 1593 if (custom_window_shape_) { |
1594 XShapeCombineRegion(xdisplay_, xwindow_, ShapeBounding, 0, 0, | 1594 XShapeCombineRegion(xdisplay_, xwindow_, ShapeBounding, 0, 0, |
1595 window_shape_.get(), false); | 1595 window_shape_.get(), false); |
1596 return; | 1596 return; |
1597 } | 1597 } |
1598 | 1598 |
1599 window_shape_.reset(); | 1599 window_shape_.reset(); |
1600 | 1600 |
1601 if (!IsMaximized() && !IsFullscreen()) { | 1601 if (!IsMaximized() && !IsFullscreen()) { |
1602 gfx::Path window_mask; | 1602 gfx::Path window_mask; |
1603 views::Widget* widget = native_widget_delegate_->AsWidget(); | 1603 Widget* widget = native_widget_delegate_->AsWidget(); |
1604 if (widget->non_client_view()) { | 1604 if (widget->non_client_view()) { |
1605 // Some frame views define a custom (non-rectangular) window mask. If | 1605 // Some frame views define a custom (non-rectangular) window mask. If |
1606 // so, use it to define the window shape. If not, fall through. | 1606 // so, use it to define the window shape. If not, fall through. |
1607 widget->non_client_view()->GetWindowMask(bounds_in_pixels_.size(), | 1607 widget->non_client_view()->GetWindowMask(bounds_in_pixels_.size(), |
1608 &window_mask); | 1608 &window_mask); |
1609 if (window_mask.countPoints() > 0) { | 1609 if (window_mask.countPoints() > 0) { |
1610 window_shape_.reset(gfx::CreateRegionFromSkPath(window_mask)); | 1610 window_shape_.reset(gfx::CreateRegionFromSkPath(window_mask)); |
1611 XShapeCombineRegion(xdisplay_, xwindow_, ShapeBounding, 0, 0, | 1611 XShapeCombineRegion(xdisplay_, xwindow_, ShapeBounding, 0, 0, |
1612 window_shape_.get(), false); | 1612 window_shape_.get(), false); |
1613 return; | 1613 return; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 // static | 2083 // static |
2084 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2084 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
2085 internal::NativeWidgetDelegate* native_widget_delegate, | 2085 internal::NativeWidgetDelegate* native_widget_delegate, |
2086 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2086 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
2087 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2087 return new DesktopWindowTreeHostX11(native_widget_delegate, |
2088 desktop_native_widget_aura); | 2088 desktop_native_widget_aura); |
2089 } | 2089 } |
2090 | 2090 |
2091 // static | 2091 // static |
2092 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { | 2092 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { |
2093 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); | 2093 const LinuxUI* linux_ui = LinuxUI::instance(); |
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 |