Temporary redirect to patched xgbutil that will only work on my machine
This commit is contained in:
parent
f9e5503320
commit
017543aa0f
@ -264,6 +264,7 @@ func (window *window) handleSelectionRequest (
|
||||
connection *xgbutil.XUtil,
|
||||
event xevent.SelectionRequestEvent,
|
||||
) {
|
||||
println("got sel req")
|
||||
if window.selectionClaim == nil { return }
|
||||
window.selectionClaim.handleSelectionRequest(connection, event)
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import "github.com/jezek/xgbutil/xprop"
|
||||
import "github.com/jezek/xgbutil/xevent"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/data"
|
||||
|
||||
const clipboardName = "CLIPBOARD"
|
||||
|
||||
type selReqState int; const (
|
||||
selReqStateClosed selReqState = iota
|
||||
selReqStateAwaitTargets
|
||||
|
@ -17,7 +17,7 @@ type selectionClaim struct {
|
||||
func (window *window) claimSelection (name xproto.Atom, data data.Data) *selectionClaim {
|
||||
// Follow:
|
||||
// https://tronche.com/gui/x/icccm/sec-2.html#s-2.1
|
||||
|
||||
|
||||
// A client wishing to acquire ownership of a particular selection
|
||||
// should call SetSelectionOwner. The client should set the specified
|
||||
// selection to the atom that represents the selection, set the
|
||||
@ -35,6 +35,11 @@ func (window *window) claimSelection (name xproto.Atom, data data.Data) *selecti
|
||||
window.xWindow.Id, name, 0).Check() // FIXME: should not be zero
|
||||
if err != nil { return nil }
|
||||
|
||||
ownerReply, err := xproto.GetSelectionOwner (
|
||||
window.backend.connection.Conn(), name).Reply()
|
||||
if err != nil { return nil }
|
||||
if ownerReply.Owner != window.xWindow.Id { return nil}
|
||||
|
||||
return &selectionClaim {
|
||||
window: window,
|
||||
data: data,
|
||||
@ -139,7 +144,7 @@ func (claim *selectionClaim) handleSelectionRequest (
|
||||
for index, name := range targetNames {
|
||||
atom, err := xprop.Atm(claim.window.backend.connection, name)
|
||||
if err != nil { die(); return }
|
||||
xgb.Put32(data[:index * 4], uint32(atom))
|
||||
xgb.Put32(data[:(index + 1) * 4], uint32(atom))
|
||||
}
|
||||
claim.window.fulfillSelectionRequest(data, 8, event)
|
||||
|
||||
|
@ -290,8 +290,7 @@ func (window *window) Hide () {
|
||||
}
|
||||
|
||||
func (window *window) Copy (data data.Data) {
|
||||
selectionName := "CLIPBOARD"
|
||||
selectionAtom, err := xprop.Atm(window.backend.connection, selectionName)
|
||||
selectionAtom, err := xprop.Atm(window.backend.connection, clipboardName)
|
||||
if err != nil { return }
|
||||
window.selectionClaim = window.claimSelection(selectionAtom, data)
|
||||
}
|
||||
@ -307,9 +306,8 @@ func (window *window) Paste (callback func (data.Data, error), accept ...data.Mi
|
||||
return
|
||||
}
|
||||
|
||||
selectionName := "CLIPBOARD"
|
||||
propertyName := "TOMO_SELECTION"
|
||||
selectionAtom, err := xprop.Atm(window.backend.connection, selectionName)
|
||||
propertyName := "TOMO_SELECTION"
|
||||
selectionAtom, err := xprop.Atm(window.backend.connection, clipboardName)
|
||||
if err != nil { die(err); return }
|
||||
propertyAtom, err := xprop.Atm(window.backend.connection, propertyName)
|
||||
if err != nil { die(err); return }
|
||||
|
Reference in New Issue
Block a user