diff --git a/shell/ev-application.c b/shell/ev-application.c
index fc7a0e9..64415ce 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -651,15 +651,17 @@ ev_application_open_uri_in_window (EvApplication  *application,
 
 #ifdef GDK_WINDOWING_X11
 	gdk_window = gtk_widget_get_window (GTK_WIDGET (ev_window));
+	if (GDK_IS_X11_WINDOW (gdk_window)) {
+		if (timestamp <= 0)
+			timestamp = gdk_x11_get_server_time (gdk_window);
+		gdk_x11_window_set_user_time (gdk_window, timestamp);
 
-	if (timestamp <= 0)
-		timestamp = gdk_x11_get_server_time (gdk_window);
-	gdk_x11_window_set_user_time (gdk_window, timestamp);
-
-	gtk_window_present (GTK_WINDOW (ev_window));
-#else
-	gtk_window_present_with_time (GTK_WINDOW (ev_window), timestamp);
+		gtk_window_present (GTK_WINDOW (ev_window));
+	} else
 #endif /* GDK_WINDOWING_X11 */
+	{
+		gtk_window_present_with_time (GTK_WINDOW (ev_window), timestamp);
+	}
 }
 
 static void
@@ -748,15 +750,17 @@ ev_application_open_window (EvApplication *application,
 
 #ifdef GDK_WINDOWING_X11
 	gdk_window = gtk_widget_get_window (GTK_WIDGET (new_window));
+	if (GDK_IS_X11_WINDOW (gdk_window)) {
+		if (timestamp <= 0)
+			timestamp = gdk_x11_get_server_time (gdk_window);
+		gdk_x11_window_set_user_time (gdk_window, timestamp);
 
-	if (timestamp <= 0)
-		timestamp = gdk_x11_get_server_time (gdk_window);
-	gdk_x11_window_set_user_time (gdk_window, timestamp);
-
-	gtk_window_present (GTK_WINDOW (new_window));
-#else
-	gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
+		gtk_window_present (GTK_WINDOW (new_window));
+	} else
 #endif /* GDK_WINDOWING_X11 */
+	{
+		gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
+	}
 }
 
 #ifdef ENABLE_DBUS
