From 36b3e4f0ed0a9a0a79f161af70c5c6a190a36121 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 11 Jul 2024 02:07:55 -0400 Subject: [PATCH] Collapse the claim constructors --- v2/claim.go | 17 +++++------------ v2/examples/copy/main.go | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/v2/claim.go b/v2/claim.go index 82fbf95..01b194c 100644 --- a/v2/claim.go +++ b/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 diff --git a/v2/examples/copy/main.go b/v2/examples/copy/main.go index a17e1a1..ba3d421 100644 --- a/v2/examples/copy/main.go +++ b/v2/examples/copy/main.go @@ -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)