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 "remoting/host/linux/x_server_clipboard.h" | 5 #include "remoting/host/linux/x_server_clipboard.h" |
6 | 6 |
7 #include <X11/extensions/Xfixes.h> | 7 #include <X11/extensions/Xfixes.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/logging.h" | |
12 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
| 12 #include "remoting/base/logging.h" |
13 #include "remoting/base/util.h" | 13 #include "remoting/base/util.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 XServerClipboard::XServerClipboard() | 17 XServerClipboard::XServerClipboard() |
18 : display_(NULL), | 18 : display_(NULL), |
19 clipboard_window_(BadValue), | 19 clipboard_window_(BadValue), |
20 xfixes_event_base_(-1), | 20 xfixes_event_base_(-1), |
21 clipboard_atom_(None), | 21 clipboard_atom_(None), |
22 large_selection_atom_(None), | 22 large_selection_atom_(None), |
(...skipping 16 matching lines...) Expand all Loading... |
39 // process. This is unlikely to occur in practice, and even if it does, it | 39 // process. This is unlikely to occur in practice, and even if it does, it |
40 // would mean the X server is in a bad state, so it's not worth trying to | 40 // would mean the X server is in a bad state, so it's not worth trying to |
41 // trap such errors here. | 41 // trap such errors here. |
42 | 42 |
43 // TODO(lambroslambrou): Consider using ScopedXErrorHandler here, or consider | 43 // TODO(lambroslambrou): Consider using ScopedXErrorHandler here, or consider |
44 // placing responsibility for handling X Errors outside this class, since | 44 // placing responsibility for handling X Errors outside this class, since |
45 // X Error handlers are global to all X connections. | 45 // X Error handlers are global to all X connections. |
46 int xfixes_error_base; | 46 int xfixes_error_base; |
47 if (!XFixesQueryExtension(display_, &xfixes_event_base_, | 47 if (!XFixesQueryExtension(display_, &xfixes_event_base_, |
48 &xfixes_error_base)) { | 48 &xfixes_error_base)) { |
49 LOG(INFO) << "X server does not support XFixes."; | 49 HOST_LOG << "X server does not support XFixes."; |
50 return; | 50 return; |
51 } | 51 } |
52 | 52 |
53 clipboard_window_ = XCreateSimpleWindow(display_, | 53 clipboard_window_ = XCreateSimpleWindow(display_, |
54 DefaultRootWindow(display_), | 54 DefaultRootWindow(display_), |
55 0, 0, 1, 1, // x, y, width, height | 55 0, 0, 1, 1, // x, y, width, height |
56 0, 0, 0); | 56 0, 0, 0); |
57 | 57 |
58 // TODO(lambroslambrou): Use ui::X11AtomCache for this, either by adding a | 58 // TODO(lambroslambrou): Use ui::X11AtomCache for this, either by adding a |
59 // dependency on ui/ or by moving X11AtomCache to base/. | 59 // dependency on ui/ or by moving X11AtomCache to base/. |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } else { | 366 } else { |
367 LOG(ERROR) << "XSetSelectionOwner failed for selection " << selection; | 367 LOG(ERROR) << "XSetSelectionOwner failed for selection " << selection; |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
371 bool XServerClipboard::IsSelectionOwner(Atom selection) { | 371 bool XServerClipboard::IsSelectionOwner(Atom selection) { |
372 return selections_owned_.find(selection) != selections_owned_.end(); | 372 return selections_owned_.find(selection) != selections_owned_.end(); |
373 } | 373 } |
374 | 374 |
375 } // namespace remoting | 375 } // namespace remoting |
OLD | NEW |