Index: capplets/display/xrandr-capplet.c
===================================================================
--- capplets/display/xrandr-capplet.c	(revision 8952)
+++ capplets/display/xrandr-capplet.c	(working copy)
@@ -74,13 +74,49 @@
 	GTK_DIALOG_DESTROY_WITH_PARENT,
 	GTK_MESSAGE_WARNING,
 	GTK_BUTTONS_OK, err->message);
+    
+    gtk_window_set_title (GTK_WINDOW (dialog), "");
+    
+    gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_destroy (dialog);
+}
+#endif
 
+static void
+show_error_dialog (gchar *err)
+{
+    if (!err)
+	return;
+    
+    GtkWidget *dialog = gtk_message_dialog_new (
+	NULL,
+	GTK_DIALOG_DESTROY_WITH_PARENT,
+	GTK_MESSAGE_WARNING,
+	GTK_BUTTONS_OK, "%s", err);
+    
     gtk_window_set_title (GTK_WINDOW (dialog), "");
+    
+    gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_destroy (dialog);
+}
 
+static void
+show_info_dialog (gchar *info)
+{
+    if (!info)
+	return;
+    
+    GtkWidget *dialog = gtk_message_dialog_new (
+	NULL,
+	GTK_DIALOG_DESTROY_WITH_PARENT,
+	GTK_MESSAGE_INFO,
+	GTK_BUTTONS_OK, "%s", info);
+    
+    gtk_window_set_title (GTK_WINDOW (dialog), "");
+    
     gtk_dialog_run (GTK_DIALOG (dialog));
     gtk_widget_destroy (dialog);
 }
-#endif
 
 static gboolean
 do_free (gpointer data)
@@ -1579,32 +1615,7 @@
     return atom;
 }
 
-static void
-compute_virtual_size_for_configuration (GnomeRRConfig *config, int *ret_width, int *ret_height)
-{
-    int i;
-    int width, height;
-
-    width = height = 0;
-
-    for (i = 0; config->outputs[i] != NULL; i++)
-    {
-	GnomeOutputInfo *output;
-
-	output = config->outputs[i];
-
-	if (output->on)
-	{
-	    width = MAX (width, output->x + output->width);
-	    height = MAX (height, output->y + output->height);
-	}
-    }
-
-    *ret_width = width;
-    *ret_height = height;
-}
-
-static void
+static gboolean
 check_required_virtual_size (App *app)
 {
     int req_width, req_height;
@@ -1626,11 +1637,32 @@
     if (!(min_width <= req_width && req_width <= max_width
 	  && min_height <= req_height && req_height <= max_height))
     {
-	/* FIXME: present a useful dialog, maybe even before the user tries to Apply */
 #if 0
 	g_debug ("Your X server needs a larger Virtual size!");
 #endif
+        
+        /* Save the desired settings here since, if the 
+         * framebuffer is not enough, the settings won't be
+         * saved to monitor.xml
+         */
+        GError *err = NULL;
+        gnome_rr_config_sanitize (app->current_configuration);
+        
+        /* try to save the desired settings even though the
+         * current framebuffer size is not enough
+         */
+        gnome_rr_config_save_desired (app->current_configuration, &err);
+        
+        gchar *error = g_strdup_printf (_("Please set the Virtual resolution to \"%d %d\" in your xorg.conf, log out and log back in again"), req_width, req_height);
+        
+        /* inform the user with an error dialog */
+        show_error_dialog (error);
+        g_free(error);
+        
+        return FALSE;
     }
+    else
+        return TRUE;
 }
 
 static void
@@ -1639,27 +1671,32 @@
     GError *err = NULL;
 
     gnome_rr_config_sanitize (app->current_configuration);
-
-    check_required_virtual_size (app);
-
+    
+    /* Don't try to apply the settings unless the framebuffer
+     * is enough. The user will be notified in 
+     * check_required_virtual_size()
+     */
+    if (check_required_virtual_size (app))
+    {
     foo_scroll_area_invalidate (FOO_SCROLL_AREA (app->area));
+    
+        if (gnome_rr_config_save (app->current_configuration, &err))
+        {
+        XEvent message;
 
-    if (gnome_rr_config_save (app->current_configuration, &err))
-    {
-	XEvent message;
+        message.xclient.type = ClientMessage;
+        message.xclient.message_type = gnome_randr_atom();
+        message.xclient.format = 8;
 
-	message.xclient.type = ClientMessage;
-	message.xclient.message_type = gnome_randr_atom();
-	message.xclient.format = 8;
-
 #if 0
 	g_debug ("Sending client message");
 #endif
 
-	XSendEvent (gdk_x11_get_default_xdisplay(),
-		    gdk_x11_get_default_root_xwindow(),
-		    FALSE,
-		    StructureNotifyMask, &message);
+        XSendEvent (gdk_x11_get_default_xdisplay(),
+                gdk_x11_get_default_root_xwindow(),
+                FALSE,
+                StructureNotifyMask, &message);
+        }
     }
 }
 
