We now set the target atom properly

This commit is contained in:
2023-03-28 01:00:54 -04:00
parent 01a0fc1bd3
commit 6f15ff3366
4 changed files with 40 additions and 7 deletions

View File

@@ -245,7 +245,17 @@ func (window *window) handleSelectionNotify (
// Follow:
// https://tronche.com/gui/x/icccm/sec-2.html#s-2.4
if window.selectionRequest == nil { return }
die := func (err error) { window.selectionRequest(nil, err) }
die := func (err error) {
window.selectionRequest(nil, err)
window.selectionRequest = nil
}
// If the property argument is None, the conversion has been refused.
// This can mean either that there is no owner for the selection, that
// the owner does not support the conversion implied by the target, or
// that the server did not have sufficient space to accommodate the
// data.
if event.Property == 0 { die(nil); return }
// When using GetProperty to retrieve the value of a selection, the
// property argument should be set to the corresponding value in the

View File

@@ -290,7 +290,10 @@ func (window *window) Paste (accept data.Mime, callback func (io.Reader, error))
// Follow:
// https://tronche.com/gui/x/icccm/sec-2.html#s-2.4
die := func (err error) { callback(nil, err) }
die := func (err error) {
window.selectionRequest = nil
callback(nil, err)
}
if window.selectionRequest != nil {
// TODO: add the request to a queue and take care of it when the
// current selection has completed
@@ -299,8 +302,10 @@ func (window *window) Paste (accept data.Mime, callback func (io.Reader, error))
selectionName := "CLIPBOARD"
propertyName := "TOMO_SELECTION"
// TODO: change based on mime type
targetName := "TEXT"
targetName := accept.String()
if accept == data.M("text", "plain") {
targetName = "UTF8_STRING"
}
// get atoms
selectionAtom, err := xprop.Atm(window.backend.connection, selectionName)