-
Notifications
You must be signed in to change notification settings - Fork 302
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
Add copy/paste text handling for MacOS #1015
Comments
Is it possible to add it or is there some major issue with MacOS? |
Clipboard support exists for all OS, however it's not currently exposed in the docs due some issues with Wayland and some Distros. You are free to use it, but just be aware it is finicky with some linux distros. |
At this point in time I can only argue, that it is not working. I tried to copy paste from the inputs of: https://github.com/pyglet/pyglet/blob/master/examples/text/text_input.py M1 Mac |
These are not implemented in the layouts at this time. They are functions used as part of the Window: https://github.com/pyglet/pyglet/blob/master/pyglet/window/__init__.py#L809 |
A I see, you mean access to the clipboard. But what I understood from the docs, that the text handling supports Also, when I try to add it myself, I do not get key events for [CMD]+X/V/C |
The code for windows and linux, also show some code to support this: |
Unfortunately those are not implemented in layouts or carets. I'm not sure who it was that added those motion events, but they don't work and never have. They must have been under the assumption that those would be system events like other motion events, but they aren't. They don't come as special events from the system, you have to explicitly request to get and write to the clipboard from your application. Looking at the PR (#508) it probably shouldn't have been approved. Sorry for the confusion. This could probably be added as a hack to hijack the key combination and dispatch it as a separate event, but I am not sure that's the right answer. However, I'll leave it up to Benjamin on what he wants to do as these are not 'ready' yet. |
Just so we're on the same page here, the motion events from #508 are just to dispatch the constants (and they do work as expected on Linux and Windows). If the request is just to add the similar motion events for OSX, I think that's fine. |
The problem is, from what it looks like, Windows/Linux is just emulating the events of the NSTextView from MacOS by intercepting key events, and turning them into motion events. By adding custom motion events (copy/paste) we are flipping that, which would require us, to instead, hack a Windows/Linux motion event on MacOS. At that point, doesn't the NSTextView module lose it's purpose? Why have it if we are going to be intercepting key events before it gets to the view? At that point, it should be changed to behave like Windows and Linux. Seems like a lot of work for a motion event that doesn't actually exist? Maybe there is a way to do this with the NSTextView, but I haven't found something that seems like it would fit. Here are the motion events on Mac: https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding?language=objc |
Mh, to take a step back.
I found some example about copy/paste for MacOS, but it all looks strange 😅 From my understanding, currently, the NSTextView handles the copy/paste/cut itself, without effects for pyglet. Suggestion:Within
and let them pass skipping the |
Is your feature request related to a problem? Please describe.
User would like to copy or paste text from an incremental text layout.
Describe the solution you'd like
Pyglet handles copy/paste like it is doing it for windows or linux.
Additional context
This issue is the result of an investigation why, copy/paste does not work for arcades InputBox, which uses a IncrementalTextLayout.
The text was updated successfully, but these errors were encountered: