Skip to content

Commit

Permalink
Merge pull request #4417 from Jacalz/glfw-remove-old-workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Nov 27, 2023
2 parents b4e136b + 529a3d6 commit 17e67b0
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 19 deletions.
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 @@ -78,8 +78,6 @@ type window struct {
icon fyne.Resource
mainmenu *fyne.MainMenu

clipboard fyne.Clipboard

master bool
fullScreen bool
centered bool
Expand Down

0 comments on commit 17e67b0

Please sign in to comment.