// The time to wait for the target to respond after the user has released the
// mouse button before ending the move loop.
-const int kEndMoveLoopTimeoutMs = 30000;
+const int kEndMoveLoopTimeoutMs = 1000;
static base::LazyInstance<
std::map< ::Window, views::DesktopDragDropClientAuraX11*> >::Leaky
void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify(
const XSelectionEvent& event) {
- DCHECK(waiting_to_handle_position_);
+ if (!waiting_to_handle_position_) {
+ // A misbehaved window may send SelectionNotify without us requesting data
+ // via XConvertSelection().
+ return;
+ }
DCHECK(drag_drop_client_);
DCHECK_EQ(event.property, atom_cache_->GetAtom(kChromiumDragReciever));
void DesktopDragDropClientAuraX11::OnSelectionNotify(
const XSelectionEvent& xselection) {
- if (!target_current_context_) {
- NOTIMPLEMENTED();
- return;
- }
+ if (target_current_context_)
+ target_current_context_->OnSelectionNotify(xselection);
- target_current_context_->OnSelectionNotify(xselection);
+ // ICCCM requires us to delete the property passed into SelectionNotify.
+ if (xselection.property != None)
+ XDeleteProperty(xdisplay_, xwindow_, xselection.property);
}
int DesktopDragDropClientAuraX11::StartDragAndDrop(
}
void DesktopDragDropClientAuraX11::OnMouseReleased() {
+ if (source_state_ != SOURCE_STATE_OTHER) {
+ // The user has previously released the mouse and is clicking in
+ // frustration.
+ move_loop_.EndMoveLoop();
+ return;
+ }
+
if (source_current_window_ != None) {
if (ContainsKey(waiting_on_status_, source_current_window_)) {
// If we are waiting for an XdndStatus message, we need to wait for it to