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

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
« no previous file with comments | « ui/base/x/events_x.cc ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(), source_window_, PropertyChangeMask);
242 source_window_, PropertyChangeMask);
243 242
244 // 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
245 // |source_window_|. 244 // |source_window_|.
246 XSync(base::MessagePumpX11::GetDefaultXDisplay(), False); 245 XSync(ui::GetXDisplay(), False);
247 } else { 246 } else {
248 // 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
249 // 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
250 // for the data it's offering. 249 // for the data it's offering.
251 fetched_targets_ = client->GetFormatMap(); 250 fetched_targets_ = client->GetFormatMap();
252 unfetched_targets_.clear(); 251 unfetched_targets_.clear();
253 } 252 }
254 253
255 ReadActions(); 254 ReadActions();
256 } 255 }
(...skipping 25 matching lines...) Expand all
282 RequestNextTarget(); 281 RequestNextTarget();
283 } else { 282 } else {
284 client->CompleteXdndPosition(source_window, screen_point); 283 client->CompleteXdndPosition(source_window, screen_point);
285 } 284 }
286 } 285 }
287 286
288 void DesktopDragDropClientAuraX11::X11DragContext::RequestNextTarget() { 287 void DesktopDragDropClientAuraX11::X11DragContext::RequestNextTarget() {
289 ::Atom target = unfetched_targets_.back(); 288 ::Atom target = unfetched_targets_.back();
290 unfetched_targets_.pop_back(); 289 unfetched_targets_.pop_back();
291 290
292 XConvertSelection(base::MessagePumpX11::GetDefaultXDisplay(), 291 XConvertSelection(ui::GetXDisplay(),
293 atom_cache_->GetAtom(kXdndSelection), 292 atom_cache_->GetAtom(kXdndSelection),
294 target, 293 target,
295 atom_cache_->GetAtom(kChromiumDragReciever), 294 atom_cache_->GetAtom(kChromiumDragReciever),
296 local_window_, 295 local_window_,
297 CurrentTime); 296 CurrentTime);
298 } 297 }
299 298
300 void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify( 299 void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify(
301 const XSelectionEvent& event) { 300 const XSelectionEvent& event) {
302 DCHECK(waiting_to_handle_position_); 301 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 913 // 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 914 // to go through normal xlib machinery, but instead passes through the low
916 // level xProto (the x11 wire format) that I don't understand. 915 // level xProto (the x11 wire format) that I don't understand.
917 // 916 //
918 // 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
919 // sufficient. 918 // sufficient.
920 XSendEvent(xdisplay_, xid, False, 0, xev); 919 XSendEvent(xdisplay_, xid, False, 0, xev);
921 } 920 }
922 921
923 } // namespace views 922 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/x/events_x.cc ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698