+#if GTK_CHECK_VERSION(3,20,0)
+ /*
+ * Grabbing the keyboard in GTK 3.20 requires the new notion of
+ * GdkSeat.
+ */
+ GdkSeat *seat;
+
+ seat = gdk_display_get_default_seat
+ (gtk_widget_get_display(ctx->dialog));
+ if (!seat)
+ return FALSE;
+
+ ctx->seat = seat;
+ ret = gdk_seat_grab(seat, gtk_widget_get_window(ctx->dialog),
+ GDK_SEAT_CAPABILITY_KEYBOARD,
+ TRUE, NULL, NULL, NULL, NULL);
+#elif GTK_CHECK_VERSION(3,0,0)