Skip to content

Commit

Permalink
Allow Wayland to paste using middlemouse button
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterkepley committed Sep 3, 2024
1 parent e2dd56b commit e0ed82c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scene/gui/line_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
}

if (is_middle_mouse_paste_enabled() && b->is_pressed() && b->get_button_index() == MouseButton::MIDDLE && is_editable() && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_CLIPBOARD_PRIMARY)) {
String paste_buffer = DisplayServer::get_singleton()->clipboard_get_primary().strip_escapes();
String paste_buffer = DisplayServer::get_singleton()->clipboard_get().strip_escapes();

deselect();
set_caret_at_pixel_pos(b->get_position().x);
Expand Down
4 changes: 4 additions & 0 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7227,6 +7227,10 @@ void TextEdit::_paste_primary_clipboard_internal(int p_caret) {

String paste_buffer = DisplayServer::get_singleton()->clipboard_get_primary();

if (DisplayServer::get_singleton()->get_name() == "Wayland") {
paste_buffer = DisplayServer::get_singleton()->clipboard_get();
}

if (get_caret_count() == 1) {
Point2i pos = get_line_column_at_pos(get_local_mouse_pos());
deselect();
Expand Down

0 comments on commit e0ed82c

Please sign in to comment.