diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-04-06 22:54:12 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-04-06 22:54:12 +0200 |
commit | d3543b4f6d654cae1d1d9ffe1f640106dad5cfed (patch) | |
tree | e51f99400cb67dd8643393f82f2e10478750e7ba /include | |
parent | 04e852c45a3f309d5e139b0ca059b32277c250e4 (diff) |
Add support for embedding the window into another application, such as suckless tabbed
Diffstat (limited to 'include')
-rw-r--r-- | include/ImageViewer.hpp | 6 | ||||
-rw-r--r-- | include/QuickMedia.hpp | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/include/ImageViewer.hpp b/include/ImageViewer.hpp index f886709..cd1bc8f 100644 --- a/include/ImageViewer.hpp +++ b/include/ImageViewer.hpp @@ -46,9 +46,9 @@ namespace QuickMedia { class ImageViewer { public: - ImageViewer(MangaImagesPage *manga_images_page, const std::string &content_title, const std::string &chapter_title, int current_page, const Path &chapter_cache_dir); + ImageViewer(sf::RenderWindow *window, MangaImagesPage *manga_images_page, const std::string &content_title, const std::string &chapter_title, int current_page, const Path &chapter_cache_dir); ~ImageViewer(); - ImageViewerAction draw(sf::RenderWindow &window); + ImageViewerAction draw(); // Returns page as 1 indexed int get_focused_page() const; int get_num_pages() const { return num_pages; } @@ -57,6 +57,8 @@ namespace QuickMedia { bool render_page(sf::RenderWindow &window, int page, double offset_y); sf::Vector2<double> get_page_size(int page); private: + sf::RenderWindow *window; + int current_page; int num_pages; int page_center; diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index c6cd7b5..a8692bf 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -95,7 +95,9 @@ namespace QuickMedia { void manga_get_watch_history(const char *plugin_name, BodyItems &history_items); void youtube_get_watch_history(BodyItems &history_items); private: + void init(Window parent_window); void load_plugin_by_name(std::vector<Tab> &tabs, const char *start_dir); + void handle_window_close(); void base_event_handler(sf::Event &event, PageType previous_page, Body *body, SearchBar *search_bar, bool handle_key_press = true, bool handle_searchbar = true); void event_idle_handler(const sf::Event &event); void idle_active_handler(); @@ -188,5 +190,8 @@ namespace QuickMedia { bool idle = true; bool low_cpu_mode = false; std::string pipe_selected_text; + Window x11_window = None; + Atom wm_delete_window_atom; + XEvent xev; }; }
\ No newline at end of file |