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 10 matching lines...) Expand all Loading... |
21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
22 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
23 #include "ui/aura/window_property.h" | 23 #include "ui/aura/window_property.h" |
24 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" | 24 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
25 #include "ui/base/hit_test.h" | 25 #include "ui/base/hit_test.h" |
26 #include "ui/base/x/x11_util.h" | 26 #include "ui/base/x/x11_util.h" |
27 #include "ui/events/devices/x11/device_data_manager_x11.h" | 27 #include "ui/events/devices/x11/device_data_manager_x11.h" |
28 #include "ui/events/devices/x11/device_list_cache_x11.h" | 28 #include "ui/events/devices/x11/device_list_cache_x11.h" |
29 #include "ui/events/devices/x11/touch_factory_x11.h" | 29 #include "ui/events/devices/x11/touch_factory_x11.h" |
30 #include "ui/events/event_utils.h" | 30 #include "ui/events/event_utils.h" |
31 #include "ui/events/null_event_targeter.h" | |
32 #include "ui/events/platform/platform_event_source.h" | 31 #include "ui/events/platform/platform_event_source.h" |
33 #include "ui/events/platform/x11/x11_event_source.h" | 32 #include "ui/events/platform/x11/x11_event_source.h" |
34 #include "ui/gfx/display.h" | 33 #include "ui/gfx/display.h" |
35 #include "ui/gfx/geometry/insets.h" | 34 #include "ui/gfx/geometry/insets.h" |
36 #include "ui/gfx/geometry/size_conversions.h" | 35 #include "ui/gfx/geometry/size_conversions.h" |
37 #include "ui/gfx/image/image_skia.h" | 36 #include "ui/gfx/image/image_skia.h" |
38 #include "ui/gfx/image/image_skia_rep.h" | 37 #include "ui/gfx/image/image_skia_rep.h" |
39 #include "ui/gfx/path.h" | 38 #include "ui/gfx/path.h" |
40 #include "ui/gfx/path_x11.h" | 39 #include "ui/gfx/path_x11.h" |
41 #include "ui/gfx/screen.h" | 40 #include "ui/gfx/screen.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 use_native_frame_(false), | 164 use_native_frame_(false), |
166 should_maximize_after_map_(false), | 165 should_maximize_after_map_(false), |
167 use_argb_visual_(false), | 166 use_argb_visual_(false), |
168 drag_drop_client_(NULL), | 167 drag_drop_client_(NULL), |
169 native_widget_delegate_(native_widget_delegate), | 168 native_widget_delegate_(native_widget_delegate), |
170 desktop_native_widget_aura_(desktop_native_widget_aura), | 169 desktop_native_widget_aura_(desktop_native_widget_aura), |
171 content_window_(NULL), | 170 content_window_(NULL), |
172 window_parent_(NULL), | 171 window_parent_(NULL), |
173 custom_window_shape_(false), | 172 custom_window_shape_(false), |
174 urgency_hint_set_(false), | 173 urgency_hint_set_(false), |
175 modal_dialog_xid_(0), | |
176 close_widget_factory_(this) { | 174 close_widget_factory_(this) { |
177 } | 175 } |
178 | 176 |
179 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { | 177 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { |
180 window()->ClearProperty(kHostForRootWindow); | 178 window()->ClearProperty(kHostForRootWindow); |
181 aura::client::SetWindowMoveClient(window(), NULL); | 179 aura::client::SetWindowMoveClient(window(), NULL); |
182 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); | 180 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); |
183 DestroyDispatcher(); | 181 DestroyDispatcher(); |
184 } | 182 } |
185 | 183 |
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 return gfx::ToEnclosingRect(rect_in_dip); | 2026 return gfx::ToEnclosingRect(rect_in_dip); |
2029 } | 2027 } |
2030 | 2028 |
2031 gfx::Rect DesktopWindowTreeHostX11::ToPixelRect( | 2029 gfx::Rect DesktopWindowTreeHostX11::ToPixelRect( |
2032 const gfx::Rect& rect_in_dip) const { | 2030 const gfx::Rect& rect_in_dip) const { |
2033 gfx::RectF rect_in_pixels = rect_in_dip; | 2031 gfx::RectF rect_in_pixels = rect_in_dip; |
2034 GetRootTransform().TransformRect(&rect_in_pixels); | 2032 GetRootTransform().TransformRect(&rect_in_pixels); |
2035 return gfx::ToEnclosingRect(rect_in_pixels); | 2033 return gfx::ToEnclosingRect(rect_in_pixels); |
2036 } | 2034 } |
2037 | 2035 |
2038 const XID DesktopWindowTreeHostX11::GetModalDialog() { | |
2039 return modal_dialog_xid_; | |
2040 } | |
2041 | |
2042 void DesktopWindowTreeHostX11::DisableEventListening(XID dialog) { | |
2043 DCHECK(modal_dialog_xid_); | |
2044 modal_dialog_xid_ = dialog; | |
2045 // ScopedWindowTargeter is used to temporarily replace the event-targeter | |
2046 // with NullEventTargeter to make |dialog| modal. | |
2047 targeter_for_modal_.reset(new aura::ScopedWindowTargeter(window(), | |
2048 scoped_ptr<ui::EventTargeter>(new ui::NullEventTargeter))); | |
2049 } | |
2050 | |
2051 void DesktopWindowTreeHostX11::EnableEventListening() { | |
2052 DCHECK(!modal_dialog_xid_); | |
2053 modal_dialog_xid_ = 0; | |
2054 targeter_for_modal_.reset(); | |
2055 } | |
2056 | |
2057 //////////////////////////////////////////////////////////////////////////////// | 2036 //////////////////////////////////////////////////////////////////////////////// |
2058 // DesktopWindowTreeHost, public: | 2037 // DesktopWindowTreeHost, public: |
2059 | 2038 |
2060 // static | 2039 // static |
2061 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2040 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
2062 internal::NativeWidgetDelegate* native_widget_delegate, | 2041 internal::NativeWidgetDelegate* native_widget_delegate, |
2063 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2042 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
2064 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2043 return new DesktopWindowTreeHostX11(native_widget_delegate, |
2065 desktop_native_widget_aura); | 2044 desktop_native_widget_aura); |
2066 } | 2045 } |
2067 | 2046 |
2068 // static | 2047 // static |
2069 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { | 2048 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { |
2070 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); | 2049 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
2071 if (linux_ui) { | 2050 if (linux_ui) { |
2072 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2051 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
2073 if (native_theme) | 2052 if (native_theme) |
2074 return native_theme; | 2053 return native_theme; |
2075 } | 2054 } |
2076 | 2055 |
2077 return ui::NativeTheme::instance(); | 2056 return ui::NativeTheme::instance(); |
2078 } | 2057 } |
2079 | 2058 |
2080 } // namespace views | 2059 } // namespace views |
OLD | NEW |