mirror of
https://github.com/rwinkhart/cmutton.git
synced 2026-09-02 23:27:32 -04:00
Port clip package
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package main
|
||||
|
||||
// #include <stdlib.h>
|
||||
// #include "types.h"
|
||||
import "C"
|
||||
import (
|
||||
"github.com/rwinkhart/libmutton/clip"
|
||||
)
|
||||
|
||||
// ClearProcess clears the clipboard in 30 seconds if its contents still match assignedContents.
|
||||
// If assignedContents is an empty string, the clipboard will clear immediately and unconditionally.
|
||||
//
|
||||
// r0: err
|
||||
//
|
||||
//export ClearProcess
|
||||
func ClearProcess(assignedContents C.PascalString) *C.char {
|
||||
err := clip.ClearProcess(C.GoStringN(assignedContents.data, assignedContents.len))
|
||||
if err != nil {
|
||||
return C.CString(err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CopyShortcut returns:
|
||||
// r0: err
|
||||
//
|
||||
//export CopyShortcut
|
||||
func CopyShortcut(realPath C.PascalString, field int, rcwPassword C.PascalString) *C.char {
|
||||
err := clip.CopyShortcut(C.GoStringN(realPath.data, realPath.len), field, []byte(C.GoStringN(rcwPassword.data, rcwPassword.len)))
|
||||
if err != nil {
|
||||
return C.CString(err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CopyString returns:
|
||||
// r0: err
|
||||
//
|
||||
//export CopyString
|
||||
func CopyString(clearClipboardAutomatically bool, copySubject C.PascalString) *C.char {
|
||||
err := clip.CopyString(clearClipboardAutomatically, C.GoStringN(copySubject.data, copySubject.len))
|
||||
if err != nil {
|
||||
return C.CString(err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user