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 (
|
request, _ := xgbsel.NewRequest (
|
||||||
requestor { window: window },
|
requestor { window: window },
|
||||||
clipboard,
|
clipboard,
|
||||||
property)
|
property,
|
||||||
|
xproto.TimeCurrentTime)
|
||||||
|
|
||||||
// listen for events
|
// listen for events
|
||||||
window.Listen(xproto.EventMaskPropertyChange)
|
window.Listen(xproto.EventMaskPropertyChange)
|
||||||
|
@ -45,14 +45,19 @@ type Request struct {
|
|||||||
destination xproto.Atom
|
destination xproto.Atom
|
||||||
incrBuffer []byte
|
incrBuffer []byte
|
||||||
incrTarget Target
|
incrTarget Target
|
||||||
|
timestamp xproto.Timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRequest sends a new selection request.
|
// NewRequest sends a new selection request. The timestamp should be set to that
|
||||||
func NewRequest (requestor Requestor, source, destination xproto.Atom) (*Request, error) {
|
// 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 {
|
request := &Request {
|
||||||
source: source,
|
source: source,
|
||||||
destination: destination,
|
destination: destination,
|
||||||
requestor: requestor,
|
requestor: requestor,
|
||||||
|
timestamp: timestamp,
|
||||||
}
|
}
|
||||||
|
|
||||||
targets, err := xprop.Atm(requestor.Window().X, "TARGETS")
|
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
|
// 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
|
// there. The requestor should set the time argument to the timestamp on
|
||||||
// the event that triggered the request for the selection value. Note
|
// 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 (
|
err = xproto.ConvertSelectionChecked (
|
||||||
request.requestor.Window().X.Conn(),
|
request.requestor.Window().X.Conn(),
|
||||||
request.requestor.Window().Id,
|
request.requestor.Window().Id,
|
||||||
request.source,
|
request.source,
|
||||||
target,
|
target,
|
||||||
request.destination,
|
request.destination,
|
||||||
// TODO: *possibly replace this zero with an actual timestamp
|
request.timestamp).Check()
|
||||||
// received from the server. this is non-trivial as we cannot
|
|
||||||
// rely on the timestamp of the last received event.
|
|
||||||
0).Check()
|
|
||||||
if err != nil { request.die(err); return }
|
if err != nil { request.die(err); return }
|
||||||
|
|
||||||
request.state = switchTo
|
request.state = switchTo
|
||||||
|
Loading…
Reference in New Issue
Block a user