| 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_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_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 14 matching lines...) Expand all Loading... |
| 25 #include "ui/base/x/x11_util.h" | 25 #include "ui/base/x/x11_util.h" |
| 26 #include "ui/gfx/insets.h" | 26 #include "ui/gfx/insets.h" |
| 27 #include "ui/gfx/path_x11.h" | 27 #include "ui/gfx/path_x11.h" |
| 28 #include "ui/linux_ui/linux_ui.h" | 28 #include "ui/linux_ui/linux_ui.h" |
| 29 #include "ui/native_theme/native_theme.h" | 29 #include "ui/native_theme/native_theme.h" |
| 30 #include "ui/views/corewm/compound_event_filter.h" | 30 #include "ui/views/corewm/compound_event_filter.h" |
| 31 #include "ui/views/corewm/corewm_switches.h" | 31 #include "ui/views/corewm/corewm_switches.h" |
| 32 #include "ui/views/corewm/cursor_manager.h" | 32 #include "ui/views/corewm/cursor_manager.h" |
| 33 #include "ui/views/corewm/focus_controller.h" | 33 #include "ui/views/corewm/focus_controller.h" |
| 34 #include "ui/views/ime/input_method.h" | 34 #include "ui/views/ime/input_method.h" |
| 35 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" | |
| 36 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater_aurax11.h" | 35 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater_aurax11.h" |
| 37 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" | 36 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" |
| 38 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" | 37 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
| 39 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" | 38 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" |
| 40 #include "ui/views/widget/desktop_aura/desktop_layout_manager.h" | 39 #include "ui/views/widget/desktop_aura/desktop_layout_manager.h" |
| 41 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 40 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 42 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 41 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 43 #include "ui/views/widget/desktop_aura/desktop_root_window_host_observer_x11.h" | 42 #include "ui/views/widget/desktop_aura/desktop_root_window_host_observer_x11.h" |
| 44 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 43 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
| 45 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" | 44 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 atom_cache_(xdisplay_, kAtomsToCache), | 120 atom_cache_(xdisplay_, kAtomsToCache), |
| 122 window_mapped_(false), | 121 window_mapped_(false), |
| 123 focus_when_shown_(false), | 122 focus_when_shown_(false), |
| 124 current_cursor_(ui::kCursorNull), | 123 current_cursor_(ui::kCursorNull), |
| 125 native_widget_delegate_(native_widget_delegate), | 124 native_widget_delegate_(native_widget_delegate), |
| 126 desktop_native_widget_aura_(desktop_native_widget_aura) { | 125 desktop_native_widget_aura_(desktop_native_widget_aura) { |
| 127 } | 126 } |
| 128 | 127 |
| 129 DesktopRootWindowHostX11::~DesktopRootWindowHostX11() { | 128 DesktopRootWindowHostX11::~DesktopRootWindowHostX11() { |
| 130 root_window_->ClearProperty(kHostForRootWindow); | 129 root_window_->ClearProperty(kHostForRootWindow); |
| 131 if (corewm::UseFocusControllerOnDesktop()) { | 130 aura::client::SetFocusClient(root_window_, NULL); |
| 132 aura::client::SetFocusClient(root_window_, NULL); | 131 aura::client::SetActivationClient(root_window_, NULL); |
| 133 aura::client::SetActivationClient(root_window_, NULL); | |
| 134 } | |
| 135 } | 132 } |
| 136 | 133 |
| 137 // static | 134 // static |
| 138 aura::Window* DesktopRootWindowHostX11::GetContentWindowForXID(XID xid) { | 135 aura::Window* DesktopRootWindowHostX11::GetContentWindowForXID(XID xid) { |
| 139 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(xid); | 136 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(xid); |
| 140 return root ? root->GetProperty(kViewsWindowForRootWindow) : NULL; | 137 return root ? root->GetProperty(kViewsWindowForRootWindow) : NULL; |
| 141 } | 138 } |
| 142 | 139 |
| 143 // static | 140 // static |
| 144 DesktopRootWindowHostX11* DesktopRootWindowHostX11::GetHostForXID(XID xid) { | 141 DesktopRootWindowHostX11* DesktopRootWindowHostX11::GetHostForXID(XID xid) { |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 parent->AddTransientChild(content_window_); | 886 parent->AddTransientChild(content_window_); |
| 890 | 887 |
| 891 native_widget_delegate_->OnNativeWidgetCreated(true); | 888 native_widget_delegate_->OnNativeWidgetCreated(true); |
| 892 | 889 |
| 893 desktop_native_widget_aura_->CreateCaptureClient(root_window_); | 890 desktop_native_widget_aura_->CreateCaptureClient(root_window_); |
| 894 | 891 |
| 895 // Ensure that the X11DesktopHandler exists so that it dispatches activation | 892 // Ensure that the X11DesktopHandler exists so that it dispatches activation |
| 896 // messages to us. | 893 // messages to us. |
| 897 X11DesktopHandler::get(); | 894 X11DesktopHandler::get(); |
| 898 | 895 |
| 899 if (corewm::UseFocusControllerOnDesktop()) { | 896 corewm::FocusController* focus_controller = |
| 900 corewm::FocusController* focus_controller = | 897 new corewm::FocusController(new DesktopFocusRules); |
| 901 new corewm::FocusController(new DesktopFocusRules); | 898 focus_client_.reset(focus_controller); |
| 902 focus_client_.reset(focus_controller); | 899 aura::client::SetFocusClient(root_window_, focus_controller); |
| 903 aura::client::SetFocusClient(root_window_, focus_controller); | 900 aura::client::SetActivationClient(root_window_, focus_controller); |
| 904 aura::client::SetActivationClient(root_window_, focus_controller); | 901 root_window_->AddPreTargetHandler(focus_controller); |
| 905 root_window_->AddPreTargetHandler(focus_controller); | |
| 906 } else { | |
| 907 focus_client_.reset(new aura::FocusManager); | |
| 908 aura::client::SetFocusClient(root_window_, focus_client_.get()); | |
| 909 activation_client_.reset(new DesktopActivationClient(root_window_)); | |
| 910 } | |
| 911 | 902 |
| 912 dispatcher_client_.reset(new DesktopDispatcherClient); | 903 dispatcher_client_.reset(new DesktopDispatcherClient); |
| 913 aura::client::SetDispatcherClient(root_window_, | 904 aura::client::SetDispatcherClient(root_window_, |
| 914 dispatcher_client_.get()); | 905 dispatcher_client_.get()); |
| 915 | 906 |
| 916 views::DesktopNativeCursorManager* desktop_native_cursor_manager = | 907 views::DesktopNativeCursorManager* desktop_native_cursor_manager = |
| 917 new views::DesktopNativeCursorManager( | 908 new views::DesktopNativeCursorManager( |
| 918 root_window_, | 909 root_window_, |
| 919 scoped_ptr<DesktopCursorLoaderUpdater>( | 910 scoped_ptr<DesktopCursorLoaderUpdater>( |
| 920 new DesktopCursorLoaderUpdaterAuraX11)); | 911 new DesktopCursorLoaderUpdaterAuraX11)); |
| 921 cursor_client_.reset( | 912 cursor_client_.reset( |
| 922 new views::corewm::CursorManager( | 913 new views::corewm::CursorManager( |
| 923 scoped_ptr<corewm::NativeCursorManager>( | 914 scoped_ptr<corewm::NativeCursorManager>( |
| 924 desktop_native_cursor_manager))); | 915 desktop_native_cursor_manager))); |
| 925 aura::client::SetCursorClient(root_window_, | 916 aura::client::SetCursorClient(root_window_, |
| 926 cursor_client_.get()); | 917 cursor_client_.get()); |
| 927 | 918 |
| 928 position_client_.reset(new DesktopScreenPositionClient); | 919 position_client_.reset(new DesktopScreenPositionClient); |
| 929 aura::client::SetScreenPositionClient(root_window_, | 920 aura::client::SetScreenPositionClient(root_window_, |
| 930 position_client_.get()); | 921 position_client_.get()); |
| 931 | 922 |
| 932 desktop_native_widget_aura_->InstallInputMethodEventFilter(root_window_); | 923 desktop_native_widget_aura_->InstallInputMethodEventFilter(root_window_); |
| 933 | 924 |
| 934 drag_drop_client_.reset(new DesktopDragDropClientAuraX11( | 925 drag_drop_client_.reset(new DesktopDragDropClientAuraX11( |
| 935 root_window_, desktop_native_cursor_manager, xdisplay_, xwindow_)); | 926 root_window_, desktop_native_cursor_manager, xdisplay_, xwindow_)); |
| 936 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); | 927 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); |
| 937 | 928 |
| 938 // TODO(erg): Unify this code once the other consumer goes away. | 929 // TODO(erg): Unify this code once the other consumer goes away. |
| 939 x11_window_event_filter_.reset( | 930 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_)); |
| 940 new X11WindowEventFilter(root_window_, activation_client_.get())); | |
| 941 x11_window_event_filter_->SetUseHostWindowBorders(false); | 931 x11_window_event_filter_->SetUseHostWindowBorders(false); |
| 942 desktop_native_widget_aura_->root_window_event_filter()->AddHandler( | 932 desktop_native_widget_aura_->root_window_event_filter()->AddHandler( |
| 943 x11_window_event_filter_.get()); | 933 x11_window_event_filter_.get()); |
| 944 | 934 |
| 945 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); | 935 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); |
| 946 aura::client::SetWindowMoveClient(root_window_, | 936 aura::client::SetWindowMoveClient(root_window_, |
| 947 x11_window_move_client_.get()); | 937 x11_window_move_client_.get()); |
| 948 | 938 |
| 949 focus_client_->FocusWindow(content_window_); | 939 focus_client_->FocusWindow(content_window_); |
| 950 return root_window_; | 940 return root_window_; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 if (linux_ui) { | 1326 if (linux_ui) { |
| 1337 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1327 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 1338 if (native_theme) | 1328 if (native_theme) |
| 1339 return native_theme; | 1329 return native_theme; |
| 1340 } | 1330 } |
| 1341 | 1331 |
| 1342 return ui::NativeTheme::instance(); | 1332 return ui::NativeTheme::instance(); |
| 1343 } | 1333 } |
| 1344 | 1334 |
| 1345 } // namespace views | 1335 } // namespace views |
| OLD | NEW |