aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/QuickMedia.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 13b9369..79b9207 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -542,16 +542,21 @@ namespace QuickMedia {
return exit_code;
}
- static sf::Vector2i get_focused_monitor_center(Display *disp) {
+ static sf::Vector2i get_focused_monitor_center(Display *disp, sf::Vector2i &monitor_size) {
int screen = DefaultScreen(disp);
- int screen_center_x = DisplayWidth(disp, screen) / 2;
- int screen_center_y = DisplayHeight(disp, screen) / 2;
+ monitor_size.x = DisplayWidth(disp, screen);
+ monitor_size.y = DisplayWidth(disp, screen);
+ int screen_center_x = monitor_size.x / 2;
+ int screen_center_y = monitor_size.y / 2;
sf::Vector2i focused_monitor_center(screen_center_x, screen_center_y);
auto mouse_pos = sf::Mouse::getPosition();
- for_each_active_monitor_output(disp, [&focused_monitor_center, mouse_pos](const XRRCrtcInfo *crtc_info, const XRRModeInfo*){
- if(sf::Rect<int>(crtc_info->x, crtc_info->y, crtc_info->width, crtc_info->height).contains(mouse_pos))
+ for_each_active_monitor_output(disp, [&focused_monitor_center, mouse_pos, &monitor_size](const XRRCrtcInfo *crtc_info, const XRRModeInfo*){
+ if(sf::Rect<int>(crtc_info->x, crtc_info->y, crtc_info->width, crtc_info->height).contains(mouse_pos)) {
+ monitor_size.x = crtc_info->width;
+ monitor_size.y = crtc_info->height;
focused_monitor_center = sf::Vector2i(crtc_info->x + crtc_info->width/2, crtc_info->y + crtc_info->height/2);
+ }
});
return focused_monitor_center;
@@ -566,7 +571,13 @@ namespace QuickMedia {
wm_delete_window_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False);
int screen = DefaultScreen(disp);
- sf::Vector2i focused_monitor_center = get_focused_monitor_center(disp);
+ sf::Vector2i monitor_size;
+ sf::Vector2i focused_monitor_center = get_focused_monitor_center(disp, monitor_size);
+
+ if(strcmp(plugin_name, "download") == 0) {
+ window_size.x = std::min(1080, monitor_size.x);
+ window_size.y = std::min(720, monitor_size.y);
+ }
x11_window = XCreateWindow(disp, parent_window ? parent_window : DefaultRootWindow(disp),
focused_monitor_center.x - window_size.x * 0.5f, focused_monitor_center.y - window_size.y * 0.5f, window_size.x, window_size.y, 0,
@@ -5977,9 +5988,10 @@ namespace QuickMedia {
return;
}
- sf::Vector2i focused_monitor_center = get_focused_monitor_center(disp);
- window_size.x = std::floor(300.0f + 380.0f * get_ui_scale());
- window_size.y = std::floor(50.0f + 130.0f * get_ui_scale());
+ sf::Vector2i monitor_size;
+ sf::Vector2i focused_monitor_center = get_focused_monitor_center(disp, monitor_size);
+ window_size.x = std::min(monitor_size.x, (int)(300.0f + 380.0f * get_ui_scale()));
+ window_size.y = std::min(monitor_size.y, (int)(50.0f + 130.0f * get_ui_scale()));
window.setSize(sf::Vector2u(window_size.x, window_size.y));
XSizeHints *size_hints = XAllocSizeHints();
if(size_hints) {
@@ -6130,7 +6142,7 @@ namespace QuickMedia {
cleanup:
downloader->stop(download_completed);
if(download_completed) {
- show_notification("QuickMedia", std::string("Download finished! Downloaded ") + url + " to " + output_filepath);
+ show_notification("QuickMedia", std::string("Download finished! Downloaded ") + Path(filename).filename() + " to " + output_filepath);
exit_code = 0;
} else {
show_notification("QuickMedia", std::string("Failed to download ") + url + " to " + output_filepath, Urgency::CRITICAL);