Clipboard paste support for Haiku.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1828 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
afa22ae0ac
commit
d34c3d9df5
@ -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 !
|
||||
|
||||
@ -20,10 +20,14 @@
|
||||
#include "struct.h"
|
||||
|
||||
#ifdef __HAIKU__
|
||||
#include <Clipboard.h>
|
||||
#include <Entry.h>
|
||||
#include <Volume.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user