Collapse the claim constructors
This commit is contained in:
parent
d9d84ddada
commit
36b3e4f0ed
17
v2/claim.go
17
v2/claim.go
@ -16,18 +16,11 @@ type Claim struct {
|
||||
}
|
||||
|
||||
// NewClaim claims ownership of a specified selection, and allows using data
|
||||
// passed to it to fulfill requests for the selection's contents. If the claim
|
||||
// happens because of a user input event, use NewClaimWithTimestamp instead of
|
||||
// this function. See the documentation of NewClaimWithTimestamp for details.
|
||||
func NewClaim (window *xwindow.Window, selection xproto.Atom, data Data) *Claim {
|
||||
return NewClaimWithTimestamp(window, selection, data, 0)
|
||||
}
|
||||
|
||||
// NewClaimWithTimestamp claims ownership of a specified selection, and allows
|
||||
// using data passed to it to fulfill requests for the selection's contents. The
|
||||
// timestamp should be set to that of the event that triggered the claim, such
|
||||
// as a Ctrl+C event, or a mouse motion that led to text being selected.
|
||||
func NewClaimWithTimestamp (window *xwindow.Window, selection xproto.Atom, data Data, timestamp xproto.Timestamp) *Claim {
|
||||
// passed to it to fulfill requests for the selection's contents. The timestamp
|
||||
// should be set to that of the event that triggered the claim, such as a Ctrl+C
|
||||
// event, or a mouse motion that led to text being selected. If the claim was
|
||||
// not triggered by an event, specify xproto.TimeCurrentTime.
|
||||
func NewClaim (window *xwindow.Window, selection xproto.Atom, data Data, timestamp xproto.Timestamp) *Claim {
|
||||
// Follow:
|
||||
// https://tronche.com/gui/x/icccm/sec-2.html#s-2.1
|
||||
|
||||
|
@ -62,7 +62,7 @@ func main () {
|
||||
// obtain claim on CLIPBOARD
|
||||
log.Println("obtaining claim")
|
||||
clipboard, _ := xprop.Atm(X, "CLIPBOARD")
|
||||
claim := xgbsel.NewClaim(window, clipboard, data)
|
||||
claim := xgbsel.NewClaim(window, clipboard, data, xproto.TimeCurrentTime)
|
||||
|
||||
// listen for events
|
||||
window.Listen(xproto.EventMaskPropertyChange)
|
||||
|
Loading…
Reference in New Issue
Block a user