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/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
6 | 6 |
7 #include <X11/extensions/Xfixes.h> | 7 #include <X11/extensions/Xfixes.h> |
8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
9 #include <list> | 9 #include <list> |
10 #include <set> | 10 #include <set> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(SelectionChangeObserver); | 84 DISALLOW_COPY_AND_ASSIGN(SelectionChangeObserver); |
85 }; | 85 }; |
86 | 86 |
87 SelectionChangeObserver::SelectionChangeObserver() | 87 SelectionChangeObserver::SelectionChangeObserver() |
88 : event_base_(-1), | 88 : event_base_(-1), |
89 clipboard_atom_(None), | 89 clipboard_atom_(None), |
90 clipboard_sequence_number_(0), | 90 clipboard_sequence_number_(0), |
91 primary_sequence_number_(0) { | 91 primary_sequence_number_(0) { |
92 int ignored; | 92 int ignored; |
93 if (XFixesQueryExtension(GetXDisplay(), &event_base_, &ignored)) { | 93 if (XFixesQueryExtension(gfx::GetXDisplay(), &event_base_, &ignored)) { |
94 clipboard_atom_ = XInternAtom(GetXDisplay(), kClipboard, false); | 94 clipboard_atom_ = XInternAtom(gfx::GetXDisplay(), kClipboard, false); |
95 XFixesSelectSelectionInput(GetXDisplay(), GetX11RootWindow(), | 95 XFixesSelectSelectionInput(gfx::GetXDisplay(), GetX11RootWindow(), |
96 clipboard_atom_, | 96 clipboard_atom_, |
97 XFixesSetSelectionOwnerNotifyMask | | 97 XFixesSetSelectionOwnerNotifyMask | |
98 XFixesSelectionWindowDestroyNotifyMask | | 98 XFixesSelectionWindowDestroyNotifyMask | |
99 XFixesSelectionClientCloseNotifyMask); | 99 XFixesSelectionClientCloseNotifyMask); |
100 // This seems to be semi-optional. For some reason, registering for any | 100 // This seems to be semi-optional. For some reason, registering for any |
101 // selection notify events seems to subscribe us to events for both the | 101 // selection notify events seems to subscribe us to events for both the |
102 // primary and the clipboard buffers. Register anyway just to be safe. | 102 // primary and the clipboard buffers. Register anyway just to be safe. |
103 XFixesSelectSelectionInput(GetXDisplay(), GetX11RootWindow(), | 103 XFixesSelectSelectionInput(gfx::GetXDisplay(), GetX11RootWindow(), |
104 XA_PRIMARY, | 104 XA_PRIMARY, |
105 XFixesSetSelectionOwnerNotifyMask | | 105 XFixesSetSelectionOwnerNotifyMask | |
106 XFixesSelectionWindowDestroyNotifyMask | | 106 XFixesSelectionWindowDestroyNotifyMask | |
107 XFixesSelectionClientCloseNotifyMask); | 107 XFixesSelectionClientCloseNotifyMask); |
108 | 108 |
109 base::MessagePumpX11::Current()->AddObserver(this); | 109 base::MessagePumpX11::Current()->AddObserver(this); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 SelectionChangeObserver::~SelectionChangeObserver() { | 113 SelectionChangeObserver::~SelectionChangeObserver() { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 SelectionFormatMap clipboard_data_; | 302 SelectionFormatMap clipboard_data_; |
303 | 303 |
304 // Objects which offer selection data to other windows. | 304 // Objects which offer selection data to other windows. |
305 SelectionOwner clipboard_owner_; | 305 SelectionOwner clipboard_owner_; |
306 SelectionOwner primary_owner_; | 306 SelectionOwner primary_owner_; |
307 | 307 |
308 DISALLOW_COPY_AND_ASSIGN(AuraX11Details); | 308 DISALLOW_COPY_AND_ASSIGN(AuraX11Details); |
309 }; | 309 }; |
310 | 310 |
311 Clipboard::AuraX11Details::AuraX11Details() | 311 Clipboard::AuraX11Details::AuraX11Details() |
312 : x_display_(GetXDisplay()), | 312 : x_display_(gfx::GetXDisplay()), |
313 x_root_window_(DefaultRootWindow(x_display_)), | 313 x_root_window_(DefaultRootWindow(x_display_)), |
314 x_window_(XCreateWindow( | 314 x_window_(XCreateWindow( |
315 x_display_, x_root_window_, | 315 x_display_, x_root_window_, |
316 -100, -100, 10, 10, // x, y, width, height | 316 -100, -100, 10, 10, // x, y, width, height |
317 0, // border width | 317 0, // border width |
318 CopyFromParent, // depth | 318 CopyFromParent, // depth |
319 InputOnly, | 319 InputOnly, |
320 CopyFromParent, // visual | 320 CopyFromParent, // visual |
321 0, | 321 0, |
322 NULL)), | 322 NULL)), |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 return type; | 858 return type; |
859 } | 859 } |
860 | 860 |
861 // static | 861 // static |
862 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { | 862 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { |
863 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); | 863 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); |
864 return type; | 864 return type; |
865 } | 865 } |
866 | 866 |
867 } // namespace ui | 867 } // namespace ui |
OLD | NEW |