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 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 native_widget_delegate_->OnNativeWidgetCreated(); | 208 native_widget_delegate_->OnNativeWidgetCreated(); |
209 | 209 |
210 capture_client_.reset(new aura::client::DefaultCaptureClient(root_window_)); | 210 capture_client_.reset(new aura::client::DefaultCaptureClient(root_window_)); |
211 aura::client::SetCaptureClient(root_window_, capture_client_.get()); | 211 aura::client::SetCaptureClient(root_window_, capture_client_.get()); |
212 | 212 |
213 // Ensure that the X11DesktopHandler exists so that it dispatches activation | 213 // Ensure that the X11DesktopHandler exists so that it dispatches activation |
214 // messages to us. | 214 // messages to us. |
215 X11DesktopHandler::get(); | 215 X11DesktopHandler::get(); |
216 | 216 |
217 focus_manager_.reset(new aura::FocusManager); | 217 focus_client_.reset(new aura::FocusManager); |
218 root_window_->set_focus_manager(focus_manager_.get()); | 218 aura::client::SetFocusClient(root_window_.get(), focus_client_.get()); |
219 | 219 |
220 activation_client_.reset(new DesktopActivationClient(root_window_)); | 220 activation_client_.reset(new DesktopActivationClient(root_window_)); |
221 | 221 |
222 dispatcher_client_.reset(new DesktopDispatcherClient); | 222 dispatcher_client_.reset(new DesktopDispatcherClient); |
223 aura::client::SetDispatcherClient(root_window_, | 223 aura::client::SetDispatcherClient(root_window_, |
224 dispatcher_client_.get()); | 224 dispatcher_client_.get()); |
225 | 225 |
226 cursor_client_.reset(new DesktopCursorClient(root_window_)); | 226 cursor_client_.reset(new DesktopCursorClient(root_window_)); |
227 aura::client::SetCursorClient(root_window_, | 227 aura::client::SetCursorClient(root_window_, |
228 cursor_client_.get()); | 228 cursor_client_.get()); |
(...skipping 14 matching lines...) Expand all Loading... |
243 // TODO(erg): Unify this code once the other consumer goes away. | 243 // TODO(erg): Unify this code once the other consumer goes away. |
244 x11_window_event_filter_.reset( | 244 x11_window_event_filter_.reset( |
245 new X11WindowEventFilter(root_window_, activation_client_.get())); | 245 new X11WindowEventFilter(root_window_, activation_client_.get())); |
246 x11_window_event_filter_->SetUseHostWindowBorders(false); | 246 x11_window_event_filter_->SetUseHostWindowBorders(false); |
247 root_window_event_filter_->AddHandler(x11_window_event_filter_.get()); | 247 root_window_event_filter_->AddHandler(x11_window_event_filter_.get()); |
248 | 248 |
249 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); | 249 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); |
250 aura::client::SetWindowMoveClient(root_window_, | 250 aura::client::SetWindowMoveClient(root_window_, |
251 x11_window_move_client_.get()); | 251 x11_window_move_client_.get()); |
252 | 252 |
253 focus_manager_->SetFocusedWindow(content_window_, NULL); | 253 focus_client_->FocusWindow(content_window_, NULL); |
254 return root_window_; | 254 return root_window_; |
255 } | 255 } |
256 | 256 |
257 bool DesktopRootWindowHostLinux::IsWindowManagerPresent() { | 257 bool DesktopRootWindowHostLinux::IsWindowManagerPresent() { |
258 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership | 258 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership |
259 // of WM_Sn selections (where n is a screen number). | 259 // of WM_Sn selections (where n is a screen number). |
260 return XGetSelectionOwner( | 260 return XGetSelectionOwner( |
261 xdisplay_, atom_cache_.GetAtom("WM_S0")) != None; | 261 xdisplay_, atom_cache_.GetAtom("WM_S0")) != None; |
262 } | 262 } |
263 | 263 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 void DesktopRootWindowHostLinux::SetWindowTitle(const string16& title) { | 525 void DesktopRootWindowHostLinux::SetWindowTitle(const string16& title) { |
526 XStoreName(xdisplay_, xwindow_, UTF16ToUTF8(title).c_str()); | 526 XStoreName(xdisplay_, xwindow_, UTF16ToUTF8(title).c_str()); |
527 } | 527 } |
528 | 528 |
529 void DesktopRootWindowHostLinux::ClearNativeFocus() { | 529 void DesktopRootWindowHostLinux::ClearNativeFocus() { |
530 // This method is weird and misnamed. Instead of clearing the native focus, | 530 // This method is weird and misnamed. Instead of clearing the native focus, |
531 // it sets the focus to our |content_window_|, which will trigger a cascade | 531 // it sets the focus to our |content_window_|, which will trigger a cascade |
532 // of focus changes into views. | 532 // of focus changes into views. |
533 if (content_window_ && content_window_->GetFocusManager() && | 533 if (content_window_ && content_window_->GetFocusManager() && |
534 content_window_->Contains( | 534 content_window_->Contains( |
535 content_window_->GetFocusManager()->GetFocusedWindow())) { | 535 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { |
536 content_window_->GetFocusManager()->SetFocusedWindow(content_window_, NULL); | 536 aura::client::GetFocusClient(content_window_)->FocusWindow( |
| 537 content_window_, NULL); |
537 } | 538 } |
538 } | 539 } |
539 | 540 |
540 Widget::MoveLoopResult DesktopRootWindowHostLinux::RunMoveLoop( | 541 Widget::MoveLoopResult DesktopRootWindowHostLinux::RunMoveLoop( |
541 const gfx::Vector2d& drag_offset) { | 542 const gfx::Vector2d& drag_offset) { |
542 SetCapture(); | 543 SetCapture(); |
543 | 544 |
544 if (x11_window_move_client_->RunMoveLoop(content_window_, drag_offset) == | 545 if (x11_window_move_client_->RunMoveLoop(content_window_, drag_offset) == |
545 aura::client::MOVE_SUCCESSFUL) | 546 aura::client::MOVE_SUCCESSFUL) |
546 return Widget::MOVE_LOOP_SUCCESSFUL; | 547 return Widget::MOVE_LOOP_SUCCESSFUL; |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 1094 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
1094 internal::NativeWidgetDelegate* native_widget_delegate, | 1095 internal::NativeWidgetDelegate* native_widget_delegate, |
1095 DesktopNativeWidgetAura* desktop_native_widget_aura, | 1096 DesktopNativeWidgetAura* desktop_native_widget_aura, |
1096 const gfx::Rect& initial_bounds) { | 1097 const gfx::Rect& initial_bounds) { |
1097 return new DesktopRootWindowHostLinux(native_widget_delegate, | 1098 return new DesktopRootWindowHostLinux(native_widget_delegate, |
1098 desktop_native_widget_aura, | 1099 desktop_native_widget_aura, |
1099 initial_bounds); | 1100 initial_bounds); |
1100 } | 1101 } |
1101 | 1102 |
1102 } // namespace views | 1103 } // namespace views |
OLD | NEW |