From 15d06abbc5a8752631288441131b3ebf9124f25b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 9 Mar 2022 01:23:22 +0100 Subject: Fix compile on clang --- depends/mglpp | 2 +- include/Body.hpp | 2 +- include/QuickMedia.hpp | 10 +++++----- src/Body.cpp | 4 ++-- src/QuickMedia.cpp | 3 ++- src/main.cpp | 1 + 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/depends/mglpp b/depends/mglpp index 37d6eed..e8113a5 160000 --- a/depends/mglpp +++ b/depends/mglpp @@ -1 +1 @@ -Subproject commit 37d6eeddea15ccfb79dc565fdc6b0e9aa0eaeffb +Subproject commit e8113a53d8b9d91db3728ac875b49b17a1ed6659 diff --git a/include/Body.hpp b/include/Body.hpp index 45749ce..ec73a29 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -20,7 +20,7 @@ namespace Json { namespace QuickMedia { void init_body_themes(); - class ThumbnailData; + struct ThumbnailData; using BodyItemRenderCallback = std::function &body_item)>; // Return true to merge using BodyItemMergeHandler = std::function; diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index f93b47c..d7680ff 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -18,14 +18,15 @@ #include #include #include -#include + +typedef struct _XDisplay Display; namespace QuickMedia { class Matrix; class FileManager; class MangaImagesPage; class ImageBoardThreadPage; - class RoomData; + struct RoomData; class MatrixChatPage; class VideoPage; class Tabs; @@ -111,7 +112,7 @@ namespace QuickMedia { void set_clipboard(const std::string &str); private: - void init(Window parent_window, std::string &program_path); + void init(unsigned long parent_window, std::string &program_path); void load_plugin_by_name(std::vector &tabs, int &start_tab_index, FileManagerMimeType fm_mime_type, FileSelectionHandler file_selection_handler, std::string instance); void common_event_handler(mgl::Event &event); void handle_x11_events(); @@ -125,7 +126,7 @@ namespace QuickMedia { using PageLoopSubmitHandler = std::function &new_tabs)>; // Returns false if the page loop was escaped by user navigation (pressing escape) or if there was an error at startup bool page_loop(std::vector &tabs, int start_tab_index = 0, PageLoopSubmitHandler after_submit_handler = nullptr, bool go_to_previous_on_escape = true); - void video_page_download_video(const std::string &url, mgl::WindowHandle video_player_window = None); + void video_page_download_video(const std::string &url, mgl::WindowHandle video_player_window = 0); bool video_download_if_non_streamable(std::string &video_url, std::string &audio_url, bool &is_audio_only, bool &has_embedded_audio, PageType previous_page); int video_get_max_height(); void video_content_page(Page *parent_page, VideoPage *video_page, std::string video_title, bool download_if_streaming_fails, Body *parent_body, int play_index, int *parent_body_page = nullptr, const std::string &parent_page_search = ""); @@ -215,7 +216,6 @@ namespace QuickMedia { bool low_cpu_mode = false; bool window_closed = false; std::string pipe_selected_text; - XEvent xev; std::filesystem::path file_manager_start_dir; std::string youtube_url; std::unique_ptr video_player; diff --git a/src/Body.cpp b/src/Body.cpp index 1c436f5..dbcaab0 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -1484,7 +1484,7 @@ namespace QuickMedia { item_pos.y += body_spacing[body_theme].reaction_padding_y; float reaction_max_height = 0.0f; // TODO: Fix first row wrap-around - for(int i = 0; i < item->reactions.size(); ++i) { + for(int i = 0; i < (int)item->reactions.size(); ++i) { auto &reaction = item->reactions[i]; reaction.text->updateGeometry(); reaction_max_height = std::max(reaction_max_height, reaction.text->getHeight()); @@ -1704,7 +1704,7 @@ namespace QuickMedia { float reaction_offset_x = 0.0f; item_height += body_spacing[body_theme].reaction_padding_y; float reaction_max_height = 0.0f; - for(int i = 0; i < item->reactions.size(); ++i) { + for(int i = 0; i < (int)item->reactions.size(); ++i) { auto &reaction = item->reactions[i]; reaction.text->setMaxWidth(text_max_width); reaction.text->updateGeometry(); diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 0da90f9..cf7d058 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -63,6 +63,7 @@ extern "C" { } #include #include +#include #include #include #include @@ -650,7 +651,7 @@ namespace QuickMedia { return focused_monitor_center; } - void Program::init(Window parent_window, std::string &program_path) { + void Program::init(unsigned long parent_window, std::string &program_path) { disp = XOpenDisplay(NULL); if (!disp) { show_notification("QuickMedia", "Failed to open display to X11 server", Urgency::CRITICAL); diff --git a/src/main.cpp b/src/main.cpp index 15041d5..52cb374 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,6 @@ #include "../include/QuickMedia.hpp" #include +#include int main(int argc, char **argv) { XInitThreads(); -- cgit v1.2.3