Chromium Code Reviews| 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/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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 grab_input_window_ = None; | 273 grab_input_window_ = None; |
| 274 | 274 |
| 275 in_move_loop_ = false; | 275 in_move_loop_ = false; |
| 276 quit_closure_.Run(); | 276 quit_closure_.Run(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void X11WholeScreenMoveLoop::SetDragImage(const gfx::ImageSkia& image, | 279 void X11WholeScreenMoveLoop::SetDragImage(const gfx::ImageSkia& image, |
| 280 gfx::Vector2dF offset) { | 280 gfx::Vector2dF offset) { |
| 281 drag_image_ = image; | 281 drag_image_ = image; |
| 282 drag_offset_ = offset; | 282 drag_offset_ = offset; |
| 283 // Reset the Y offset, so that the drag-image is always just below the cursor, | |
|
spartha
2014/06/20 11:19:00
This looks like more of a UX descision. But this c
| |
| 284 // so that it is possible to see where the cursor is going. | |
| 285 drag_offset_.set_y(0.f); | |
| 286 } | 283 } |
| 287 | 284 |
| 288 bool X11WholeScreenMoveLoop::GrabPointerAndKeyboard(gfx::NativeCursor cursor) { | 285 bool X11WholeScreenMoveLoop::GrabPointerAndKeyboard(gfx::NativeCursor cursor) { |
| 289 XDisplay* display = gfx::GetXDisplay(); | 286 XDisplay* display = gfx::GetXDisplay(); |
| 290 XGrabServer(display); | 287 XGrabServer(display); |
| 291 | 288 |
| 292 XUngrabPointer(display, CurrentTime); | 289 XUngrabPointer(display, CurrentTime); |
| 293 int ret = XGrabPointer( | 290 int ret = XGrabPointer( |
| 294 display, | 291 display, |
| 295 grab_input_window_, | 292 grab_input_window_, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 for (int x = 0; x < in_bitmap->width(); ++x) { | 381 for (int x = 0; x < in_bitmap->width(); ++x) { |
| 385 if (SkColorGetA(in_row[x]) > kMinAlpha) | 382 if (SkColorGetA(in_row[x]) > kMinAlpha) |
| 386 return true; | 383 return true; |
| 387 } | 384 } |
| 388 } | 385 } |
| 389 | 386 |
| 390 return false; | 387 return false; |
| 391 } | 388 } |
| 392 | 389 |
| 393 } // namespace views | 390 } // namespace views |
| OLD | NEW |