Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
branches: [ master ]

env:
BUILD_TYPE: RelWithDebInfo
#BUILD_TYPE: RelWithDebInfo
BUILD_TYPE: Debug
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
Expand Down
5 changes: 5 additions & 0 deletions external/sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ if (NOT TARGET SDL3::SDL3)
#TODO: pic ?

FetchContent_Declare(SDL3
#[[
GIT_REPOSITORY https://github.com/libsdl-org/SDL
#GIT_TAG 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 # tip when looking
#GIT_TAG 14f584a94bfd49cf1524db75bf3c419fdf9436cd # tip 26-04-2024
GIT_TAG 06d6f2cb2518622593570985589700910cf4399f # 13-05-2024 - before
# made changes that break imgui release 1.90.6
#GIT_TAG 1103294d33f47ab4c697bb22a9cf27c79c658630 # tip 15-05-2024
]]

GIT_REPOSITORY https://github.com/Green-Sky/SDL.git
GIT_TAG windows_clipboard_fixes
FIND_PACKAGE_ARGS # for the future
)
FetchContent_MakeAvailable(SDL3)
Expand Down
2 changes: 1 addition & 1 deletion src/chat_gui/send_image_popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void SendImagePopup::sendMemory(

// copy paste data to memory
original_data.clear();
original_data.insert(original_data.begin(), data, data+data_size);
original_data.insert(original_data.cend(), data, data+data_size);

if (!load()) {
std::cerr << "SIP: failed to load image from memory\n";
Expand Down
18 changes: 17 additions & 1 deletion src/chat_gui4.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "./chat_gui4.hpp"

#include <exception>
#include <solanaceae/message3/components.hpp>
#include <solanaceae/tox_messages/components.hpp>
#include <solanaceae/contact/components.hpp>
Expand All @@ -26,6 +27,8 @@
#include <fstream>
#include <iomanip>
#include <sstream>
#include <stdexcept>
#include <system_error>
#include <variant>

namespace Components {
Expand Down Expand Up @@ -164,7 +167,20 @@ void ChatGui4::setClipboardData(std::vector<std::string> mime_types, std::shared
// release lock, since on some platforms the callback is called immediatly
}

SDL_SetClipboardData(clipboard_callback, nullptr, this, tmp_mimetype_list.data(), tmp_mimetype_list.size());
try {
SDL_SetClipboardData(clipboard_callback, nullptr, this, tmp_mimetype_list.data(), tmp_mimetype_list.size());
} catch (const std::runtime_error& e) {
std::cerr << "CG error: setting clipboard data threw runtime_error!\n";
std::cerr << "what: " << e.what() << "\n";
} catch (const std::system_error& e) {
std::cerr << "CG error: setting clipboard data threw system_error!\n";
std::cerr << "what: " << e.what() << "\n";
} catch (const std::exception& e) {
std::cerr << "CG error: setting clipboard data threw exception!\n";
std::cerr << "what: " << e.what() << "\n";
} catch (...) {
std::cerr << "CG error: setting clipboard data threw!\n";
}
}

ChatGui4::ChatGui4(
Expand Down
2 changes: 1 addition & 1 deletion src/image_loader_qoi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ImageLoaderQOI::ImageResult ImageLoaderQOI::loadFromMemoryRGBA(const uint8_t* da

auto& new_frame = res.frames.emplace_back();
new_frame.ms = 0;
new_frame.data.insert(new_frame.data.cbegin(), img_data, img_data+(desc.width*desc.height*4));
new_frame.data.insert(new_frame.data.cend(), img_data, img_data+(desc.width*desc.height*4));

free(img_data);
return res;
Expand Down
2 changes: 1 addition & 1 deletion src/image_loader_sdl_bmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ImageLoaderSDLBMP::ImageResult ImageLoaderSDLBMP::loadFromMemoryRGBA(const uint8

auto& new_frame = res.frames.emplace_back();
new_frame.ms = 0;
new_frame.data.insert(new_frame.data.cbegin(), (const uint8_t*)conv_surf->pixels, ((const uint8_t*)conv_surf->pixels) + (surf->w*surf->h*4));
new_frame.data.insert(new_frame.data.cend(), (const uint8_t*)conv_surf->pixels, ((const uint8_t*)conv_surf->pixels) + (surf->w*surf->h*4));

SDL_UnlockSurface(conv_surf);
SDL_DestroySurface(conv_surf);
Expand Down
2 changes: 1 addition & 1 deletion src/image_loader_sdl_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ImageLoaderSDLImage::ImageResult ImageLoaderSDLImage::loadFromMemoryRGBA(const u

auto& new_frame = res.frames.emplace_back();
new_frame.ms = anim->delays[i];
new_frame.data.insert(new_frame.data.cbegin(), (const uint8_t*)conv_surf->pixels, ((const uint8_t*)conv_surf->pixels) + (anim->w*anim->h*4));
new_frame.data.insert(new_frame.data.cend(), (const uint8_t*)conv_surf->pixels, ((const uint8_t*)conv_surf->pixels) + (anim->w*anim->h*4));

SDL_UnlockSurface(conv_surf);
SDL_DestroySurface(conv_surf);
Expand Down
4 changes: 2 additions & 2 deletions src/image_loader_stb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ImageLoaderSTB::ImageResult ImageLoaderSTB::loadFromMemoryRGBA(const uint8_t* da
for (int i = 0; i < z; i++) {
auto& new_frame = res.frames.emplace_back();
new_frame.ms = delays[i];
new_frame.data.insert(new_frame.data.cbegin(), img_data + (i*stride), img_data + ((i+1)*stride));
new_frame.data.insert(new_frame.data.cend(), img_data + (i*stride), img_data + ((i+1)*stride));
}

stbi_image_free(delays); // hope this is right
Expand All @@ -62,7 +62,7 @@ ImageLoaderSTB::ImageResult ImageLoaderSTB::loadFromMemoryRGBA(const uint8_t* da

auto& new_frame = res.frames.emplace_back();
new_frame.ms = 0;
new_frame.data.insert(new_frame.data.cbegin(), img_data, img_data+(x*y*4));
new_frame.data.insert(new_frame.data.cend(), img_data, img_data+(x*y*4));

stbi_image_free(img_data);
return res;
Expand Down
2 changes: 1 addition & 1 deletion src/image_loader_webp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ImageLoaderWebP::ImageResult ImageLoaderWebP::loadFromMemoryRGBA(const uint8_t*
auto& new_frame = res.frames.emplace_back();
new_frame.ms = timestamp-prev_timestamp;
prev_timestamp = timestamp;
new_frame.data.insert(new_frame.data.end(), buf, buf+(res.width*res.height*4));
new_frame.data.insert(new_frame.data.cend(), buf, buf+(res.width*res.height*4));
}

assert(anim_info.frame_count == res.frames.size());
Expand Down