From 5476474c1ceb86814676750de59b2838fd83230f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 8 Dec 2023 18:21:31 +0100 Subject: Make dialog window a real dialog window --- src/QuickMedia.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index edf7851..a7bea3c 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -702,8 +702,9 @@ namespace QuickMedia { mgl::vec2i monitor_size; mgl::vec2i focused_monitor_center = get_focused_monitor_center(disp, monitor_size); + const bool is_download = strcmp(plugin_name, "download") == 0; - if(strcmp(plugin_name, "download") == 0) { + if(is_download) { window_size.x = std::min(900, monitor_size.x - 100); window_size.y = std::min(900, monitor_size.y - 100); } else { @@ -714,13 +715,15 @@ namespace QuickMedia { mgl::Window::CreateParams window_create_params; window_create_params.position = { focused_monitor_center.x - window_size.x / 2, focused_monitor_center.y - window_size.y / 2 }; window_create_params.size = window_size; - if(strcmp(plugin_name, "download") == 0) { + if(is_download) { window_create_params.min_size = window_size; window_create_params.max_size = window_size; } window_create_params.hidden = no_dialog; window_create_params.parent_window = parent_window; 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; if(!window.create("QuickMedia", std::move(window_create_params))) { show_notification("QuickMedia", "Failed to create opengl window", Urgency::CRITICAL); abort(); @@ -728,6 +731,11 @@ namespace QuickMedia { window.set_low_latency(get_config().low_latency_mode); + if(is_download) { + XSetInputFocus(disp, window.get_system_handle(), RevertToParent, CurrentTime); + XFlush(disp); + } + if(!program_path.empty() && program_path.back() != '/') program_path += '/'; -- cgit v1.2.3