Index: src/vteseq.c
===================================================================
RCS file: /cvs/gnome/vte/src/vteseq.c,v
retrieving revision 1.11
diff -U5 -r1.11 vteseq.c
--- src/vteseq.c	17 Aug 2006 21:33:07 -0000	1.11
+++ src/vteseq.c	29 Aug 2006 18:50:07 -0000
@@ -1030,15 +1030,21 @@
 }
 
 static void
 vte_terminal_beep(VteTerminal *terminal)
 {
-	GdkDisplay *display;
+	GtkWindow *window;
 
 	g_assert(VTE_IS_TERMINAL(terminal));
-	display = gtk_widget_get_display(GTK_WIDGET(terminal));
-	gdk_display_beep(display);
+
+	window = gtk_widget_get_toplevel (terminal);
+        if (window != NULL && 
+            GTK_IS_WINDOW (window) &&
+            GTK_WIDGET_TOPLEVEL (window))
+          {
+            gdk_window_beep(GTK_WIDGET (window)->window);
+          }
 }
 
 /* Beep. */
 static gboolean
 vte_sequence_handler_bl(VteTerminal *terminal,
