Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard Support #258

Merged
merged 2 commits into from
Jan 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions pixelgl/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ func (w *Window) SetCursorVisible(visible bool) {
// SetCursorDisabled hides the cursor and provides unlimited virtual cursor movement
// make cursor visible using SetCursorVisible
func (w *Window) SetCursorDisabled() {
w.cursorVisible = false
mainthread.Call(func() {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorDisabled)
})
w.cursorVisible = false
mainthread.Call(func() {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorDisabled)
})
}

// CursorVisible returns the visibility status of the mouse cursor.
Expand Down Expand Up @@ -494,3 +494,19 @@ func (w *Window) Show() {
w.window.Show()
})
}

// Clipboard returns the contents of the system clipboard.
func (w *Window) Clipboard() string {
var clipboard string
mainthread.Call(func() {
clipboard = w.window.GetClipboardString()
})
return clipboard
}

// SetClipboardString sets the system clipboard to the specified UTF-8 encoded string.
func (w *Window) SetClipboard(str string) {
mainthread.Call(func() {
w.window.SetClipboardString(str)
})
}