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