set CLIPBOARD as well as PRIMARY selection when selecting
This commit is contained in:
1 parent
25e2dc2a96
commit
d55d5855a5
2 files changed
+19
-2
No files matched your search
@@ -27,6 +27,7 @@ pub struct Connection {
|
||||
pub atom_utf8_string: xcb::Atom,
|
||||
pub atom_xsel_data: xcb::Atom,
|
||||
pub atom_targets: xcb::Atom,
|
||||
pub atom_clipboard: xcb::Atom,
|
||||
keysyms: *mut xcb_key_symbols_t,
|
||||
egl_display: Rc<egli::Display>,
|
||||
egl_config: egli::FrameBufferConfigRef,
|
||||
@@ -75,6 +76,9 @@ impl Connection {
|
||||
let atom_targets = xcb::intern_atom(&conn, false, "TARGETS")
|
||||
.get_reply()?
|
||||
.atom();
|
||||
let atom_clipboard = xcb::intern_atom(&conn, false, "CLIPBOARD")
|
||||
.get_reply()?
|
||||
.atom();
|
||||
|
||||
let keysyms = unsafe { xcb_key_symbols_alloc(conn.get_raw_conn()) };
|
||||
|
||||
@@ -108,6 +112,7 @@ impl Connection {
|
||||
conn,
|
||||
screen_num,
|
||||
atom_protocols,
|
||||
atom_clipboard,
|
||||
atom_delete,
|
||||
keysyms,
|
||||
atom_utf8_string,
|
||||
|
||||
+14
-2
@@ -356,6 +356,18 @@ impl<'a> term::TerminalHost for Host<'a> {
|
||||
xcb::ATOM_PRIMARY,
|
||||
self.timestamp,
|
||||
);
|
||||
// Also set the CLIPBOARD atom, not just the PRIMARY selection.
|
||||
// TODO: make xterm clipboard selection configurable
|
||||
xcb::set_selection_owner(
|
||||
conn.conn(),
|
||||
if self.clipboard.is_some() {
|
||||
self.window.as_drawable()
|
||||
} else {
|
||||
xcb::NONE
|
||||
},
|
||||
conn.atom_clipboard,
|
||||
self.timestamp,
|
||||
);
|
||||
|
||||
// TODO: icccm says that we should check that we got ownership and
|
||||
// amend our UI accordingly
|
||||
@@ -1337,13 +1349,13 @@ impl<'a> TerminalWindow<'a> {
|
||||
request.property()
|
||||
);
|
||||
debug!(
|
||||
"XSEL={}, UTF8={} PRIMARY={}",
|
||||
"XSEL={}, UTF8={} PRIMARY={} clip={}",
|
||||
self.conn.atom_xsel_data,
|
||||
self.conn.atom_utf8_string,
|
||||
xcb::ATOM_PRIMARY,
|
||||
self.conn.atom_clipboard,
|
||||
);
|
||||
|
||||
|
||||
// I'd like to use `match` here, but the atom values are not
|
||||
// known at compile time so we have to `if` like a caveman :-p
|
||||
let selprop = if request.target() == self.conn.atom_targets {
|
||||
|
||||
Reference in new issue
Block a user