Selection requests now take in a timestamp
This commit is contained in:
parent
991d74f365
commit
181583dc57
@ -82,7 +82,8 @@ func main () {
|
||||
request, _ := xgbsel.NewRequest (
|
||||
requestor { window: window },
|
||||
clipboard,
|
||||
property)
|
||||
property,
|
||||
xproto.TimeCurrentTime)
|
||||
|
||||
// listen for events
|
||||
window.Listen(xproto.EventMaskPropertyChange)
|
||||
|
@ -45,14 +45,19 @@ type Request struct {
|
||||
destination xproto.Atom
|
||||
incrBuffer []byte
|
||||
incrTarget Target
|
||||
timestamp xproto.Timestamp
|
||||
}
|
||||
|
||||
// NewRequest sends a new selection request.
|
||||
func NewRequest (requestor Requestor, source, destination xproto.Atom) (*Request, error) {
|
||||
// NewRequest sends a new selection request. The timestamp should be set to that
|
||||
// of the event that triggered the request, such as a Ctrl+V event, or a mouse
|
||||
// button event that led to text being pasted. If the claim was not triggered by
|
||||
// an event, and *only* in this scenario, specify xproto.TimeCurrentTime.
|
||||
func NewRequest (requestor Requestor, source, destination xproto.Atom, timestamp xproto.Timestamp) (*Request, error) {
|
||||
request := &Request {
|
||||
source: source,
|
||||
destination: destination,
|
||||
requestor: requestor,
|
||||
timestamp: timestamp,
|
||||
}
|
||||
|
||||
targets, err := xprop.Atm(requestor.Window().X, "TARGETS")
|
||||
@ -86,17 +91,14 @@ func (request *Request) convertSelection (target xproto.Atom, switchTo selReqSta
|
||||
// to a window that it created; the owner will place the reply property
|
||||
// there. The requestor should set the time argument to the timestamp on
|
||||
// the event that triggered the request for the selection value. Note
|
||||
// that clients should not specify CurrentTime*.
|
||||
// that clients should not specify CurrentTime.
|
||||
err = xproto.ConvertSelectionChecked (
|
||||
request.requestor.Window().X.Conn(),
|
||||
request.requestor.Window().Id,
|
||||
request.source,
|
||||
target,
|
||||
request.destination,
|
||||
// TODO: *possibly replace this zero with an actual timestamp
|
||||
// received from the server. this is non-trivial as we cannot
|
||||
// rely on the timestamp of the last received event.
|
||||
0).Check()
|
||||
request.timestamp).Check()
|
||||
if err != nil { request.die(err); return }
|
||||
|
||||
request.state = switchTo
|
||||
|
Loading…
Reference in New Issue
Block a user