Compare commits

..

1 Commits

Author SHA1 Message Date
b1062e701e make primary selection pasting work
it is also bugged, as SDL misses large parts of selection sources (terminals etc) but browers work
2024-01-20 18:06:58 +01:00

View File

@ -17,6 +17,7 @@
#include "./media_meta_info_loader.hpp" #include "./media_meta_info_loader.hpp"
#include "./sdl_clipboard_utils.hpp" #include "./sdl_clipboard_utils.hpp"
#include "SDL_clipboard.h"
#include <cctype> #include <cctype>
#include <cstdint> #include <cstdint>
@ -492,6 +493,18 @@ void ChatGui4::render(float time_delta) {
_text_input_buffer.clear(); _text_input_buffer.clear();
evil_enter_looses_focus_hack = true; evil_enter_looses_focus_hack = true;
} }
// welcome to linux
if (ImGui::IsMouseClicked(ImGuiMouseButton_Middle)) {
if (!ImGui::IsItemFocused()) {
ImGui::SetKeyboardFocusHere(-1);
}
char* primary_text = SDL_GetPrimarySelectionText();
if (primary_text != nullptr) {
ImGui::GetIO().AddInputCharactersUTF8(primary_text);
SDL_free(primary_text);
}
}
} }
ImGui::EndChild(); ImGui::EndChild();
ImGui::SameLine(); ImGui::SameLine();