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_root_window_host_linux.h" | 5 #include "ui/views/widget/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 10 matching lines...) Expand all Loading... |
21 #include "ui/aura/shared/input_method_event_filter.h" | 21 #include "ui/aura/shared/input_method_event_filter.h" |
22 #include "ui/aura/window_property.h" | 22 #include "ui/aura/window_property.h" |
23 #include "ui/base/touch/touch_factory.h" | 23 #include "ui/base/touch/touch_factory.h" |
24 #include "ui/base/x/x11_util.h" | 24 #include "ui/base/x/x11_util.h" |
25 #include "ui/views/ime/input_method_bridge.h" | 25 #include "ui/views/ime/input_method_bridge.h" |
26 #include "ui/views/widget/desktop_capture_client.h" | 26 #include "ui/views/widget/desktop_capture_client.h" |
27 #include "ui/views/widget/desktop_layout_manager.h" | 27 #include "ui/views/widget/desktop_layout_manager.h" |
28 #include "ui/views/widget/desktop_native_widget_aura.h" | 28 #include "ui/views/widget/desktop_native_widget_aura.h" |
29 #include "ui/views/widget/desktop_screen_position_client.h" | 29 #include "ui/views/widget/desktop_screen_position_client.h" |
30 #include "ui/views/widget/x11_desktop_handler.h" | 30 #include "ui/views/widget/x11_desktop_handler.h" |
| 31 #include "ui/views/widget/x11_desktop_window_move_client.h" |
31 #include "ui/views/widget/x11_window_event_filter.h" | 32 #include "ui/views/widget/x11_window_event_filter.h" |
32 | 33 |
33 namespace views { | 34 namespace views { |
34 | 35 |
35 DEFINE_WINDOW_PROPERTY_KEY( | 36 DEFINE_WINDOW_PROPERTY_KEY( |
36 aura::Window*, kViewsWindowForRootWindow, NULL); | 37 aura::Window*, kViewsWindowForRootWindow, NULL); |
37 | 38 |
38 namespace { | 39 namespace { |
39 | 40 |
40 // Standard Linux mouse buttons for going back and forward. | 41 // Standard Linux mouse buttons for going back and forward. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); | 217 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); |
217 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_); | 218 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_); |
218 root_window_event_filter_->AddFilter(input_method_filter_.get()); | 219 root_window_event_filter_->AddFilter(input_method_filter_.get()); |
219 | 220 |
220 // TODO(erg): Unify this code once the other consumer goes away. | 221 // TODO(erg): Unify this code once the other consumer goes away. |
221 x11_window_event_filter_.reset( | 222 x11_window_event_filter_.reset( |
222 new X11WindowEventFilter(root_window_, activation_client)); | 223 new X11WindowEventFilter(root_window_, activation_client)); |
223 x11_window_event_filter_->SetUseHostWindowBorders(false); | 224 x11_window_event_filter_->SetUseHostWindowBorders(false); |
224 root_window_event_filter_->AddFilter(x11_window_event_filter_.get()); | 225 root_window_event_filter_->AddFilter(x11_window_event_filter_.get()); |
225 | 226 |
| 227 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); |
| 228 root_window_event_filter_->AddFilter(x11_window_move_client_.get()); |
| 229 aura::client::SetWindowMoveClient(root_window_, |
| 230 x11_window_move_client_.get()); |
| 231 |
226 return root_window_; | 232 return root_window_; |
227 } | 233 } |
228 | 234 |
229 bool DesktopRootWindowHostLinux::IsWindowManagerPresent() { | 235 bool DesktopRootWindowHostLinux::IsWindowManagerPresent() { |
230 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership | 236 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership |
231 // of WM_Sn selections (where n is a screen number). | 237 // of WM_Sn selections (where n is a screen number). |
232 return XGetSelectionOwner( | 238 return XGetSelectionOwner( |
233 xdisplay_, atom_cache_.GetAtom("WM_S0")) != None; | 239 xdisplay_, atom_cache_.GetAtom("WM_S0")) != None; |
234 } | 240 } |
235 | 241 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 MessageLoop::current()->PostTask( | 299 MessageLoop::current()->PostTask( |
294 FROM_HERE, | 300 FROM_HERE, |
295 base::Bind(&DesktopRootWindowHostLinux::CloseNow, | 301 base::Bind(&DesktopRootWindowHostLinux::CloseNow, |
296 close_widget_factory_.GetWeakPtr())); | 302 close_widget_factory_.GetWeakPtr())); |
297 } | 303 } |
298 } | 304 } |
299 | 305 |
300 void DesktopRootWindowHostLinux::CloseNow() { | 306 void DesktopRootWindowHostLinux::CloseNow() { |
301 // Remove the event listeners we've installed. We need to remove these | 307 // Remove the event listeners we've installed. We need to remove these |
302 // because otherwise we get assert during ~RootWindow(). | 308 // because otherwise we get assert during ~RootWindow(). |
| 309 root_window_event_filter_->RemoveFilter(x11_window_move_client_.get()); |
303 root_window_event_filter_->RemoveFilter(x11_window_event_filter_.get()); | 310 root_window_event_filter_->RemoveFilter(x11_window_event_filter_.get()); |
304 root_window_event_filter_->RemoveFilter(input_method_filter_.get()); | 311 root_window_event_filter_->RemoveFilter(input_method_filter_.get()); |
305 | 312 |
306 // Actually free our native resources. | 313 // Actually free our native resources. |
307 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(xwindow_); | 314 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(xwindow_); |
308 XDestroyWindow(xdisplay_, xwindow_); | 315 XDestroyWindow(xdisplay_, xwindow_); |
309 xwindow_ = None; | 316 xwindow_ = None; |
310 | 317 |
311 desktop_native_widget_aura_->OnHostClosed(); | 318 desktop_native_widget_aura_->OnHostClosed(); |
312 } | 319 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // of focus changes into views. | 500 // of focus changes into views. |
494 if (content_window_ && content_window_->GetFocusManager() && | 501 if (content_window_ && content_window_->GetFocusManager() && |
495 content_window_->Contains( | 502 content_window_->Contains( |
496 content_window_->GetFocusManager()->GetFocusedWindow())) { | 503 content_window_->GetFocusManager()->GetFocusedWindow())) { |
497 content_window_->GetFocusManager()->SetFocusedWindow(content_window_, NULL); | 504 content_window_->GetFocusManager()->SetFocusedWindow(content_window_, NULL); |
498 } | 505 } |
499 } | 506 } |
500 | 507 |
501 Widget::MoveLoopResult DesktopRootWindowHostLinux::RunMoveLoop( | 508 Widget::MoveLoopResult DesktopRootWindowHostLinux::RunMoveLoop( |
502 const gfx::Point& drag_offset) { | 509 const gfx::Point& drag_offset) { |
503 // TODO(erg): | 510 SetCapture(); |
504 NOTIMPLEMENTED(); | 511 |
| 512 if (x11_window_move_client_->RunMoveLoop(content_window_, drag_offset) == |
| 513 aura::client::MOVE_SUCCESSFUL) |
| 514 return Widget::MOVE_LOOP_SUCCESSFUL; |
| 515 |
505 return Widget::MOVE_LOOP_CANCELED; | 516 return Widget::MOVE_LOOP_CANCELED; |
506 } | 517 } |
507 | 518 |
508 void DesktopRootWindowHostLinux::EndMoveLoop() { | 519 void DesktopRootWindowHostLinux::EndMoveLoop() { |
509 // TODO(erg): | 520 x11_window_move_client_->EndMoveLoop(); |
510 NOTIMPLEMENTED(); | |
511 } | 521 } |
512 | 522 |
513 void DesktopRootWindowHostLinux::SetVisibilityChangedAnimationsEnabled( | 523 void DesktopRootWindowHostLinux::SetVisibilityChangedAnimationsEnabled( |
514 bool value) { | 524 bool value) { |
515 // TODO(erg): | 525 // TODO(erg): |
516 NOTIMPLEMENTED(); | 526 NOTIMPLEMENTED(); |
517 } | 527 } |
518 | 528 |
519 bool DesktopRootWindowHostLinux::ShouldUseNativeFrame() { | 529 bool DesktopRootWindowHostLinux::ShouldUseNativeFrame() { |
520 return false; | 530 return false; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 1059 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
1050 internal::NativeWidgetDelegate* native_widget_delegate, | 1060 internal::NativeWidgetDelegate* native_widget_delegate, |
1051 DesktopNativeWidgetAura* desktop_native_widget_aura, | 1061 DesktopNativeWidgetAura* desktop_native_widget_aura, |
1052 const gfx::Rect& initial_bounds) { | 1062 const gfx::Rect& initial_bounds) { |
1053 return new DesktopRootWindowHostLinux(native_widget_delegate, | 1063 return new DesktopRootWindowHostLinux(native_widget_delegate, |
1054 desktop_native_widget_aura, | 1064 desktop_native_widget_aura, |
1055 initial_bounds); | 1065 initial_bounds); |
1056 } | 1066 } |
1057 | 1067 |
1058 } // namespace views | 1068 } // namespace views |
OLD | NEW |