pygame_gui icon indicating copy to clipboard operation
pygame_gui copied to clipboard

Pasting text to UI dialog inputs from clipboard manager on Mac fails

Open robclewley opened this issue 1 year ago • 2 comments

Mac's CMD + V pastes as expected into a text dialog but using my clipboard manager to select a previous paste results in v being shown in the text box, even though when I delete that and paste manually with CMD + V the correct paste content goes in. Naturally, using Clipy to paste into other apps or the OS command line works as expected.

Steps to reproduce the behaviour:

  1. On a Mac, use a clipboard manager such as Clipy and paste from it into any UI text input field e.g. using one from pygame_gui_examples.
  • Mac 12.6.3
  • Pygame_gui 0.6.9
  • Pygame 2.3.0

robclewley avatar May 09 '23 05:05 robclewley

I did update the pasting code to use the standard SDL stuff from pygame.scrap functions get_text() and put_text() in 0.6.9.

Sadly, I don't have a mac to test against. But it would be good to be certain if this was also broken in regular pygame-ce using those functions, it's possible there is a pygame/SDL event I'm using incorrectly. text copying and pasting has changed a lot across SDL/pygame/this library over the past couple of years.

MyreMylar avatar Sep 18 '23 18:09 MyreMylar

This may work in 0.6.10. Hard to know since I don't have Clipy or a mac so I'm just having to guess at what might be happening from the bug description.

I've added a check to look at the contents of a TEXTINPUT event and if it contains just a 'v' to then look to see if either the CTRL or META key modifiers are active. It's possible the clipy program doesn't send a KEYDOWN event, which is what I was using before, when it mimics a paste (could be just a TEXTINPUT, could be that and a KEYUP). Anyway, if you try it again after 0.6.10 comes out and it works, or doesn't please let me know.

MyreMylar avatar Mar 03 '24 08:03 MyreMylar