I am no X expert but I think there are two copy/paste buffers under X.
When I am writing gd code in Godot I cannot copy (via highlighting from xterm) into my gd script by using the middle-mouse button. I looked around and did not see any settings for Godot regarding this.
Did I miss this or is this a feature? I can copy/paste from X apps that use ctrl-c,ctrl-v but I cannot use the other X buffer accessed via highlighting and middle-mouse click.
I tried with git version and 1.1-stable.
should this work on Linux? I can understand for the editor, but for Godot to work like this may make some games work odd on linux..
This is X' fault and a very special use case, waiting for Wayland.
If I remember correctly, the clipboard code doesn't really deal with the "2
clipboards" problem of X11, we copy to both clipboards, but I don't
remember where we paste from. I think my intention was to paste from the
latest modified (ie whatever you did last, "copy" or "selection" ends up
pasted when you press ctrl+v in godot), but I don't remember if I
succeeded, in that case I might have picked one of the 2.
Having 2 clipboards is pretty stupid anyway, and in X11 they're not even
"clipboards", it's some kind of IPC system where you communicate with the
last window that claimed the particular global variable called "CLIPBOARD"
or "SELECTION" or whatever, and ask for the contents.
On 12 December 2015 at 21:30, Stian Furu Øverbye [email protected]
wrote:
This is X' fault and a very special use case, waiting for Wayland.
—
Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/3030#issuecomment-164204494.
@punto- The IPC system is smarter than copying the whole clipboard to the window manager. This way there is no overhead when you do ctrl+c or when you select text. The overhead only happens when you do ctrl+v or when you press the middle button. Its no big issue to copy stuff if you copy a small piece of text, but sometimes you want to copy whole files or stuff.
@StianTheDark Wayland has currently no support for middle click paste buffers. In fact, it (as protocol) makes the life for wm's and applications even very hard, e.g. you have to think of your own custom MIME type in order to be able to distinguish the selection buffer from the ctrl+c/ctrl+v buffer. And neither weston nor the kde or gnome efforts support middle click pasting, as of now. Or you think of your own custom IPC method to do this, but as long as neither kde nor gnome nor weston support it (nor the toolkits!), one is without hope.
@reduz, this should work in linux, this is just in the GD editor. @punto- this is a basic X feature that's existed for as long as I can remember, there are many, many stupid things in X. This feature is very useful.
+1
My fave feature of X is the ability to copy text by highlighting it and paste it with middle click. I find it much more efficient than other methods so I was very disappointed when I discovered this doesn't work under the gd script editor as I use that feature constantly under every other X app.
Has there been any progress on this? I'm still not able to center-click to paste with Godot 3.1-beta. It's difficult to copy from an urxvt terminal to the Godot editor because it uses Ctrl-C to terminate the running process. Apparently Ctrl+Alt+C or Ctrl+Shift+C will copy to the clipboard, but I only use the keystroke every few years whereas I use the center click dozens of times a day.
I use this feature everywhere in GNU/Linux where there's a text/edit area.
This includes browser textareas, all text editors I've tried so far (Kate, KWrite, Atom, QtCreator + many more), in all terminals (Konsole, XTerm), on the plasma desktop (pastes a new note with copy buffer text). Basically everywhere you have text input this feature is enabled. In short this is something people are used to when working in Linux (X) environments.
I'd vote for it to be enabled, as a minimum, in the Godot main editor.
Pasting with middle-mouse click into game windows should be optional.
It's quite a show-stopper when you're used to this.
The Qt implementation of clipboard has some clarifying notes on the global mouse Selection
https://github.com/qt/qtbase/blob/53d62b8fcbb639bd625777c8f1c01764445fb1c4/src/gui/kernel/qclipboard.cpp#L94-L117
I've been thinking it could be possible to support in text input fields in editor mode. It doesn't have to touch Godot's clipboard system. Some applications under X11 implement clipboard indexes (also known as Clipboard History) for convenience which is the "real" (Ctrl+c) clipboard - but the middle-mouse uses the X11 global "Selection" buffer which is specifically dedicated to hold selected text from your application - and get pasted into another application window with middle-mouse.
So it shouldn't touch the normal system wide clipboard - it's a separate buffer (or "feature") available in X11.
Would it be a solution to have code in text input fields in Godot that send the text to the X11 selection buffer upon a selection end - and then (optionally) have them looking for content in said buffer when clicking with middle-mouse in a text input field, only enabled in editor mode to ensure it doesn't break any existing games relying on middle-mouse events?
The implementation could sit as a detectable feature of the current clipboard system in Godot (drawing inspiration from the Qt implementation)
EDIT
It seems the clipboard "system" is just two virtual methods in OS
If anyone care, I now have a working implementation at https://github.com/Larpon/godot/tree/feature/multi-clipboards
Selections in TextEdit and LineEdit fields now get reflected in X11 PRIMARY
clipboard (middle mouse button) - and likewise middle-mouse clicks in those input fields will result in a paste at the cursor position. So selection and MMB paste are now possible both in Godot and between Godot and other X11 applications.
IMPORTANT
Be advised that the code is NOT production ready yet - and I'm waiting to discuss a better architecture and more features with the maintainers. Current version is not platform and editor/game aware yet so the functionality will work inside the editor and in any games using aforementioned fields on other platforms.
I thought I'd link it here to let people test it and provide feedback if they want :smiley:
@Larpon any updates? do we know if this is coming soon
@thejacer87 - I'm a bit out of the loop currently. I spoke to "TMM" (irc nick) on IRC a while back and we concluded that he (or someone) had to rewrite the X server integration after 3.2 - and then I could start working on proper support on top of that. The current code need to be rewritten according to TMM. So maybe ask around on IRC?
Most helpful comment
+1
My fave feature of X is the ability to copy text by highlighting it and paste it with middle click. I find it much more efficient than other methods so I was very disappointed when I discovered this doesn't work under the gd script editor as I use that feature constantly under every other X app.