| 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_whole_screen_move_loop.h" | 5 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h" |
| 6 | 6 |
| 7 #include <X11/keysym.h> | 7 #include <X11/keysym.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 XEvent* xev = event; | 74 XEvent* xev = event; |
| 75 ui::EventType type = ui::EventTypeFromNative(xev); | 75 ui::EventType type = ui::EventTypeFromNative(xev); |
| 76 switch (type) { | 76 switch (type) { |
| 77 case ui::ET_MOUSE_MOVED: | 77 case ui::ET_MOUSE_MOVED: |
| 78 case ui::ET_MOUSE_DRAGGED: { | 78 case ui::ET_MOUSE_DRAGGED: { |
| 79 bool dispatch_mouse_event = !last_motion_in_screen_.get(); | 79 bool dispatch_mouse_event = !last_motion_in_screen_.get(); |
| 80 last_motion_in_screen_.reset( | 80 last_motion_in_screen_.reset( |
| 81 static_cast<ui::MouseEvent*>(ui::EventFromNative(xev).release())); | 81 static_cast<ui::MouseEvent*>(ui::EventFromNative(xev).release())); |
| 82 last_motion_in_screen_->set_location( | 82 last_motion_in_screen_->set_location( |
| 83 ui::EventSystemLocationFromNative(xev)); | 83 gfx::PointF(ui::EventSystemLocationFromNative(xev))); |
| 84 if (dispatch_mouse_event) { | 84 if (dispatch_mouse_event) { |
| 85 // Post a task to dispatch mouse movement event when control returns to | 85 // Post a task to dispatch mouse movement event when control returns to |
| 86 // the message loop. This allows smoother dragging since the events are | 86 // the message loop. This allows smoother dragging since the events are |
| 87 // dispatched without waiting for the drag widget updates. | 87 // dispatched without waiting for the drag widget updates. |
| 88 base::MessageLoopForUI::current()->PostTask( | 88 base::MessageLoopForUI::current()->PostTask( |
| 89 FROM_HERE, | 89 FROM_HERE, |
| 90 base::Bind(&X11WholeScreenMoveLoop::DispatchMouseMovement, | 90 base::Bind(&X11WholeScreenMoveLoop::DispatchMouseMovement, |
| 91 weak_factory_.GetWeakPtr())); | 91 weak_factory_.GetWeakPtr())); |
| 92 } | 92 } |
| 93 return ui::POST_DISPATCH_NONE; | 93 return ui::POST_DISPATCH_NONE; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 DefaultRootWindow(display), | 266 DefaultRootWindow(display), |
| 267 -100, -100, 10, 10, | 267 -100, -100, 10, 10, |
| 268 0, CopyFromParent, InputOnly, CopyFromParent, | 268 0, CopyFromParent, InputOnly, CopyFromParent, |
| 269 attribute_mask, &swa); | 269 attribute_mask, &swa); |
| 270 XMapRaised(display, window); | 270 XMapRaised(display, window); |
| 271 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(window); | 271 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(window); |
| 272 return window; | 272 return window; |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace views | 275 } // namespace views |
| OLD | NEW |