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_root_window_host_linux.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_linux.h" |
6 | 6 |
7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
10 | 10 |
11 #include "base/message_pump_aurax11.h" | 11 #include "base/message_pump_aurax11.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "ui/aura/client/cursor_client.h" | 14 #include "ui/aura/client/cursor_client.h" |
15 #include "ui/aura/client/default_capture_client.h" | 15 #include "ui/aura/client/default_capture_client.h" |
16 #include "ui/aura/client/screen_position_client.h" | 16 #include "ui/aura/client/screen_position_client.h" |
17 #include "ui/aura/client/user_action_client.h" | 17 #include "ui/aura/client/user_action_client.h" |
18 #include "ui/aura/focus_manager.h" | 18 #include "ui/aura/focus_manager.h" |
19 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
20 #include "ui/aura/window_property.h" | 20 #include "ui/aura/window_property.h" |
21 #include "ui/base/events/event_utils.h" | 21 #include "ui/base/events/event_utils.h" |
22 #include "ui/base/touch/touch_factory.h" | 22 #include "ui/base/touch/touch_factory.h" |
23 #include "ui/base/x/x11_util.h" | 23 #include "ui/base/x/x11_util.h" |
24 #include "ui/native_theme/native_theme.h" | 24 #include "ui/native_theme/native_theme.h" |
25 #include "ui/views/corewm/compound_event_filter.h" | 25 #include "ui/views/corewm/compound_event_filter.h" |
26 #include "ui/views/corewm/corewm_switches.h" | |
27 #include "ui/views/corewm/focus_controller.h" | |
28 #include "ui/views/ime/input_method.h" | 26 #include "ui/views/ime/input_method.h" |
29 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" | 27 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" |
30 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" | 28 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" |
31 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" | 29 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" |
32 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" | |
33 #include "ui/views/widget/desktop_aura/desktop_layout_manager.h" | 30 #include "ui/views/widget/desktop_aura/desktop_layout_manager.h" |
34 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
35 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 32 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
36 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" | 33 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
37 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h" | 34 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h" |
38 #include "ui/views/widget/desktop_aura/x11_window_event_filter.h" | 35 #include "ui/views/widget/desktop_aura/x11_window_event_filter.h" |
39 | 36 |
40 namespace views { | 37 namespace views { |
41 | 38 |
42 DesktopRootWindowHostLinux* DesktopRootWindowHostLinux::g_current_capture = | 39 DesktopRootWindowHostLinux* DesktopRootWindowHostLinux::g_current_capture = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 atom_cache_(xdisplay_, kAtomsToCache), | 84 atom_cache_(xdisplay_, kAtomsToCache), |
88 window_mapped_(false), | 85 window_mapped_(false), |
89 focus_when_shown_(false), | 86 focus_when_shown_(false), |
90 current_cursor_(ui::kCursorNull), | 87 current_cursor_(ui::kCursorNull), |
91 native_widget_delegate_(native_widget_delegate), | 88 native_widget_delegate_(native_widget_delegate), |
92 desktop_native_widget_aura_(desktop_native_widget_aura) { | 89 desktop_native_widget_aura_(desktop_native_widget_aura) { |
93 } | 90 } |
94 | 91 |
95 DesktopRootWindowHostLinux::~DesktopRootWindowHostLinux() { | 92 DesktopRootWindowHostLinux::~DesktopRootWindowHostLinux() { |
96 root_window_->ClearProperty(kHostForRootWindow); | 93 root_window_->ClearProperty(kHostForRootWindow); |
97 if (corewm::UseFocusController()) { | |
98 aura::client::SetFocusClient(root_window_, NULL); | |
99 aura::client::SetActivationClient(root_window_, NULL); | |
100 } | |
101 } | 94 } |
102 | 95 |
103 // static | 96 // static |
104 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { | 97 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { |
105 return ui::NativeTheme::instance(); | 98 return ui::NativeTheme::instance(); |
106 } | 99 } |
107 | 100 |
108 //////////////////////////////////////////////////////////////////////////////// | 101 //////////////////////////////////////////////////////////////////////////////// |
109 // DesktopRootWindowHostLinux, private: | 102 // DesktopRootWindowHostLinux, private: |
110 | 103 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 207 |
215 native_widget_delegate_->OnNativeWidgetCreated(); | 208 native_widget_delegate_->OnNativeWidgetCreated(); |
216 | 209 |
217 capture_client_.reset(new aura::client::DefaultCaptureClient(root_window_)); | 210 capture_client_.reset(new aura::client::DefaultCaptureClient(root_window_)); |
218 aura::client::SetCaptureClient(root_window_, capture_client_.get()); | 211 aura::client::SetCaptureClient(root_window_, capture_client_.get()); |
219 | 212 |
220 // Ensure that the X11DesktopHandler exists so that it dispatches activation | 213 // Ensure that the X11DesktopHandler exists so that it dispatches activation |
221 // messages to us. | 214 // messages to us. |
222 X11DesktopHandler::get(); | 215 X11DesktopHandler::get(); |
223 | 216 |
224 if (corewm::UseFocusController()) { | 217 focus_client_.reset(new aura::FocusManager); |
225 corewm::FocusController* focus_controller = | 218 aura::client::SetFocusClient(root_window_, focus_client_.get()); |
226 new corewm::FocusController(new DesktopFocusRules); | 219 |
227 focus_client_.reset(focus_controller); | 220 activation_client_.reset(new DesktopActivationClient(root_window_)); |
228 aura::client::SetFocusClient(root_window_, focus_controller); | |
229 aura::client::SetActivationClient(root_window_, focus_controller); | |
230 } else { | |
231 focus_client_.reset(new aura::FocusManager); | |
232 aura::client::SetFocusClient(root_window_, focus_client_.get()); | |
233 activation_client_.reset(new DesktopActivationClient(root_window_)); | |
234 } | |
235 | 221 |
236 dispatcher_client_.reset(new DesktopDispatcherClient); | 222 dispatcher_client_.reset(new DesktopDispatcherClient); |
237 aura::client::SetDispatcherClient(root_window_, | 223 aura::client::SetDispatcherClient(root_window_, |
238 dispatcher_client_.get()); | 224 dispatcher_client_.get()); |
239 | 225 |
240 cursor_client_.reset(new DesktopCursorClient(root_window_)); | 226 cursor_client_.reset(new DesktopCursorClient(root_window_)); |
241 aura::client::SetCursorClient(root_window_, | 227 aura::client::SetCursorClient(root_window_, |
242 cursor_client_.get()); | 228 cursor_client_.get()); |
243 | 229 |
244 position_client_.reset(new DesktopScreenPositionClient); | 230 position_client_.reset(new DesktopScreenPositionClient); |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 1078 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
1093 internal::NativeWidgetDelegate* native_widget_delegate, | 1079 internal::NativeWidgetDelegate* native_widget_delegate, |
1094 DesktopNativeWidgetAura* desktop_native_widget_aura, | 1080 DesktopNativeWidgetAura* desktop_native_widget_aura, |
1095 const gfx::Rect& initial_bounds) { | 1081 const gfx::Rect& initial_bounds) { |
1096 return new DesktopRootWindowHostLinux(native_widget_delegate, | 1082 return new DesktopRootWindowHostLinux(native_widget_delegate, |
1097 desktop_native_widget_aura, | 1083 desktop_native_widget_aura, |
1098 initial_bounds); | 1084 initial_bounds); |
1099 } | 1085 } |
1100 | 1086 |
1101 } // namespace views | 1087 } // namespace views |
OLD | NEW |