Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc

Issue 455553003: Do not release capture when starting a move loop on Desktop Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/desktop_drag_drop_client_aurax11.h" 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 8
9 #include "base/event_types.h" 9 #include "base/event_types.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/aura/client/capture_client.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/aura/window_tree_host.h" 15 #include "ui/aura/window_tree_host.h"
15 #include "ui/base/clipboard/clipboard.h" 16 #include "ui/base/clipboard/clipboard.h"
16 #include "ui/base/dragdrop/drop_target_event.h" 17 #include "ui/base/dragdrop/drop_target_event.h"
17 #include "ui/base/dragdrop/os_exchange_data.h" 18 #include "ui/base/dragdrop/os_exchange_data.h"
18 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" 19 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h"
19 #include "ui/base/x/selection_utils.h" 20 #include "ui/base/x/selection_utils.h"
20 #include "ui/base/x/x11_foreign_window_manager.h" 21 #include "ui/base/x/x11_foreign_window_manager.h"
21 #include "ui/base/x/x11_util.h" 22 #include "ui/base/x/x11_util.h"
22 #include "ui/events/event.h" 23 #include "ui/events/event.h"
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 source_provider_->file_contents_name().AsUTF8Unsafe()); 634 source_provider_->file_contents_name().AsUTF8Unsafe());
634 } 635 }
635 ui::SetAtomArrayProperty(xwindow_, "XdndActionList", "ATOM", actions); 636 ui::SetAtomArrayProperty(xwindow_, "XdndActionList", "ATOM", actions);
636 637
637 gfx::ImageSkia drag_image = source_provider_->GetDragImage(); 638 gfx::ImageSkia drag_image = source_provider_->GetDragImage();
638 if (IsValidDragImage(drag_image)) { 639 if (IsValidDragImage(drag_image)) {
639 CreateDragWidget(drag_image); 640 CreateDragWidget(drag_image);
640 drag_widget_offset_ = source_provider_->GetDragImageOffset(); 641 drag_widget_offset_ = source_provider_->GetDragImageOffset();
641 } 642 }
642 643
644 // Chrome expects starting drag and drop to release capture.
645 aura::Window* capture_window =
646 aura::client::GetCaptureClient(root_window)->GetGlobalCaptureWindow();
647 if (capture_window)
648 capture_window->ReleaseCapture();
649
643 // It is possible for the DesktopWindowTreeHostX11 to be destroyed during the 650 // It is possible for the DesktopWindowTreeHostX11 to be destroyed during the
644 // move loop, which would also destroy this drag-client. So keep track of 651 // move loop, which would also destroy this drag-client. So keep track of
645 // whether it is alive after the drag ends. 652 // whether it is alive after the drag ends.
646 base::WeakPtr<DesktopDragDropClientAuraX11> alive( 653 base::WeakPtr<DesktopDragDropClientAuraX11> alive(
647 weak_ptr_factory_.GetWeakPtr()); 654 weak_ptr_factory_.GetWeakPtr());
648 655
649 // Windows has a specific method, DoDragDrop(), which performs the entire 656 // Windows has a specific method, DoDragDrop(), which performs the entire
650 // drag. We have to emulate this, so we spin off a nested runloop which will 657 // drag. We have to emulate this, so we spin off a nested runloop which will
651 // track all cursor movement and reroute events to a specific handler. 658 // track all cursor movement and reroute events to a specific handler.
652 move_loop_->RunMoveLoop(source_window, grab_cursor_); 659 move_loop_->RunMoveLoop(source_window, grab_cursor_);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 for (int x = 0; x < in_bitmap->width(); ++x) { 1128 for (int x = 0; x < in_bitmap->width(); ++x) {
1122 if (SkColorGetA(in_row[x]) > kMinAlpha) 1129 if (SkColorGetA(in_row[x]) > kMinAlpha)
1123 return true; 1130 return true;
1124 } 1131 }
1125 } 1132 }
1126 1133
1127 return false; 1134 return false;
1128 } 1135 }
1129 1136
1130 } // namespace views 1137 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698