aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-12-08 18:44:15 +0100
committerdec05eba <dec05eba@protonmail.com>2023-12-08 18:44:15 +0100
commit35926e01aba7cd7584093af75ce614c054204f86 (patch)
tree98fe9c4f1346e31a3a14ac73c52032ff72caefd0 /src
parent5476474c1ceb86814676750de59b2838fd83230f (diff)
Add class hint, wm name, window type, transient for
Diffstat (limited to 'src')
-rw-r--r--src/DownloadUtils.cpp7
-rw-r--r--src/QuickMedia.cpp15
2 files changed, 13 insertions, 9 deletions
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;
}
}