Merge pull request #9824 from sowfelicity/2.1-clipboard
Workaround to allow pasting unicode characters from X selection(2.1).
This commit is contained in:
commit
83dbab3033
@ -1661,7 +1661,7 @@ void OS_X11::set_clipboard(const String &p_text) {
|
||||
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;
|
||||
|
||||
@ -1678,7 +1678,7 @@ static String _get_clipboard(Atom p_source, Window x11_window, ::Display *x11_di
|
||||
};
|
||||
|
||||
if (Sown != None) {
|
||||
XConvertSelection(x11_display, p_source, XA_STRING, selection,
|
||||
XConvertSelection(x11_display, p_source, target, selection,
|
||||
x11_window, CurrentTime);
|
||||
XFlush(x11_display);
|
||||
while (true) {
|
||||
@ -1718,6 +1718,18 @@ static String _get_clipboard(Atom p_source, Window x11_window, ::Display *x11_di
|
||||
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 ret;
|
||||
|
Loading…
Reference in New Issue
Block a user