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/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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 DesktopDragDropClientAuraX11* client = | 234 DesktopDragDropClientAuraX11* client = |
235 DesktopDragDropClientAuraX11::GetForWindow(source_window_); | 235 DesktopDragDropClientAuraX11::GetForWindow(source_window_); |
236 if (!client) { | 236 if (!client) { |
237 // The window doesn't have a DesktopDragDropClientAuraX11, that means it's | 237 // The window doesn't have a DesktopDragDropClientAuraX11, that means it's |
238 // created by some other process. Listen for messages on it. | 238 // created by some other process. Listen for messages on it. |
239 base::MessagePumpX11::Current()->AddDispatcherForWindow( | 239 base::MessagePumpX11::Current()->AddDispatcherForWindow( |
240 this, source_window_); | 240 this, source_window_); |
241 XSelectInput(ui::GetXDisplay(), source_window_, PropertyChangeMask); | 241 XSelectInput(gfx::GetXDisplay(), source_window_, PropertyChangeMask); |
242 | 242 |
243 // We must perform a full sync here because we could be racing | 243 // We must perform a full sync here because we could be racing |
244 // |source_window_|. | 244 // |source_window_|. |
245 XSync(ui::GetXDisplay(), False); | 245 XSync(gfx::GetXDisplay(), False); |
246 } else { | 246 } else { |
247 // This drag originates from an aura window within our process. This means | 247 // This drag originates from an aura window within our process. This means |
248 // that we can shortcut the X11 server and ask the owning SelectionOwner | 248 // that we can shortcut the X11 server and ask the owning SelectionOwner |
249 // for the data it's offering. | 249 // for the data it's offering. |
250 fetched_targets_ = client->GetFormatMap(); | 250 fetched_targets_ = client->GetFormatMap(); |
251 unfetched_targets_.clear(); | 251 unfetched_targets_.clear(); |
252 } | 252 } |
253 | 253 |
254 ReadActions(); | 254 ReadActions(); |
255 } | 255 } |
(...skipping 25 matching lines...) Expand all Loading... |
281 RequestNextTarget(); | 281 RequestNextTarget(); |
282 } else { | 282 } else { |
283 client->CompleteXdndPosition(source_window, screen_point); | 283 client->CompleteXdndPosition(source_window, screen_point); |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 void DesktopDragDropClientAuraX11::X11DragContext::RequestNextTarget() { | 287 void DesktopDragDropClientAuraX11::X11DragContext::RequestNextTarget() { |
288 ::Atom target = unfetched_targets_.back(); | 288 ::Atom target = unfetched_targets_.back(); |
289 unfetched_targets_.pop_back(); | 289 unfetched_targets_.pop_back(); |
290 | 290 |
291 XConvertSelection(ui::GetXDisplay(), | 291 XConvertSelection(gfx::GetXDisplay(), |
292 atom_cache_->GetAtom(kXdndSelection), | 292 atom_cache_->GetAtom(kXdndSelection), |
293 target, | 293 target, |
294 atom_cache_->GetAtom(kChromiumDragReciever), | 294 atom_cache_->GetAtom(kChromiumDragReciever), |
295 local_window_, | 295 local_window_, |
296 CurrentTime); | 296 CurrentTime); |
297 } | 297 } |
298 | 298 |
299 void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify( | 299 void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify( |
300 const XSelectionEvent& event) { | 300 const XSelectionEvent& event) { |
301 DCHECK(waiting_to_handle_position_); | 301 DCHECK(waiting_to_handle_position_); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 // GdkEvent about the failed drag. (And sending this message doesn't appear | 913 // GdkEvent about the failed drag. (And sending this message doesn't appear |
914 // to go through normal xlib machinery, but instead passes through the low | 914 // to go through normal xlib machinery, but instead passes through the low |
915 // level xProto (the x11 wire format) that I don't understand. | 915 // level xProto (the x11 wire format) that I don't understand. |
916 // | 916 // |
917 // I'm unsure if I have to jump through those hoops, or if XSendEvent is | 917 // I'm unsure if I have to jump through those hoops, or if XSendEvent is |
918 // sufficient. | 918 // sufficient. |
919 XSendEvent(xdisplay_, xid, False, 0, xev); | 919 XSendEvent(xdisplay_, xid, False, 0, xev); |
920 } | 920 } |
921 | 921 |
922 } // namespace views | 922 } // namespace views |
OLD | NEW |