diff --git a/src/filesel.c b/src/filesel.c index 03dcefa1..8c2fd4c6 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -121,7 +121,7 @@ byte Native_filesel(byte load) return CommDlgExtendedError(); } #else - #ifndef(__linux__) // This makes no sense on X11-oriented platform. Nothing is really native there. + #ifndef __linux__ // This makes no sense on X11-oriented platforms. Nothing is really native there. #warning "EXPERIMENTAL function for native fileselector not available for this platform!" #endif return 255; // fail ! diff --git a/src/haiku.cpp b/src/haiku.cpp index 0db82e07..973e957e 100644 --- a/src/haiku.cpp +++ b/src/haiku.cpp @@ -20,10 +20,14 @@ #include "struct.h" #ifdef __HAIKU__ +#include #include #include +#include + extern "C" qword haiku_get_free_space(char* path); +extern "C" char* haiku_get_clipboard(); qword haiku_get_free_space(char* path) { @@ -33,4 +37,17 @@ qword haiku_get_free_space(char* path) BVolume disk(ref.device); return (qword) disk.Capacity(); } + +char* haiku_get_clipboard() +{ + if (be_clipboard->Lock()) + { + const char* value; + ssize_t len; + be_clipboard->Data()->FindData("text/plain", B_MIME_TYPE, &(const void*)value, &len); + + return strdup(value); + } + return NULL; +} #endif diff --git a/src/readline.c b/src/readline.c index a4216c23..e069ea2e 100644 --- a/src/readline.c +++ b/src/readline.c @@ -179,6 +179,10 @@ char* getClipboard() CloseClipboard(); } } + #elif defined __HAIKU__ + return haiku_get_clipboard(); + #else + #warning "Missing platform-specific code in getClipboard function" #endif return dst; } @@ -453,7 +457,12 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz input_key=SDLK_RETURN; // Handle paste request on CTRL+v - if ((Key & MOD_CTRL) && ((Key & 0xFFF) == 'v')) +#if defined __HAIKU__ + #define SHORTCUTKEY MOD_ALT +#else + #define SHORTCUTKEY MOD_CTRL +#endif + if ((Key & SHORTCUTKEY) && ((Key & 0xFFF) == 'v')) { char* data = getClipboard(); if (data == NULL) continue; // No clipboard data @@ -465,6 +474,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz goto affichage; } } while(input_key==0); +#undef SHORTCUTKEY } Hide_cursor();