aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------depends/mglpp0
-rw-r--r--include/DownloadUtils.hpp2
-rw-r--r--src/DownloadUtils.cpp7
-rw-r--r--src/QuickMedia.cpp15
4 files changed, 14 insertions, 10 deletions
diff --git a/depends/mglpp b/depends/mglpp
-Subproject 8070b486e5951dc8f2284696c359fce791e69fb
+Subproject 3070a4267f1ec136e1e35cc4b78f2995e0da4e9
diff --git a/include/DownloadUtils.hpp b/include/DownloadUtils.hpp
index d8aba2e..d1f7f56 100644
--- a/include/DownloadUtils.hpp
+++ b/include/DownloadUtils.hpp
@@ -32,6 +32,6 @@ namespace QuickMedia {
// Note: if |cloudflare_bypass| is set to true then tls is limited to version 1.1 and the user agent is changed.
DownloadResult download_to_file(const std::string &url, const std::string &destination_filepath, const std::vector<CommandArg> &additional_args, bool use_browser_useragent = false, bool cloudflare_bypass = false);
// Returns false if there was an error trying to create the download process
- bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool no_video, const std::string &filename, bool download_no_dialog);
+ bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool no_video, const std::string &filename, bool download_no_dialog, long transient_for_window);
DownloadResult download_to_json(const std::string &url, rapidjson::Document &result, const std::vector<CommandArg> &additional_args, bool use_browser_useragent = false, bool fail_on_error = true);
} \ No newline at end of file
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp
index 913857b..42e60fd 100644
--- a/src/DownloadUtils.cpp
+++ b/src/DownloadUtils.cpp
@@ -310,7 +310,7 @@ namespace QuickMedia {
return DownloadResult::OK;
}
- bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool no_video, const std::string &filename, bool download_no_dialog) {
+ bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool no_video, const std::string &filename, bool download_no_dialog, long transient_for_window) {
char quickmedia_path[PATH_MAX];
ssize_t bytes_written = readlink("/proc/self/exe", quickmedia_path, sizeof(quickmedia_path) - 1);
if(bytes_written == -1)
@@ -318,7 +318,10 @@ namespace QuickMedia {
else
quickmedia_path[bytes_written] = '\0';
- std::vector<const char*> args = { quickmedia_path, "download", "-u", url.c_str(), "--dir", file_manager_start_dir.c_str() };
+ char transient_for_window_str[32];
+ snprintf(transient_for_window_str, sizeof(transient_for_window_str), "%ld", transient_for_window);
+
+ std::vector<const char*> args = { quickmedia_path, "download", "-u", url.c_str(), "--dir", file_manager_start_dir.c_str(), "-e", transient_for_window_str };
if(no_video)
args.push_back("--no-video");
if(download_no_dialog)
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index a7bea3c..9c786a7 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -720,7 +720,8 @@ namespace QuickMedia {
window_create_params.max_size = window_size;
}
window_create_params.hidden = no_dialog;
- window_create_params.parent_window = parent_window;
+ window_create_params.parent_window = is_download ? 0 : parent_window;
+ window_create_params.transient_for_window = is_download ? parent_window : 0;
window_create_params.background_color = get_theme().background_color;
window_create_params.class_name = "quickmedia";
window_create_params.window_type = is_download ? MGL_WINDOW_TYPE_DIALOG : MGL_WINDOW_TYPE_NORMAL;
@@ -3102,7 +3103,7 @@ namespace QuickMedia {
separate_audio_option = false;
if(!separate_audio_option) {
- download_async_gui(url, file_manager_start_dir.string(), no_video, filename, download_no_dialog);
+ download_async_gui(url, file_manager_start_dir.string(), no_video, filename, download_no_dialog, window.get_system_handle());
return;
}
@@ -3132,7 +3133,7 @@ namespace QuickMedia {
if(!selected)
return;
- download_async_gui(url, file_manager_start_dir.string(), audio_only, filename, download_no_dialog);
+ download_async_gui(url, file_manager_start_dir.string(), audio_only, filename, download_no_dialog, window.get_system_handle());
}
bool Program::video_download_if_non_streamable(std::string &video_url, std::string &audio_url, bool &is_audio_only, bool &has_embedded_audio, PageType previous_page) {
@@ -4952,7 +4953,7 @@ namespace QuickMedia {
} else if(event.key.code == mgl::Keyboard::S && event.key.control) {
BodyItem *selected_item = thread_body->get_selected();
if(selected_item && !selected_item->url.empty())
- download_async_gui(selected_item->url, file_manager_start_dir.string(), false, "", event.key.shift);
+ download_async_gui(selected_item->url, file_manager_start_dir.string(), false, "", event.key.shift, window.get_system_handle());
}
BodyItem *selected_item = thread_body->get_selected();
@@ -5069,7 +5070,7 @@ namespace QuickMedia {
redraw = true;
frame_skip_text_entry = true;
} else if(event.key.code == mgl::Keyboard::S && event.key.control) {
- download_async_gui(attached_image_url, file_manager_start_dir.string(), false, "", event.key.shift);
+ download_async_gui(attached_image_url, file_manager_start_dir.string(), false, "", event.key.shift, window.get_system_handle());
}
}
}
@@ -6790,7 +6791,7 @@ namespace QuickMedia {
avatar_applied = false;
return true;
} else if(message_type == MessageType::FILE) {
- download_async_gui(selected->url, file_manager_start_dir.string(), no_video, filename, false);
+ download_async_gui(selected->url, file_manager_start_dir.string(), no_video, filename, false, window.get_system_handle());
return true;
}
@@ -6854,7 +6855,7 @@ namespace QuickMedia {
else if(string_starts_with(filename, file_prefix))
filename.erase(filename.begin(), filename.begin() + strlen(file_prefix));
- download_async_gui(selected->url, file_manager_start_dir.string(), no_video, filename, no_dialog);
+ download_async_gui(selected->url, file_manager_start_dir.string(), no_video, filename, no_dialog, window.get_system_handle());
return true;
}
}