diff options
m--------- | depends/mglpp | 0 | ||||
-rw-r--r-- | include/QuickMedia.hpp | 1 | ||||
-rw-r--r-- | src/ImageViewer.cpp | 2 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 22 | ||||
-rw-r--r-- | src/Tabs.cpp | 2 |
5 files changed, 6 insertions, 21 deletions
diff --git a/depends/mglpp b/depends/mglpp -Subproject b1376994950a48684f8a223172b196aae4454d4 +Subproject c56af6cf176671182e42afc27ac4392fb13b2c4 diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index d4166ec..f476396 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -156,7 +156,6 @@ namespace QuickMedia { mgl::Window window; Matrix *matrix = nullptr; bool is_login_sync = false; - int monitor_hz; mgl::vec2i window_size; const char *plugin_name = nullptr; mgl::Texture plugin_logo; diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp index 731099f..9071214 100644 --- a/src/ImageViewer.cpp +++ b/src/ImageViewer.cpp @@ -358,7 +358,7 @@ namespace QuickMedia { window->draw(page_text_background); auto page_text_bounds = page_text.get_bounds(); - page_text.set_position(mgl::vec2f(std::floor(window_size.x * 0.5f - page_text_bounds.size.x * 0.5f), std::floor(window_size.y - background_height * 0.5f - font_height * 0.6f))); + page_text.set_position(mgl::vec2f(std::floor(window_size.x * 0.5f - page_text_bounds.size.x * 0.5f), std::floor(window_size.y - background_height * 0.5f - font_height * 0.7f))); window->draw(page_text); // Free pages that are not visible on the screen diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 0afd824..b364fe0 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -68,6 +68,7 @@ static int FPS_IDLE; static const double IDLE_TIMEOUT_SEC = 2.0; static const mgl::vec2i AVATAR_THUMBNAIL_SIZE(std::floor(32), std::floor(32)); static const float more_items_height = 2.0f; +static const int FPS_SYNC_TO_VSYNC = 0; static const std::pair<const char*, const char*> valid_plugins[] = { std::make_pair("launcher", nullptr), @@ -151,19 +152,6 @@ static void for_each_active_monitor_output(Display *display, std::function<void( XRRFreeScreenResources(screen_res); } -static int get_monitor_max_hz(Display *display) { - unsigned long max_hz = 0; - for_each_active_monitor_output(display, [&max_hz](const XRRCrtcInfo*, const XRRModeInfo *mode_info) { - unsigned long total = mode_info->hTotal * mode_info->vTotal; - if(total > 0) - max_hz = std::max(max_hz, (unsigned long)std::round((double)mode_info->dotClock / (double)total)); - }); - - if(max_hz == 0) - return 60; - return std::min(max_hz, 144UL); -} - static int get_largest_monitor_height(Display *display) { int max_height = 0; @@ -674,10 +662,8 @@ namespace QuickMedia { XSetErrorHandler(x_error_handler); XSetIOErrorHandler(x_io_error_handler); - monitor_hz = get_monitor_max_hz(disp); - window.set_framerate_limit(monitor_hz); + window.set_framerate_limit(FPS_SYNC_TO_VSYNC); idle = false; - fprintf(stderr, "Monitor hz: %d\n", monitor_hz); if(create_directory_recursive(get_cache_dir().join("media")) != 0) { show_notification("QuickMedia", "Failed to create media directory", Urgency::CRITICAL); @@ -1322,7 +1308,7 @@ namespace QuickMedia { void Program::idle_active_handler() { if(idle) - window.set_framerate_limit(monitor_hz); + window.set_framerate_limit(FPS_SYNC_TO_VSYNC); idle = false; idle_timer.restart(); } @@ -3702,7 +3688,7 @@ namespace QuickMedia { window.draw(chapter_text_background); auto text_bounds = chapter_text.get_bounds(); - chapter_text.set_position(vec2f_floor(window_size.x * 0.5f - text_bounds.size.x * 0.5f, window_size.y - bottom_panel_height * 0.5f - font_height * 0.6f)); + chapter_text.set_position(vec2f_floor(window_size.x * 0.5f - text_bounds.size.x * 0.5f, window_size.y - bottom_panel_height * 0.5f - font_height * 0.7f)); window.draw(chapter_text); window.display(); diff --git a/src/Tabs.cpp b/src/Tabs.cpp index db25ffb..3d0dc76 100644 --- a/src/Tabs.cpp +++ b/src/Tabs.cpp @@ -99,7 +99,7 @@ namespace QuickMedia { const int num_visible_tabs = std::min((int)tabs.size(), std::max(1, (int)(width / tab_min_width))); width_per_tab = std::floor(width / num_visible_tabs); - const float tab_text_y = std::floor(pos.y + tab_height*0.5f - (tab_text_size + 13.0f*get_config().scale)*0.5f); + const float tab_text_y = std::floor(pos.y + tab_height*0.5f - tab_text_size); tab_background_width = std::floor(width_per_tab - tab_margin_x*2.0f); background.set_size(mgl::vec2f(tab_background_width, tab_height)); |