Skip to content
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

ctrl-c / ctrl-v clipboard callbacks never called on OSX #43

Open
cgimenez opened this issue Aug 1, 2016 · 2 comments
Open

ctrl-c / ctrl-v clipboard callbacks never called on OSX #43

cgimenez opened this issue Aug 1, 2016 · 2 comments
Labels
legacy-version For issues releated to the older legacy code, before all the refactorings in the develop branch.

Comments

@cgimenez
Copy link

cgimenez commented Aug 1, 2016

Hi, on OSX I can't have TextInput copy/paste working. Dunno if it's me but BaseEngine::getClipboardString() and BaseEngine::setClipboardString() are never called...

I tried with ctrl-c ctrl-v keys, also with cmd-c cmd-v keys (with io.ShortcutsUseSuperKey = true)

Using cmd-c or cmd-v erases the input's content and add a 'c' or a 'v'

@borg
Copy link

borg commented Jan 12, 2017

A few steps towards a solution. The is_super_down mod to imgui above and this does seem to work. It seems just returning &ofGetWindowPtr()->getClipboardString()[0] returns a variable that goes out of scope. Creating a static instance helps with that, but I'm not sure if it is being released somewhere else after. Another pair of eyes wouldn't hurt.
In general it seems because keyboard inputs are platform specific this is a bit unsupported in imgui.

	//--------------------------------------------------------------
	const char* BaseEngine::getClipboardString()
	{
        static string str = ofGetWindowPtr()->getClipboardString();
        if(str.size()){
            str = &ofGetWindowPtr()->getClipboardString()[0];
            return str.c_str();
       }
        return "";
	}
    

	//--------------------------------------------------------------
	void BaseEngine::setClipboardString(const char * text)
	{
        static string str = ofToString(text);
		ofGetWindowPtr()->setClipboardString(str.c_str());
	}
    

@rjx-ray
Copy link

rjx-ray commented Jun 30, 2017

Ctrl-C & Ctrl-V work OK on Win32 , but direct calls to getClipBoardString don't.

See #56

@Daandelange Daandelange added the legacy-version For issues releated to the older legacy code, before all the refactorings in the develop branch. label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-version For issues releated to the older legacy code, before all the refactorings in the develop branch.
Projects
None yet
Development

No branches or pull requests

4 participants