From a15a9af2b3e1b795339263208f3f1c426376135c Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 17 Jan 2024 22:39:51 +0100 Subject: [PATCH] adopt code to new imgui and new sdl --- src/file_selector.cpp | 3 ++- src/main_screen.cpp | 4 ++-- src/send_image_popup.cpp | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/file_selector.cpp b/src/file_selector.cpp index 60bf5885..3045d62f 100644 --- a/src/file_selector.cpp +++ b/src/file_selector.cpp @@ -229,7 +229,8 @@ void FileSelector::render(void) { ImGui::EndTable(); } - if (ImGui::Button("X cancel", {ImGui::GetWindowContentRegionWidth()/2.f, TEXT_BASE_HEIGHT*2})) { + //if (ImGui::Button("X cancel", {ImGui::GetWindowContentRegionWidth()/2.f, TEXT_BASE_HEIGHT*2})) { + if (ImGui::Button("X cancel", {ImGui::GetContentRegionAvail().x/2.f, TEXT_BASE_HEIGHT*2})) { ImGui::CloseCurrentPopup(); _on_cancel(); reset(); diff --git a/src/main_screen.cpp b/src/main_screen.cpp index e8c2c83e..576760c5 100644 --- a/src/main_screen.cpp +++ b/src/main_screen.cpp @@ -73,8 +73,8 @@ MainScreen::~MainScreen(void) { bool MainScreen::handleEvent(SDL_Event& e) { if (e.type == SDL_EVENT_DROP_FILE) { - std::cout << "DROP FILE: " << e.drop.file << "\n"; - cg.sendFilePath(e.drop.file); + std::cout << "DROP FILE: " << e.drop.data << "\n"; + cg.sendFilePath(e.drop.data); _render_interval = 1.f/60.f; // TODO: magic _time_since_event = 0.f; return true; // TODO: forward return succ from sendFilePath() diff --git a/src/send_image_popup.cpp b/src/send_image_popup.cpp index 4c046afa..722a9518 100644 --- a/src/send_image_popup.cpp +++ b/src/send_image_popup.cpp @@ -445,7 +445,8 @@ void SendImagePopup::render(float time_delta) { ImGui::Unindent(); } - if (ImGui::Button("X cancel", {ImGui::GetWindowContentRegionWidth()/2.f, TEXT_BASE_HEIGHT*2})) { + //if (ImGui::Button("X cancel", {ImGui::GetWindowContentRegionWidth()/2.f, TEXT_BASE_HEIGHT*2})) { + if (ImGui::Button("X cancel", {ImGui::GetContentRegionAvail().x/2.f, TEXT_BASE_HEIGHT*2})) { _on_cancel(); ImGui::CloseCurrentPopup(); reset();