Added a Prune method to Claim
This commit is contained in:
parent
58030b530e
commit
534a8fd0ad
19
v2/claim.go
19
v2/claim.go
@ -21,6 +21,12 @@ type claimRequest struct {
|
|||||||
event xevent.SelectionRequestEvent
|
event xevent.SelectionRequestEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close closes the request's reader and does other cleanup. It does not remove
|
||||||
|
// the request from the claim.
|
||||||
|
func (this *claimRequest) Close () error {
|
||||||
|
return this.reader.Close()
|
||||||
|
}
|
||||||
|
|
||||||
type claimRequestKey struct {
|
type claimRequestKey struct {
|
||||||
property xproto.Atom
|
property xproto.Atom
|
||||||
requestor xproto.Window
|
requestor xproto.Window
|
||||||
@ -73,7 +79,7 @@ func NewClaim (window *xwindow.Window, selection xproto.Atom, data Data, timesta
|
|||||||
|
|
||||||
return &Claim {
|
return &Claim {
|
||||||
open: true,
|
open: true,
|
||||||
incr: false, // TODO change to enable INCR
|
incr: false, // TODO change to enable INCR once its done
|
||||||
window: window,
|
window: window,
|
||||||
data: data,
|
data: data,
|
||||||
selection: selection,
|
selection: selection,
|
||||||
@ -281,7 +287,7 @@ func (claim *Claim) HandlePropertyNotify (
|
|||||||
if !ok { return }
|
if !ok { return }
|
||||||
|
|
||||||
done := func () {
|
done := func () {
|
||||||
request.reader.Close()
|
request.Close()
|
||||||
delete(claim.requests, key)
|
delete(claim.requests, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,6 +350,15 @@ func (claim *Claim) HandleSelectionClear (
|
|||||||
claim.open = false
|
claim.open = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prune checks for requests that cannot continue and removes them. If this
|
||||||
|
// claim is to be held for an extended period of time, this method should be
|
||||||
|
// called every so often.
|
||||||
|
func (claim *Claim) Prune () {
|
||||||
|
// TODO
|
||||||
|
// check all active requests to see if anyone's window has closed, and
|
||||||
|
// if it has, close the request
|
||||||
|
}
|
||||||
|
|
||||||
// Open returns false if the claim has been relinquished, either from recieving
|
// Open returns false if the claim has been relinquished, either from recieving
|
||||||
// a SelectionClear event or with the Close method.
|
// a SelectionClear event or with the Close method.
|
||||||
func (claim *Claim) Open () bool {
|
func (claim *Claim) Open () bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user