Workaround to allow pasting unicode characters from X selection.
Fixes #2491. Fixes #9787.
This commit is contained in:
parent
48007d8ec6
commit
5a5b6dcde0
1 changed files with 14 additions and 2 deletions
|
@ -1661,7 +1661,7 @@ void OS_X11::set_clipboard(const String &p_text) {
|
||||||
XSetSelectionOwner(x11_display, XInternAtom(x11_display, "CLIPBOARD", 0), x11_window, CurrentTime);
|
XSetSelectionOwner(x11_display, XInternAtom(x11_display, "CLIPBOARD", 0), x11_window, CurrentTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
static String _get_clipboard(Atom p_source, Window x11_window, ::Display *x11_display, String p_internal_clipboard) {
|
static String _get_clipboard_impl(Atom p_source, Window x11_window, ::Display *x11_display, String p_internal_clipboard, Atom target) {
|
||||||
|
|
||||||
String ret;
|
String ret;
|
||||||
|
|
||||||
|
@ -1678,7 +1678,7 @@ static String _get_clipboard(Atom p_source, Window x11_window, ::Display *x11_di
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Sown != None) {
|
if (Sown != None) {
|
||||||
XConvertSelection(x11_display, p_source, XA_STRING, selection,
|
XConvertSelection(x11_display, p_source, target, selection,
|
||||||
x11_window, CurrentTime);
|
x11_window, CurrentTime);
|
||||||
XFlush(x11_display);
|
XFlush(x11_display);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -1718,6 +1718,18 @@ static String _get_clipboard(Atom p_source, Window x11_window, ::Display *x11_di
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String _get_clipboard(Atom p_source, Window x11_window, ::Display *x11_display, String p_internal_clipboard) {
|
||||||
|
String ret;
|
||||||
|
Atom utf8_atom = XInternAtom(x11_display, "UTF8_STRING", True);
|
||||||
|
if (utf8_atom != None) {
|
||||||
|
ret = _get_clipboard_impl(p_source, x11_window, x11_display, p_internal_clipboard, utf8_atom);
|
||||||
|
}
|
||||||
|
if (ret == "") {
|
||||||
|
ret = _get_clipboard_impl(p_source, x11_window, x11_display, p_internal_clipboard, XA_STRING);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
String OS_X11::get_clipboard() const {
|
String OS_X11::get_clipboard() const {
|
||||||
|
|
||||||
String ret;
|
String ret;
|
||||||
|
|
Loading…
Reference in a new issue