• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Fixed GLFW: SetClipboard not managing special characters

I forgot about that but I'm about to need to use clipboard for my next project since it's a sequel to an app I made in Blitzmax which leaned on it (in Blitzmax the clipboard handed special characters well)
 
I guess we need our own solution for the clipboard and not rely on GLFWs implementation.
 
I forgot about that but I'm about to need to use clipboard for my next project since it's a sequel to an app I made in Blitzmax which leaned on it (in Blitzmax the clipboard handed special characters well)
Does it do that on all desktop platforms?
 
Good question, haven't tried on macOS, I will ASAP. I don't know if the BlitzMax code can be adapted or not+ I can't remember if it was vanilla BMax or something that came with WX Gadgets.
 
For me it empties the clipboard on macOS platform.
 
Using latest Cerberus-X, I tried it on Catalina 10.15.6 and up.
They all give empty clipboard.
 
It looks like there is something going wrong with the conversion from String to cstring. If I put in some const char * text, setclipboard() works as expected on my MacBook. If I inspect the first char of "ü" I get different values. -61 from the const char* and -4 from the converted cx string.
 
No, at least not yet. Sorry. I will have a look again this evening. Maybe someone can help me with some questions I have about this:
What is the difference between CX String in terms of the value each character has?
Where do special chars differ?
The other thing is that this is wrapped in ugly c++ template classes I don't know much about.
 
I've done some testing (reading and setting the clipboard inside the os and cx, all the variants).

Everything works except :

Code:
If GetClipboard() ="ü" Then canvas.DrawText "This will not be printed",0,0 ' this will not react strangly enough
Print GetClipboard() ' < This *will* print ü

and:

Code:
SetClipboard "ü"

This will leave the os with an empty clipboard.
(and the console will be printed filled with empty strings that scrolls up)

Code:
SetClipboard "ü"
If GetClipboard() ="ü" Then imageCanvas.DrawText This won't happen either",0,0

Sadly I'm not very knowledgable about the details needed yet to solve it. But this might help.
 
Ok. I managed to get it working on my MacBook and maybe on Windows, but I am not sure yet. And for Windows I need to find the function for getting the length of a C-String.
I modified some lines in glfwgame.cpp inside the targets native folder:

Code:
// At the beginning of the file I changed this line:
//static String::CString<char> GLFW_C_STR( const String &t ){ return t.ToCString<char>(); };
static String::CString<char> GLFW_C_STR( const String &t ){ return t.ToUtf8(); };


// And at line 637 I changed this.
        //return String(_text);
        return String::Load((unsigned char *)_text, t_strlen( _text ));

Edit: The function for the length of a c-string array is t_strlen() :) Here it seems to work on Mac(Big Sur), Win10 and Linux (Manjaro) .
 
Last edited:
Back
Top Bottom