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_aurax11.h" | 5 #include "ui/base/clipboard/clipboard_aurax11.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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // Clears a certain clipboard type, whether we own it or not. | 284 // Clears a certain clipboard type, whether we own it or not. |
285 void Clear(ClipboardType type); | 285 void Clear(ClipboardType type); |
286 | 286 |
287 // If we own the CLIPBOARD selection, requests the clipboard manager to take | 287 // If we own the CLIPBOARD selection, requests the clipboard manager to take |
288 // ownership of it. | 288 // ownership of it. |
289 void StoreCopyPasteDataAndWait(); | 289 void StoreCopyPasteDataAndWait(); |
290 | 290 |
291 private: | 291 private: |
292 // PlatformEventDispatcher: | 292 // PlatformEventDispatcher: |
293 virtual bool CanDispatchEvent(const PlatformEvent& event) override; | 293 virtual bool CanDispatchEvent(const PlatformEvent& event) override; |
294 virtual uint32_t DispatchEvent(const PlatformEvent& event) override; | 294 virtual ui::PostDispatchAction DispatchEvent( |
| 295 const PlatformEvent& event) override; |
295 | 296 |
296 // Our X11 state. | 297 // Our X11 state. |
297 Display* x_display_; | 298 Display* x_display_; |
298 ::Window x_root_window_; | 299 ::Window x_root_window_; |
299 | 300 |
300 // Input-only window used as a selection owner. | 301 // Input-only window used as a selection owner. |
301 ::Window x_window_; | 302 ::Window x_window_; |
302 | 303 |
303 X11AtomCache atom_cache_; | 304 X11AtomCache atom_cache_; |
304 | 305 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 return true; | 523 return true; |
523 | 524 |
524 if (event->type == PropertyNotify) { | 525 if (event->type == PropertyNotify) { |
525 return primary_owner_.CanDispatchPropertyEvent(*event) || | 526 return primary_owner_.CanDispatchPropertyEvent(*event) || |
526 clipboard_owner_.CanDispatchPropertyEvent(*event) || | 527 clipboard_owner_.CanDispatchPropertyEvent(*event) || |
527 selection_requestor_.CanDispatchPropertyEvent(*event); | 528 selection_requestor_.CanDispatchPropertyEvent(*event); |
528 } | 529 } |
529 return false; | 530 return false; |
530 } | 531 } |
531 | 532 |
532 uint32_t ClipboardAuraX11::AuraX11Details::DispatchEvent( | 533 ui::PostDispatchAction ClipboardAuraX11::AuraX11Details::DispatchEvent( |
533 const PlatformEvent& xev) { | 534 const PlatformEvent& xev) { |
534 switch (xev->type) { | 535 switch (xev->type) { |
535 case SelectionRequest: { | 536 case SelectionRequest: { |
536 if (xev->xselectionrequest.selection == XA_PRIMARY) { | 537 if (xev->xselectionrequest.selection == XA_PRIMARY) { |
537 primary_owner_.OnSelectionRequest(*xev); | 538 primary_owner_.OnSelectionRequest(*xev); |
538 } else { | 539 } else { |
539 // We should not get requests for the CLIPBOARD_MANAGER selection | 540 // We should not get requests for the CLIPBOARD_MANAGER selection |
540 // because we never take ownership of it. | 541 // because we never take ownership of it. |
541 DCHECK_EQ(GetCopyPasteSelection(), xev->xselectionrequest.selection); | 542 DCHECK_EQ(GetCopyPasteSelection(), xev->xselectionrequest.selection); |
542 clipboard_owner_.OnSelectionRequest(*xev); | 543 clipboard_owner_.OnSelectionRequest(*xev); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 if (format.Equals(GetBitmapFormatType())) | 930 if (format.Equals(GetBitmapFormatType())) |
930 return; | 931 return; |
931 | 932 |
932 std::vector<unsigned char> bytes(data_data, data_data + data_len); | 933 std::vector<unsigned char> bytes(data_data, data_data + data_len); |
933 scoped_refptr<base::RefCountedMemory> mem( | 934 scoped_refptr<base::RefCountedMemory> mem( |
934 base::RefCountedBytes::TakeVector(&bytes)); | 935 base::RefCountedBytes::TakeVector(&bytes)); |
935 aurax11_details_->InsertMapping(format.ToString(), mem); | 936 aurax11_details_->InsertMapping(format.ToString(), mem); |
936 } | 937 } |
937 | 938 |
938 } // namespace ui | 939 } // namespace ui |
OLD | NEW |