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,
|
connection *xgbutil.XUtil,
|
||||||
event xevent.SelectionRequestEvent,
|
event xevent.SelectionRequestEvent,
|
||||||
) {
|
) {
|
||||||
|
println("got sel req")
|
||||||
if window.selectionClaim == nil { return }
|
if window.selectionClaim == nil { return }
|
||||||
window.selectionClaim.handleSelectionRequest(connection, event)
|
window.selectionClaim.handleSelectionRequest(connection, event)
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ import "github.com/jezek/xgbutil/xprop"
|
|||||||
import "github.com/jezek/xgbutil/xevent"
|
import "github.com/jezek/xgbutil/xevent"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/data"
|
import "git.tebibyte.media/sashakoshka/tomo/data"
|
||||||
|
|
||||||
|
const clipboardName = "CLIPBOARD"
|
||||||
|
|
||||||
type selReqState int; const (
|
type selReqState int; const (
|
||||||
selReqStateClosed selReqState = iota
|
selReqStateClosed selReqState = iota
|
||||||
selReqStateAwaitTargets
|
selReqStateAwaitTargets
|
||||||
|
@ -17,7 +17,7 @@ type selectionClaim struct {
|
|||||||
func (window *window) claimSelection (name xproto.Atom, data data.Data) *selectionClaim {
|
func (window *window) claimSelection (name xproto.Atom, data data.Data) *selectionClaim {
|
||||||
// Follow:
|
// Follow:
|
||||||
// https://tronche.com/gui/x/icccm/sec-2.html#s-2.1
|
// https://tronche.com/gui/x/icccm/sec-2.html#s-2.1
|
||||||
|
|
||||||
// A client wishing to acquire ownership of a particular selection
|
// A client wishing to acquire ownership of a particular selection
|
||||||
// should call SetSelectionOwner. The client should set the specified
|
// should call SetSelectionOwner. The client should set the specified
|
||||||
// selection to the atom that represents the selection, set the
|
// 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
|
window.xWindow.Id, name, 0).Check() // FIXME: should not be zero
|
||||||
if err != nil { return nil }
|
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 {
|
return &selectionClaim {
|
||||||
window: window,
|
window: window,
|
||||||
data: data,
|
data: data,
|
||||||
@ -139,7 +144,7 @@ func (claim *selectionClaim) handleSelectionRequest (
|
|||||||
for index, name := range targetNames {
|
for index, name := range targetNames {
|
||||||
atom, err := xprop.Atm(claim.window.backend.connection, name)
|
atom, err := xprop.Atm(claim.window.backend.connection, name)
|
||||||
if err != nil { die(); return }
|
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)
|
claim.window.fulfillSelectionRequest(data, 8, event)
|
||||||
|
|
||||||
|
@ -290,8 +290,7 @@ func (window *window) Hide () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (window *window) Copy (data data.Data) {
|
func (window *window) Copy (data data.Data) {
|
||||||
selectionName := "CLIPBOARD"
|
selectionAtom, err := xprop.Atm(window.backend.connection, clipboardName)
|
||||||
selectionAtom, err := xprop.Atm(window.backend.connection, selectionName)
|
|
||||||
if err != nil { return }
|
if err != nil { return }
|
||||||
window.selectionClaim = window.claimSelection(selectionAtom, data)
|
window.selectionClaim = window.claimSelection(selectionAtom, data)
|
||||||
}
|
}
|
||||||
@ -307,9 +306,8 @@ func (window *window) Paste (callback func (data.Data, error), accept ...data.Mi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
selectionName := "CLIPBOARD"
|
propertyName := "TOMO_SELECTION"
|
||||||
propertyName := "TOMO_SELECTION"
|
selectionAtom, err := xprop.Atm(window.backend.connection, clipboardName)
|
||||||
selectionAtom, err := xprop.Atm(window.backend.connection, selectionName)
|
|
||||||
if err != nil { die(err); return }
|
if err != nil { die(err); return }
|
||||||
propertyAtom, err := xprop.Atm(window.backend.connection, propertyName)
|
propertyAtom, err := xprop.Atm(window.backend.connection, propertyName)
|
||||||
if err != nil { die(err); return }
|
if err != nil { die(err); return }
|
||||||
|
2
go.mod
2
go.mod
@ -22,3 +22,5 @@ require (
|
|||||||
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 // indirect
|
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 // indirect
|
||||||
github.com/jezek/xgb v1.1.0
|
github.com/jezek/xgb v1.1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
replace github.com/jezek/xgbutil => /home/sashakoshka/repos/xgbutil
|
||||||
|
Reference in New Issue
Block a user