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/x11_desktop_window_move_client.h" | 5 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 8 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
9 #undef RootWindow | 9 #undef RootWindow |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 X11DesktopWindowMoveClient::~X11DesktopWindowMoveClient() {} | 28 X11DesktopWindowMoveClient::~X11DesktopWindowMoveClient() {} |
29 | 29 |
30 void X11DesktopWindowMoveClient::OnMouseMovement(XMotionEvent* event) { | 30 void X11DesktopWindowMoveClient::OnMouseMovement(XMotionEvent* event) { |
31 gfx::Point cursor_point(event->x_root, event->y_root); | 31 gfx::Point cursor_point(event->x_root, event->y_root); |
32 gfx::Point system_loc = cursor_point - window_offset_; | 32 gfx::Point system_loc = cursor_point - window_offset_; |
33 root_window_->SetHostBounds(gfx::Rect( | 33 root_window_->SetHostBounds(gfx::Rect( |
34 system_loc, root_window_->GetHostSize())); | 34 system_loc, root_window_->GetHostSize())); |
35 } | 35 } |
36 | 36 |
| 37 void X11DesktopWindowMoveClient::OnMouseReleased() { |
| 38 EndMoveLoop(); |
| 39 } |
| 40 |
37 void X11DesktopWindowMoveClient::OnMoveLoopEnded() { | 41 void X11DesktopWindowMoveClient::OnMoveLoopEnded() { |
38 root_window_ = NULL; | 42 root_window_ = NULL; |
39 } | 43 } |
40 | 44 |
41 //////////////////////////////////////////////////////////////////////////////// | 45 //////////////////////////////////////////////////////////////////////////////// |
42 // DesktopRootWindowHostLinux, aura::client::WindowMoveClient implementation: | 46 // DesktopRootWindowHostLinux, aura::client::WindowMoveClient implementation: |
43 | 47 |
44 aura::client::WindowMoveResult X11DesktopWindowMoveClient::RunMoveLoop( | 48 aura::client::WindowMoveResult X11DesktopWindowMoveClient::RunMoveLoop( |
45 aura::Window* source, | 49 aura::Window* source, |
46 const gfx::Vector2d& drag_offset, | 50 const gfx::Vector2d& drag_offset, |
47 aura::client::WindowMoveSource move_source) { | 51 aura::client::WindowMoveSource move_source) { |
48 window_offset_ = drag_offset; | 52 window_offset_ = drag_offset; |
49 root_window_ = source->GetRootWindow(); | 53 root_window_ = source->GetRootWindow(); |
50 | 54 |
51 bool success = move_loop_.RunMoveLoop(source); | 55 bool success = move_loop_.RunMoveLoop(source); |
52 return success ? aura::client::MOVE_SUCCESSFUL : aura::client::MOVE_CANCELED; | 56 return success ? aura::client::MOVE_SUCCESSFUL : aura::client::MOVE_CANCELED; |
53 } | 57 } |
54 | 58 |
55 void X11DesktopWindowMoveClient::EndMoveLoop() { | 59 void X11DesktopWindowMoveClient::EndMoveLoop() { |
56 move_loop_.EndMoveLoop(); | 60 move_loop_.EndMoveLoop(); |
57 } | 61 } |
58 | 62 |
59 } // namespace views | 63 } // namespace views |
OLD | NEW |