aboutsummaryrefslogtreecommitdiff
path: root/ui/gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index c59297ff4d..850c49bee0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1968,14 +1968,16 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s)
static int gd_refresh_rate_millihz(GtkWidget *window)
{
#ifdef GDK_VERSION_3_22
- GdkDisplay *dpy = gtk_widget_get_display(window);
GdkWindow *win = gtk_widget_get_window(window);
- GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
- return gdk_monitor_get_refresh_rate(monitor);
-#else
- return 0;
+ if (win) {
+ GdkDisplay *dpy = gtk_widget_get_display(window);
+ GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
+
+ return gdk_monitor_get_refresh_rate(monitor);
+ }
#endif
+ return 0;
}
static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,