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

Glfw remove old workaround #4417

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 1 addition & 9 deletions internal/driver/glfw/clipboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (
var _ fyne.Clipboard = (*clipboard)(nil)

// clipboard represents the system clipboard
type clipboard struct {
window *glfw.Window
}
type clipboard struct{}

// Content returns the clipboard content
func (c *clipboard) Content() string {
Expand Down Expand Up @@ -64,12 +62,6 @@ func (c *clipboard) SetContent(content string) {

func (c *clipboard) setContent(content string) {
runOnMain(func() {
defer func() {
if r := recover(); r != nil {
fyne.LogError("GLFW clipboard error (details above)", nil)
}
}()

glfw.SetClipboardString(content)
})
}
1 change: 1 addition & 0 deletions internal/driver/glfw/loop_desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func (d *gLDriver) initGLFW() {

func (d *gLDriver) tryPollEvents() {
defer func() {
// See https://github.com/glfw/glfw/issues/1785 and https://github.com/fyne-io/fyne/issues/1024.
if r := recover(); r != nil {
fyne.LogError(fmt.Sprint("GLFW poll event error: ", r), nil)
}
Expand Down
1 change: 1 addition & 0 deletions internal/driver/glfw/loop_goxjs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func (d *gLDriver) initGLFW() {

func (d *gLDriver) tryPollEvents() {
defer func() {
// See https://github.com/glfw/glfw/issues/1785 and https://github.com/fyne-io/fyne/issues/1024.
if r := recover(); r != nil {
fyne.LogError(fmt.Sprint("GLFW poll event error: ", r), nil)
}
Expand Down
9 changes: 1 addition & 8 deletions internal/driver/glfw/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,7 @@ func (w *window) ShowAndRun() {

// Clipboard returns the system clipboard
func (w *window) Clipboard() fyne.Clipboard {
if w.view() == nil {
return nil
}

if w.clipboard == nil {
w.clipboard = &clipboard{window: w.viewport}
}
return w.clipboard
return &clipboard{}
}

func (w *window) Content() fyne.CanvasObject {
Expand Down
2 changes: 0 additions & 2 deletions internal/driver/glfw/window_desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ type window struct {
icon fyne.Resource
mainmenu *fyne.MainMenu

clipboard fyne.Clipboard

master bool
fullScreen bool
centered bool
Expand Down