aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-19 21:41:02 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-19 21:41:02 +0100
commitb85c9839ae86247179a4adf7f2e90f194380cb93 (patch)
tree6acc70d99ea5671900f75fddac5fed93656d6692 /src/QuickMedia.cpp
parent1e436a6b791f631eb18281bc63366f43a7c8ba8a (diff)
Dont set fps, let vsync handle that
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp22
1 files changed, 4 insertions, 18 deletions
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();