Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

Commit

Permalink
add hack to call gtk_clipboard_set_can_store, makes clipboard slightl…
Browse files Browse the repository at this point in the history
…y more reliable
  • Loading branch information
Francesco149 committed Feb 24, 2018
1 parent 71b2af2 commit b66eb87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions sharenixlib/clipboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@
along with sharenix. If not, see <http://www.gnu.org/licenses/>.
*/

// +build !cgocheck

package sharenixlib

// #cgo pkg-config: gtk+-2.0
// #include "clipboard.go.h"
import "C"

import (
"github.com/mattn/go-gtk/gdk"
"github.com/mattn/go-gtk/gtk"
"unsafe"
)

// GetClipboard returns the default display's GTK clipboard
Expand All @@ -36,6 +43,7 @@ func SetClipboardText(text string) {
pri := gtk.NewClipboardGetForDisplay(display, gdk.SELECTION_PRIMARY)

for _, cli := range []*gtk.Clipboard{pri, GetClipboard()} {
C._gtk_clipboard_set_can_store(unsafe.Pointer(cli.GClipboard))
cli.SetText(text)
gtk.MainIterationDo(true)
cli.Store()
Expand Down
2 changes: 1 addition & 1 deletion sharenixlib/sharenix.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
)

const (
ShareNixVersion = "ShareNix 0.9.14a"
ShareNixVersion = "ShareNix 0.9.15a"
)

const (
Expand Down

0 comments on commit b66eb87

Please sign in to comment.