xparq / Out_of_Nothing

Versatile entity-based simulation & visualization/gamification framework PROTOTYPE
0 stars 0 forks source link

"Clipboard Command Interface"... #355

Open xparq opened 11 months ago

xparq commented 11 months ago

For prototyping/testing the command IPC interface in windowed mode, as this obviously makes little sense in full-screen...

(A network channel, e.g. an UDP listener, is not that hard, but still more work, even with sf::UdpSocket + sf::Packet. And then a sender client would also be needed; Notepad won't do any more. :) )

An alternative could be reading (consuming) a file, but then it would need locking. (A named pipe would be better, but there's no SFML support for that, and AFAICR it's kinda tedious on Windows.)

Hmm, this is all SFML can do with the Clipboard. No Clipboard events. So, it's impossible to tell if a given string is still the prev. clipboard state, or it's a new one, but the same string has been pasted again:

sf::String s = sf::Clipboard::getString();

Still better than nothing, and setString() could try to delete it anyway -- albeit that's not very robust, as it may fail in some cases (depending e.g. on target platform).

Also: e.g. entering some text in Notepad and copying it to the clipboard, the new content is only received by the SFML app when its window gets activated (focused) again! :-o (Remember: no Clipboard events.) It would be quite an annoyance when trying to drive it with a sequence of commands.

xparq commented 11 months ago

This in the event loop gives random "Failed to open the Win32 clipboard." errors upon input congestion! :-/

SFML_WINDOW().setTitle(sf::Clipboard::getString());
sf::Clipboard::setString("");

Well, for testing, still... :)