aboutsummaryrefslogtreecommitdiff
path: root/ui/gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 692ccc7bbb..7355d34fcf 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1966,6 +1966,11 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
GSList *group, GtkWidget *view_menu)
{
bool zoom_to_fit = false;
+ int refresh_rate_millihz;
+
+ GdkDisplay *dpy = gtk_widget_get_display(s->window);
+ GdkWindow *win = gtk_widget_get_window(s->window);
+ GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
vc->label = qemu_console_get_label(con);
vc->s = s;
@@ -2026,6 +2031,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
vc->gfx.kbd = qkbd_state_init(con);
vc->gfx.dcl.con = con;
+
+ refresh_rate_millihz = gdk_monitor_get_refresh_rate(monitor);
+ if (refresh_rate_millihz) {
+ vc->gfx.dcl.update_interval = MILLISEC_PER_SEC / refresh_rate_millihz;
+ }
+
register_displaychangelistener(&vc->gfx.dcl);
gd_connect_vc_gfx_signals(vc);