Adaptation of the CoolViewer patch that allows Linux users to paste by middle-clicking.
This commit is contained in:
@@ -1282,6 +1282,49 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text)
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowSDL::isPrimaryTextAvailable()
|
||||
{
|
||||
if (ll_try_gtk_init())
|
||||
{
|
||||
GtkClipboard * const clipboard =
|
||||
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||
return gtk_clipboard_wait_is_text_available(clipboard) ?
|
||||
TRUE : FALSE;
|
||||
}
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &text)
|
||||
{
|
||||
if (ll_try_gtk_init())
|
||||
{
|
||||
GtkClipboard * const clipboard =
|
||||
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||
gchar * const data = gtk_clipboard_wait_for_text(clipboard);
|
||||
if (data)
|
||||
{
|
||||
text = LLWString(utf8str_to_wstring(data));
|
||||
g_free(data);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text)
|
||||
{
|
||||
if (ll_try_gtk_init())
|
||||
{
|
||||
const std::string utf8 = wstring_to_utf8str(text);
|
||||
GtkClipboard * const clipboard =
|
||||
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||
gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOL LLWindowSDL::isClipboardTextAvailable()
|
||||
@@ -1298,6 +1341,22 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::isPrimaryTextAvailable()
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst)
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s)
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
#endif // LL_GTK
|
||||
|
||||
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
|
||||
|
||||
Reference in New Issue
Block a user