diff options
author | David Robillard <d@drobilla.net> | 2019-11-03 20:16:38 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-11-03 20:16:38 +0100 |
commit | b4e7a7cc20eec3784a70e53bd772f401d61acdb7 (patch) | |
tree | d6dda586d7d403e1cc5ef4c70392751512626b85 | |
parent | e05826ac5d24d916be78cd594f172041f8dcc8bf (diff) | |
download | jalv-b4e7a7cc20eec3784a70e53bd772f401d61acdb7.tar.gz jalv-b4e7a7cc20eec3784a70e53bd772f401d61acdb7.tar.bz2 jalv-b4e7a7cc20eec3784a70e53bd772f401d61acdb7.zip |
Use screen refresh rate with Gtk3 and Qt5
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | src/jalv.c | 3 | ||||
-rw-r--r-- | src/jalv_console.c | 6 | ||||
-rw-r--r-- | src/jalv_gtk.c | 13 | ||||
-rw-r--r-- | src/jalv_gtkmm2.cpp | 6 | ||||
-rw-r--r-- | src/jalv_internal.h | 3 | ||||
-rw-r--r-- | src/jalv_qt.cpp | 11 | ||||
m--------- | waflib | 0 | ||||
-rw-r--r-- | wscript | 2 |
9 files changed, 47 insertions, 3 deletions
@@ -1,3 +1,9 @@ +jalv (1.6.3) unstable; + + * Use screen refresh rate with Gtk3 and Qt5 + + -- David Robillard <d@drobilla.net> Sun, 03 Nov 2019 19:15:04 +0000 + jalv (1.6.2) stable; * Fix compilation with recent Gtkmm versions that require C++11 @@ -1019,8 +1019,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv) if (jalv->opts.update_rate == 0.0) { /* Calculate a reasonable UI update frequency. */ - jalv->ui_update_hz = jalv->sample_rate / jalv->midi_buf_size * 2.0f; - jalv->ui_update_hz = MAX(25.0f, jalv->ui_update_hz); + jalv->ui_update_hz = jalv_ui_refresh_rate(jalv); } else { /* Use user-specified UI update rate. */ jalv->ui_update_hz = jalv->opts.update_rate; diff --git a/src/jalv_console.c b/src/jalv_console.c index 413a524..7d11714 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -250,6 +250,12 @@ jalv_run_custom_ui(Jalv* jalv) return false; } +float +jalv_ui_refresh_rate(Jalv* jalv) +{ + return 30.0f; +} + int jalv_open_ui(Jalv* jalv) { diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index dca5241..8ca8258 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -1153,6 +1153,19 @@ jalv_discover_ui(ZIX_UNUSED Jalv* jalv) return TRUE; } +float +jalv_ui_refresh_rate(Jalv* jalv) +{ +#if GTK_MAJOR_VERSION == 2 + return 30.0f; +#else + GdkDisplay* const display = gdk_display_get_default(); + GdkMonitor* const monitor = gdk_display_get_primary_monitor(display); + + return (float)gdk_monitor_get_refresh_rate(monitor); +#endif +} + int jalv_open_ui(Jalv* jalv) { diff --git a/src/jalv_gtkmm2.cpp b/src/jalv_gtkmm2.cpp index 49b9aa9..3f5a0e9 100644 --- a/src/jalv_gtkmm2.cpp +++ b/src/jalv_gtkmm2.cpp @@ -58,6 +58,12 @@ jalv_discover_ui(Jalv* jalv) return true; } +float +jalv_ui_refresh_rate(Jalv* jalv) +{ + return 30.0f; +} + int jalv_open_ui(Jalv* jalv) { diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 3fd7b05..4d25109 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -392,6 +392,9 @@ jalv_native_ui_type(void); bool jalv_discover_ui(Jalv* jalv); +float +jalv_ui_refresh_rate(Jalv* jalv); + int jalv_open_ui(Jalv* jalv); diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp index 80141f2..5084c03 100644 --- a/src/jalv_qt.cpp +++ b/src/jalv_qt.cpp @@ -31,6 +31,7 @@ # include <QMainWindow> # include <QMenu> # include <QMenuBar> +# include <QScreen> # include <QScrollArea> # include <QStyle> # include <QTimer> @@ -673,6 +674,16 @@ jalv_discover_ui(Jalv* jalv) return true; } +float +jalv_ui_refresh_rate(Jalv* jalv) +{ +#if QT_VERSION >= 0x050000 + return (float)QGuiApplication::primaryScreen()->refreshRate(); +#else + return 30.0f; +#endif +} + int jalv_open_ui(Jalv* jalv) { diff --git a/waflib b/waflib -Subproject de76b89dc1039e2f7d6c6b229a8950156b0e5c9 +Subproject 0bde0c2e022c479b8c7e3933eca0cbc01282562 @@ -7,7 +7,7 @@ from waflib import Options from waflib.extras import autowaf as autowaf # Version of this package (even if built as a child) -JALV_VERSION = '1.6.2' +JALV_VERSION = '1.6.3' # Variables for 'waf dist' APPNAME = 'jalv' |