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

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

Issue 23622035: x11: Prefer using ui::GetXDisplay() over getting the Display from the X11 message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/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
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(base::MessagePumpX11::GetDefaultXDisplay(), 241 XSelectInput(ui::GetXDisplay(),
242 source_window_, PropertyChangeMask); 242 source_window_, PropertyChangeMask);
oshima 2013/09/17 15:05:10 ditto
sadrul 2013/09/17 15:28:44 Done.
243 243
244 // We must perform a full sync here because we could be racing 244 // We must perform a full sync here because we could be racing
245 // |source_window_|. 245 // |source_window_|.
246 XSync(base::MessagePumpX11::GetDefaultXDisplay(), False); 246 XSync(ui::GetXDisplay(), False);
247 } else { 247 } else {
248 // This drag originates from an aura window within our process. This means 248 // This drag originates from an aura window within our process. This means
249 // that we can shortcut the X11 server and ask the owning SelectionOwner 249 // that we can shortcut the X11 server and ask the owning SelectionOwner
250 // for the data it's offering. 250 // for the data it's offering.
251 fetched_targets_ = client->GetFormatMap(); 251 fetched_targets_ = client->GetFormatMap();
252 unfetched_targets_.clear(); 252 unfetched_targets_.clear();
253 } 253 }
254 254
255 ReadActions(); 255 ReadActions();
256 } 256 }
(...skipping 25 matching lines...) Expand all
282 RequestNextTarget(); 282 RequestNextTarget();
283 } else { 283 } else {
284 client->CompleteXdndPosition(source_window, screen_point); 284 client->CompleteXdndPosition(source_window, screen_point);
285 } 285 }
286 } 286 }
287 287
288 void DesktopDragDropClientAuraX11::X11DragContext::RequestNextTarget() { 288 void DesktopDragDropClientAuraX11::X11DragContext::RequestNextTarget() {
289 ::Atom target = unfetched_targets_.back(); 289 ::Atom target = unfetched_targets_.back();
290 unfetched_targets_.pop_back(); 290 unfetched_targets_.pop_back();
291 291
292 XConvertSelection(base::MessagePumpX11::GetDefaultXDisplay(), 292 XConvertSelection(ui::GetXDisplay(),
293 atom_cache_->GetAtom(kXdndSelection), 293 atom_cache_->GetAtom(kXdndSelection),
294 target, 294 target,
295 atom_cache_->GetAtom(kChromiumDragReciever), 295 atom_cache_->GetAtom(kChromiumDragReciever),
296 local_window_, 296 local_window_,
297 CurrentTime); 297 CurrentTime);
298 } 298 }
299 299
300 void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify( 300 void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify(
301 const XSelectionEvent& event) { 301 const XSelectionEvent& event) {
302 DCHECK(waiting_to_handle_position_); 302 DCHECK(waiting_to_handle_position_);
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 // GdkEvent about the failed drag. (And sending this message doesn't appear 914 // GdkEvent about the failed drag. (And sending this message doesn't appear
915 // to go through normal xlib machinery, but instead passes through the low 915 // to go through normal xlib machinery, but instead passes through the low
916 // level xProto (the x11 wire format) that I don't understand. 916 // level xProto (the x11 wire format) that I don't understand.
917 // 917 //
918 // I'm unsure if I have to jump through those hoops, or if XSendEvent is 918 // I'm unsure if I have to jump through those hoops, or if XSendEvent is
919 // sufficient. 919 // sufficient.
920 XSendEvent(xdisplay_, xid, False, 0, xev); 920 XSendEvent(xdisplay_, xid, False, 0, xev);
921 } 921 }
922 922
923 } // namespace views 923 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698