Skip to content

Commit

Permalink
Fix #851 Add text/plain;charset=utf-8 to TextTransfer()
Browse files Browse the repository at this point in the history
enables paste from KDE/QT apps in a wayland session.
  • Loading branch information
the-snowwhite committed Nov 7, 2023
1 parent 030807a commit 3f5bae0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ public class TextTransfer extends ByteArrayTransfer {
private static final String COMPOUND_TEXT = "COMPOUND_TEXT"; //$NON-NLS-1$
private static final String UTF8_STRING = "UTF8_STRING"; //$NON-NLS-1$
private static final String STRING = "STRING"; //$NON-NLS-1$
private static final String TEXTPLAINUTF8 = "text/plain;charset=utf-8"; //RFC-1341
private static final int COMPOUND_TEXT_ID = GTK.GTK4 ? 0 : registerType(COMPOUND_TEXT);
private static final int UTF8_STRING_ID = GTK.GTK4 ? 0 : registerType(UTF8_STRING);
private static final int STRING_ID = GTK.GTK4 ? 0 : registerType(STRING);
private static final int TEXTPLAINUTF8_ID = GTK.GTK4 ? 0 : registerType(TEXTPLAINUTF8);

private TextTransfer() {}

Expand Down Expand Up @@ -145,7 +147,7 @@ protected int[] getTypeIds() {
if(GTK.GTK4) {
return new int[] {(int) OS.G_TYPE_STRING()};
}
return new int[] {UTF8_STRING_ID, STRING_ID};
return new int[] {UTF8_STRING_ID, STRING_ID, TEXTPLAINUTF8_ID};
}

@Override
Expand All @@ -157,7 +159,7 @@ protected String[] getTypeNames() {
return new String[] {"text/plain", STRING};
}

return new String[] {UTF8_STRING, STRING};
return new String[] {UTF8_STRING, STRING, TEXTPLAINUTF8};
}

boolean checkText(Object object) {
Expand Down

0 comments on commit 3f5bae0

Please sign in to comment.