clipboard fix
This commit is contained in:
parent
c133706890
commit
c864a2cb08
|
@ -57,8 +57,8 @@ namespace Platform
|
||||||
/// Check if GL extension is supported
|
/// Check if GL extension is supported
|
||||||
bool isExtensionSupported(const char *ext);
|
bool isExtensionSupported(const char *ext);
|
||||||
|
|
||||||
const char *getTextFromClipboard();
|
const char *getClipboardText();
|
||||||
void copyToClipboard(const char *text);
|
void setClipboardText(const char *text);
|
||||||
|
|
||||||
void hideMouseCursor();
|
void hideMouseCursor();
|
||||||
void showMouseCursor();
|
void showMouseCursor();
|
||||||
|
|
|
@ -244,6 +244,29 @@ bool Platform::isExtensionSupported(const char *ext)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *Platform::getClipboardText()
|
||||||
|
{
|
||||||
|
const char *text = "";
|
||||||
|
if(OpenClipboard(NULL)) {
|
||||||
|
text = (const char*)GetClipboardData(CF_TEXT);
|
||||||
|
CloseClipboard();
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Platform::setClipboardText(const char *text)
|
||||||
|
{
|
||||||
|
int textLenght = strlen(text);
|
||||||
|
HANDLE hData = new HANDLE[textLenght + 1];
|
||||||
|
memcpy(hData, text, textLenght + 1);
|
||||||
|
|
||||||
|
if(OpenClipboard(NULL)) {
|
||||||
|
EmptyClipboard();
|
||||||
|
SetClipboardData(CF_TEXT, hData);
|
||||||
|
CloseClipboard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Platform::hideMouseCursor()
|
void Platform::hideMouseCursor()
|
||||||
{
|
{
|
||||||
ShowCursor(false);
|
ShowCursor(false);
|
||||||
|
|
|
@ -601,7 +601,7 @@ bool Platform::isExtensionSupported(const char *ext)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Platform::getTextFromClipboard()
|
const char *Platform::getClipboardText()
|
||||||
{
|
{
|
||||||
Window ownerWindow = XGetSelectionOwner(x11.display, x11.atomClipboard);
|
Window ownerWindow = XGetSelectionOwner(x11.display, x11.atomClipboard);
|
||||||
if(ownerWindow == x11.window)
|
if(ownerWindow == x11.window)
|
||||||
|
@ -650,7 +650,7 @@ const char *Platform::getTextFromClipboard()
|
||||||
return clipboard.c_str();
|
return clipboard.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform::copyToClipboard(const char *text)
|
void Platform::setClipboardText(const char *text)
|
||||||
{
|
{
|
||||||
x11.clipboardText = text;
|
x11.clipboardText = text;
|
||||||
XSetSelectionOwner(x11.display, x11.atomClipboard, x11.window, CurrentTime);
|
XSetSelectionOwner(x11.display, x11.atomClipboard, x11.window, CurrentTime);
|
||||||
|
|
Loading…
Reference in New Issue