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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <X11/extensions/Xfixes.h> | 8 #include <X11/extensions/Xfixes.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <map> | 10 #include <map> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(SelectionChangeObserver); | 56 DISALLOW_COPY_AND_ASSIGN(SelectionChangeObserver); |
57 }; | 57 }; |
58 | 58 |
59 SelectionChangeObserver::SelectionChangeObserver() | 59 SelectionChangeObserver::SelectionChangeObserver() |
60 : event_base_(-1), | 60 : event_base_(-1), |
61 clipboard_atom_(None), | 61 clipboard_atom_(None), |
62 clipboard_sequence_number_(0), | 62 clipboard_sequence_number_(0), |
63 primary_sequence_number_(0) { | 63 primary_sequence_number_(0) { |
64 int ignored; | 64 int ignored; |
65 if (XFixesQueryExtension(GetXDisplay(), &event_base_, &ignored)) { | 65 if (XFixesQueryExtension(gfx::GetXDisplay(), &event_base_, &ignored)) { |
66 clipboard_atom_ = XInternAtom(GetXDisplay(), "CLIPBOARD", false); | 66 clipboard_atom_ = XInternAtom(gfx::GetXDisplay(), "CLIPBOARD", false); |
67 XFixesSelectSelectionInput(GetXDisplay(), GetX11RootWindow(), | 67 XFixesSelectSelectionInput(gfx::GetXDisplay(), GetX11RootWindow(), |
68 clipboard_atom_, | 68 clipboard_atom_, |
69 XFixesSetSelectionOwnerNotifyMask | | 69 XFixesSetSelectionOwnerNotifyMask | |
70 XFixesSelectionWindowDestroyNotifyMask | | 70 XFixesSelectionWindowDestroyNotifyMask | |
71 XFixesSelectionClientCloseNotifyMask); | 71 XFixesSelectionClientCloseNotifyMask); |
72 // This seems to be semi-optional. For some reason, registering for any | 72 // This seems to be semi-optional. For some reason, registering for any |
73 // selection notify events seems to subscribe us to events for both the | 73 // selection notify events seems to subscribe us to events for both the |
74 // primary and the clipboard buffers. Register anyway just to be safe. | 74 // primary and the clipboard buffers. Register anyway just to be safe. |
75 XFixesSelectSelectionInput(GetXDisplay(), GetX11RootWindow(), | 75 XFixesSelectSelectionInput(gfx::GetXDisplay(), GetX11RootWindow(), |
76 XA_PRIMARY, | 76 XA_PRIMARY, |
77 XFixesSetSelectionOwnerNotifyMask | | 77 XFixesSetSelectionOwnerNotifyMask | |
78 XFixesSelectionWindowDestroyNotifyMask | | 78 XFixesSelectionWindowDestroyNotifyMask | |
79 XFixesSelectionClientCloseNotifyMask); | 79 XFixesSelectionClientCloseNotifyMask); |
80 gdk_window_add_filter(NULL, &SelectionChangeObserver::OnXEventThunk, this); | 80 gdk_window_add_filter(NULL, &SelectionChangeObserver::OnXEventThunk, this); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 SelectionChangeObserver::~SelectionChangeObserver() { | 84 SelectionChangeObserver::~SelectionChangeObserver() { |
85 } | 85 } |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 return clipboard_; | 673 return clipboard_; |
674 case BUFFER_SELECTION: | 674 case BUFFER_SELECTION: |
675 return primary_selection_; | 675 return primary_selection_; |
676 default: | 676 default: |
677 NOTREACHED(); | 677 NOTREACHED(); |
678 return NULL; | 678 return NULL; |
679 } | 679 } |
680 } | 680 } |
681 | 681 |
682 } // namespace ui | 682 } // namespace ui |
OLD | NEW |