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 | 8 |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura/window_tree_host.h" | 14 #include "ui/aura/window_tree_host.h" |
15 #include "ui/base/x/x11_util.h" | 15 #include "ui/base/x/x11_util.h" |
16 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 | 19 |
20 X11DesktopWindowMoveClient::X11DesktopWindowMoveClient() | 20 X11DesktopWindowMoveClient::X11DesktopWindowMoveClient() |
21 : move_loop_(this), | 21 : move_loop_(this), |
22 host_(NULL) { | 22 host_(NULL) { |
23 } | 23 } |
24 | 24 |
25 X11DesktopWindowMoveClient::~X11DesktopWindowMoveClient() {} | 25 X11DesktopWindowMoveClient::~X11DesktopWindowMoveClient() {} |
26 | 26 |
27 void X11DesktopWindowMoveClient::OnMouseMovement( | 27 void X11DesktopWindowMoveClient::OnMouseMovement(const gfx::Point& screen_point, |
28 const gfx::Point& screen_point, | 28 int flags, |
29 int flags, | 29 base::TimeTicks event_time) { |
30 base::TimeDelta event_time) { | |
31 gfx::Point system_loc = screen_point - window_offset_; | 30 gfx::Point system_loc = screen_point - window_offset_; |
32 host_->SetBounds(gfx::Rect(system_loc, host_->GetBounds().size())); | 31 host_->SetBounds(gfx::Rect(system_loc, host_->GetBounds().size())); |
33 } | 32 } |
34 | 33 |
35 void X11DesktopWindowMoveClient::OnMouseReleased() { | 34 void X11DesktopWindowMoveClient::OnMouseReleased() { |
36 EndMoveLoop(); | 35 EndMoveLoop(); |
37 } | 36 } |
38 | 37 |
39 void X11DesktopWindowMoveClient::OnMoveLoopEnded() { | 38 void X11DesktopWindowMoveClient::OnMoveLoopEnded() { |
40 host_ = NULL; | 39 host_ = NULL; |
(...skipping 12 matching lines...) Expand all Loading... |
53 source->SetCapture(); | 52 source->SetCapture(); |
54 bool success = move_loop_.RunMoveLoop(source, host_->last_cursor()); | 53 bool success = move_loop_.RunMoveLoop(source, host_->last_cursor()); |
55 return success ? aura::client::MOVE_SUCCESSFUL : aura::client::MOVE_CANCELED; | 54 return success ? aura::client::MOVE_SUCCESSFUL : aura::client::MOVE_CANCELED; |
56 } | 55 } |
57 | 56 |
58 void X11DesktopWindowMoveClient::EndMoveLoop() { | 57 void X11DesktopWindowMoveClient::EndMoveLoop() { |
59 move_loop_.EndMoveLoop(); | 58 move_loop_.EndMoveLoop(); |
60 } | 59 } |
61 | 60 |
62 } // namespace views | 61 } // namespace views |
OLD | NEW |