diff -Npur gdm-old//configure.ac gdm-new/configure.ac
--- gdm-old//configure.ac	2014-12-17 02:32:25.000000000 +0800
+++ gdm-new/configure.ac	2014-12-17 02:31:57.000000000 +0800
@@ -42,6 +42,7 @@ dnl ------------------------------------
 DBUS_GLIB_REQUIRED_VERSION=0.74
 GLIB_REQUIRED_VERSION=2.15.4
 GTK_REQUIRED_VERSION=2.10.0
+GNOME_DESKTOP_REQUIRED_VERSION=2.26.3
 PANGO_REQUIRED_VERSION=1.3.0
 LIBGLADE_REQUIRED_VERSION=1.99.2
 SCROLLKEEPER_REQUIRED_VERSION=0.1.4
@@ -98,6 +99,7 @@ AC_SUBST(GCONF_CFLAGS)
 AC_SUBST(GCONF_LIBS)
 
 PKG_CHECK_MODULES(SIMPLE_GREETER,
+        gnome-desktop-2.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
         gtk+-2.0 >= $GTK_REQUIRED_VERSION
         libglade-2.0 >= $LIBGLADE_REQUIRED_VERSION
diff -Npur gdm-old//gui/simple-greeter/gdm-greeter-login-window.c gdm-new/gui/simple-greeter/gdm-greeter-login-window.c
--- gdm-old//gui/simple-greeter/gdm-greeter-login-window.c	2014-12-17 06:39:10.000000000 +0800
+++ gdm-new/gui/simple-greeter/gdm-greeter-login-window.c	2014-12-17 08:06:20.000000000 +0800
@@ -67,6 +67,13 @@
 #include "gdm-greeter-login-window.h"
 #include "gdm-user-chooser-widget.h"
 
+
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+
+#include <libgnomeui/gnome-rr-config.h>
+#include <libgnomeui/gnome-rr.h>
+#include <libgnomeui/gnome-rr-labeler.h>
+
 #ifdef HAVE_PAM
 #include <security/pam_appl.h>
 #define PW_ENTRY_SIZE PAM_MAX_RESP_SIZE
@@ -83,21 +90,22 @@
 #define CK_SEAT_INTERFACE    "org.freedesktop.ConsoleKit.Seat"
 #define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
 
-#define HAL_DBUS_SERVICE	"org.freedesktop.Hal"
-#define HAL_ROOT_COMPUTER	"/org/freedesktop/Hal/devices/computer"
-#define HAL_DBUS_INTERFACE_DEVICE	"org.freedesktop.Hal.Device"
-#define HAL_DBUS_INTERFACE_POWER	"org.freedesktop.Hal.Device.SystemPowerManagement"
+#define HAL_DBUS_SERVICE        "org.freedesktop.Hal"
+#define HAL_ROOT_COMPUTER        "/org/freedesktop/Hal/devices/computer"
+#define HAL_DBUS_INTERFACE_DEVICE        "org.freedesktop.Hal.Device"
+#define HAL_DBUS_INTERFACE_POWER        "org.freedesktop.Hal.Device.SystemPowerManagement"
 
 #define GLADE_XML_FILE       "gdm-greeter-login-window.glade"
 
 #define KEY_GREETER_DIR             "/apps/gdm/simple-greeter"
 #define KEY_BANNER_MESSAGE_ENABLED  KEY_GREETER_DIR "/banner_message_enable"
 #define KEY_BANNER_MESSAGE_TEXT     KEY_GREETER_DIR "/banner_message_text"
-#define KEY_LOGO_EDITABLE	    KEY_GREETER_DIR "/logo_info_editable"
-#define KEY_LOGO_NAME_LABEL	    KEY_GREETER_DIR "/logo_info_name_label"
-#define KEY_LOGO_VERSION_LABEL	    KEY_GREETER_DIR "/logo_info_version_label"
+#define KEY_LOGO_EDITABLE            KEY_GREETER_DIR "/logo_info_editable"
+#define KEY_LOGO_NAME_LABEL            KEY_GREETER_DIR "/logo_info_name_label"
+#define KEY_LOGO_VERSION_LABEL            KEY_GREETER_DIR "/logo_info_version_label"
 #define KEY_LOGO                    KEY_GREETER_DIR "/logo_icon_name"
 #define KEY_DISABLE_RESTART_BUTTONS KEY_GREETER_DIR "/disable_restart_buttons"
+#define KEY_GREETER_ON_MONITOR      KEY_GREETER_DIR "/greeter_on_primary_enable"
 #define GDM_GREETER_LOGIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_LOGIN_WINDOW, GdmGreeterLoginWindowPrivate))
 
 enum {
@@ -124,6 +132,7 @@ struct GdmGreeterLoginWindowPrivate
         GConfClient     *client;
 
         gboolean         caps_lock_on;
+        gboolean         greeter_on_primary;
 
         gboolean         banner_message_enabled;
         guint            gconf_cnxn;
@@ -553,12 +562,12 @@ can_suspend (GdmGreeterLoginWindow *logi
                                            HAL_DBUS_INTERFACE_DEVICE);
         ret = FALSE;
 
-	res = dbus_g_proxy_call (proxy, "GetPropertyBoolean",
+        res = dbus_g_proxy_call (proxy, "GetPropertyBoolean",
                                  &error,
-				 G_TYPE_STRING, "power_management.can_suspend",
-				 G_TYPE_INVALID,
-				 G_TYPE_BOOLEAN, &ret,
-				 G_TYPE_INVALID);
+                                 G_TYPE_STRING, "power_management.can_suspend",
+                                 G_TYPE_INVALID,
+                                 G_TYPE_BOOLEAN, &ret,
+                                 G_TYPE_INVALID);
         if (! res) {
                 if (error != NULL) {
                         g_warning ("Could not ask HAL if user can suspend: %s",
@@ -735,11 +744,11 @@ do_suspend (GdmGreeterLoginWindow *login
                                            HAL_ROOT_COMPUTER,
                                            HAL_DBUS_INTERFACE_POWER);
         error = NULL;
-	dbus_g_proxy_call (proxy, "Suspend", &error,
-				 G_TYPE_INT, 0,
-				 G_TYPE_INVALID,
-				 G_TYPE_INT, &ret,
-				 G_TYPE_INVALID);
+        dbus_g_proxy_call (proxy, "Suspend", &error,
+                                 G_TYPE_INT, 0,
+                                 G_TYPE_INVALID,
+                                 G_TYPE_INT, &ret,
+                                 G_TYPE_INVALID);
         if (error != NULL) {
                 g_warning ("Couldn't suspend: %s", error->message);
                 g_error_free (error);
@@ -932,7 +941,7 @@ gdm_greeter_login_window_problem (GdmGre
         gtk_widget_show (hbox);
 
         image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
-	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+        gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
         gtk_widget_show (image);
 
         vbox = gtk_vbox_new (FALSE, 6);
@@ -1680,55 +1689,55 @@ static void
 create_computer_info (GdmGreeterLoginWindow *login_window)
 {
         GtkWidget *label;
-	GError      *error;
-	gboolean editable;
+        GError      *error;
+        gboolean editable;
 
         gdm_profile_start (NULL);
                 
-	error = NULL;
-	editable = gconf_client_get_bool (login_window->priv->client, KEY_LOGO_EDITABLE, &error);
-	if (error != NULL) {
-		editable = FALSE;
-		g_debug ("GdmGreeterLoginWindow: unable to get logo editable setting: %s", error->message);
-		g_error_free (error);
-	}
+        error = NULL;
+        editable = gconf_client_get_bool (login_window->priv->client, KEY_LOGO_EDITABLE, &error);
+        if (error != NULL) {
+                editable = FALSE;
+                g_debug ("GdmGreeterLoginWindow: unable to get logo editable setting: %s", error->message);
+                g_error_free (error);
+        }
 
         label = glade_xml_get_widget (login_window->priv->xml, "computer-info-name-label");
         if (label != NULL) {
-		if (editable) {
-			char *name;
-			name = gconf_client_get_string (login_window->priv->client, KEY_LOGO_NAME_LABEL, NULL);
-			if (name && (strlen (name) > 0)) {
-				gtk_label_set_text (GTK_LABEL (label), name);
-				g_free (name);
-			} else {
-				gtk_widget_hide (label);
-			}
-		} else
-	                gtk_label_set_text (GTK_LABEL (label), g_get_host_name ());
+                if (editable) {
+                        char *name;
+                        name = gconf_client_get_string (login_window->priv->client, KEY_LOGO_NAME_LABEL, NULL);
+                        if (name && (strlen (name) > 0)) {
+                                gtk_label_set_text (GTK_LABEL (label), name);
+                                g_free (name);
+                        } else {
+                                gtk_widget_hide (label);
+                        }
+                } else
+                        gtk_label_set_text (GTK_LABEL (label), g_get_host_name ());
         }
 
         label = glade_xml_get_widget (login_window->priv->xml, "computer-info-version-label");
         if (label != NULL) {
                 char *version;
                 char *markup;
-		if (editable) {
-			version = gconf_client_get_string (login_window->priv->client, KEY_LOGO_VERSION_LABEL, NULL);
+                if (editable) {
+                        version = gconf_client_get_string (login_window->priv->client, KEY_LOGO_VERSION_LABEL, NULL);
                         if (version && (strlen (version) > 0)) {
-				markup = g_markup_printf_escaped ("<b>%s</b>", version);
+                                markup = g_markup_printf_escaped ("<b>%s</b>", version);
                                 gtk_label_set_markup (GTK_LABEL (label), markup);
-				g_free (version);
+                                g_free (version);
                                 g_free (markup);
                         } else {
                                 gtk_widget_hide (label);                        
                         }
-		} else {
-	                version = get_system_version ();
-        	        markup = g_markup_printf_escaped ("<b>%s</b>", version);
-                	gtk_label_set_markup (GTK_LABEL (label), markup);
-	                g_free (version);
-        	        g_free (markup);
-		}
+                } else {
+                        version = get_system_version ();
+                        markup = g_markup_printf_escaped ("<b>%s</b>", version);
+                        gtk_label_set_markup (GTK_LABEL (label), markup);
+                        g_free (version);
+                        g_free (markup);
+                }
         }
 
         g_signal_connect (gtk_widget_get_screen (GTK_WIDGET (login_window)),
@@ -1812,18 +1821,18 @@ load_theme (GdmGreeterLoginWindow *login
                                                       GTK_ICON_SIZE_DIALOG);
                         g_free (icon_name);
                 } else {
-			gboolean editable;
-			error = NULL;
-			editable = gconf_client_get_bool (login_window->priv->client, KEY_LOGO_EDITABLE, &error);
-			if (error) {
-				editable = FALSE;
-                        	g_debug ("GdmGreeterLoginWindow: unable to get logo editable setting: %s", error->message);
-	                        g_error_free (error);
-			}
-			if (editable) {
-				gtk_widget_hide (image);	
-			}
-		}
+                        gboolean editable;
+                        error = NULL;
+                        editable = gconf_client_get_bool (login_window->priv->client, KEY_LOGO_EDITABLE, &error);
+                        if (error) {
+                                editable = FALSE;
+                                g_debug ("GdmGreeterLoginWindow: unable to get logo editable setting: %s", error->message);
+                                g_error_free (error);
+                        }
+                        if (editable) {
+                                gtk_widget_hide (image);        
+                        }
+                }
         }
 
         box = glade_xml_get_widget (login_window->priv->xml, "window-box");
@@ -1955,16 +1964,85 @@ gdm_greeter_login_window_size_request (G
 
         requisition->width += 2 * GTK_CONTAINER (widget)->border_width;
         requisition->height += 2 * GTK_CONTAINER (widget)->border_width;
-
         /* Make width be at least 33% screen width
          * and height be at most 80% of screen height
          */
         requisition->width = MAX (requisition->width, .33 * area.width);
         requisition->height = MIN (requisition->height, .80 * area.height);
 
-       /* Don't ever shrink window width
-        */
-       requisition->width = MAX (requisition->width, widget->allocation.width);
+        /* Don't ever shrink window width
+         */
+        requisition->width = MAX (requisition->width, widget->allocation.width);
+}
+
+static void
+on_screen_size_changed (GdkScreen       *screen,
+                        GdmGreeterLoginWindow *login_window)
+{
+        gtk_widget_queue_resize (GTK_WIDGET (login_window));
+}
+
+static void
+gdm_greeter_login_window_realize (GtkWidget *widget)
+{
+        GtkRequisition requisition;
+        GdmGreeterLoginWindow *login_window;
+
+        if (GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->realize) {
+                GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->realize (widget);
+        }
+        gtk_widget_size_request (widget, &requisition);
+        login_window = (GdmGreeterLoginWindow *)widget;
+        if (login_window->priv->greeter_on_primary) {
+                GnomeRRScreen *rw_screen;
+                GnomeRRConfig *config;
+                int i;
+                int x = -1;
+                int y = -1;
+
+                rw_screen = gnome_rr_screen_new (
+                        gdk_screen_get_default (), NULL, NULL, NULL);
+
+                config = gnome_rr_config_new_current (rw_screen);
+                for (i = 0; config->outputs[i] != NULL; i++) {
+                        GnomeOutputInfo *output = config->outputs[i];
+
+                        if (output->primary) {
+
+                                int n_w = requisition.width + 4 * GTK_CONTAINER (widget)->border_width;
+                                int n_h = requisition.height + 4 * GTK_CONTAINER (widget)->border_width;
+                                n_w = MAX (n_w, 0.33*output->width);
+                                n_h = MIN (n_h, 0.8*output->height);
+                                x = output->x + output->width / 2 - n_w/2;
+                                y = output->y + output->height /2 - n_h/2;
+                                break;
+                        }
+                }
+                gnome_rr_config_free (config);
+                gnome_rr_screen_destroy (rw_screen);
+                if (x == -1) {
+                        gtk_window_set_position (GTK_WINDOW (login_window), GTK_WIN_POS_CENTER_ALWAYS);
+                } else {
+                        gtk_window_move (GTK_WINDOW (widget), x, y);
+                }
+        }
+
+        g_signal_connect (gtk_window_get_screen (GTK_WINDOW (widget)),
+                          "size_changed",
+                          G_CALLBACK (on_screen_size_changed),
+                          widget);
+}
+
+static void
+gdm_greeter_login_window_unrealize (GtkWidget *widget)
+{
+        g_signal_handlers_disconnect_by_func (gtk_window_get_screen (GTK_WINDOW (widget)),
+                                              on_screen_size_changed,
+                                              widget);
+
+        if (GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->unrealize) {
+                GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->unrealize (widget);
+        }
 }
 
 static void
@@ -2043,6 +2121,8 @@ gdm_greeter_login_window_class_init (Gdm
 
         widget_class->key_press_event = gdm_greeter_login_window_key_press_event;
         widget_class->size_request = gdm_greeter_login_window_size_request;
+        widget_class->realize = gdm_greeter_login_window_realize;
+        widget_class->unrealize = gdm_greeter_login_window_unrealize;
 
         signals [BEGIN_AUTO_LOGIN] =
                 g_signal_new ("begin-auto-login",
@@ -2191,6 +2271,7 @@ on_window_state_event (GtkWidget
 static void
 gdm_greeter_login_window_init (GdmGreeterLoginWindow *login_window)
 {
+        GError *error = NULL;
         gdm_profile_start (NULL);
 
         login_window->priv = GDM_GREETER_LOGIN_WINDOW_GET_PRIVATE (login_window);
@@ -2204,7 +2285,6 @@ gdm_greeter_login_window_init (GdmGreete
 
         gtk_window_set_title (GTK_WINDOW (login_window), _("Login Window"));
         /*gtk_window_set_opacity (GTK_WINDOW (login_window), 0.85);*/
-        gtk_window_set_position (GTK_WINDOW (login_window), GTK_WIN_POS_CENTER_ALWAYS);
         gtk_window_set_deletable (GTK_WINDOW (login_window), FALSE);
         gtk_window_set_decorated (GTK_WINDOW (login_window), FALSE);
         gtk_window_set_keep_below (GTK_WINDOW (login_window), TRUE);
@@ -2229,6 +2309,16 @@ gdm_greeter_login_window_init (GdmGreete
                                                                   login_window,
                                                                   NULL,
                                                                   NULL);
+
+        login_window->priv->greeter_on_primary = gconf_client_get_bool (login_window->priv->client, KEY_GREETER_ON_MONITOR, &error);
+        if (error) {
+                login_window->priv->greeter_on_primary = FALSE;
+                g_error_free (error);
+        }
+        if (!login_window->priv->greeter_on_primary) {
+                gtk_window_set_position (GTK_WINDOW (login_window), GTK_WIN_POS_CENTER_ALWAYS);
+        }
+
         gdm_profile_end (NULL);
 }
 
diff -Npur gdm-old//gui/simple-greeter/gdm-greeter-session.c gdm-new/gui/simple-greeter/gdm-greeter-session.c
--- gdm-old//gui/simple-greeter/gdm-greeter-session.c	2014-12-17 06:39:10.000000000 +0800
+++ gdm-new/gui/simple-greeter/gdm-greeter-session.c	2014-12-17 06:36:48.000000000 +0800
@@ -25,6 +25,12 @@
 #include <unistd.h>
 #include <string.h>
 
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+
+#include <libgnomeui/gnome-rr-config.h>
+#include <libgnomeui/gnome-rr.h>
+#include <libgnomeui/gnome-rr-labeler.h>
+
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
@@ -41,6 +47,7 @@
 #include "gdm-domain-provider.h"
 
 #include "gdm-profile.h"
+#define GREETER_ON_PRIMARY_KEY                 "/apps/gdm/simple-greeter/greeter_on_primary_enable"
 
 #define GDM_GREETER_SESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_SESSION, GdmGreeterSessionPrivate))
 
@@ -463,6 +470,51 @@ on_start_session (GdmGreeterLoginWindow
         gdm_greeter_client_call_start_session_when_ready (session->priv->client, TRUE);
 }
 
+static int
+get_monitor (GdmGreeterSession *session, GdkScreen *screen)
+{
+        GdkDisplay *display;
+        int x, y;
+        int i;
+        GnomeRRScreen *rw_screen;
+        GnomeRRConfig *config;
+        GConfClient *client;
+        gboolean     greeter_on_primary;
+	GError *error = NULL;
+
+        client = gconf_client_get_default ();
+        greeter_on_primary = gconf_client_get_bool (client, GREETER_ON_PRIMARY_KEY, &error);
+        g_object_unref (client);
+        if (error) {
+                greeter_on_primary = FALSE;
+                g_error_free (error);
+        }
+
+        if (greeter_on_primary) {
+                rw_screen = gnome_rr_screen_new (screen,
+                        NULL, NULL, NULL);
+
+                config = gnome_rr_config_new_current (rw_screen);
+                for (i = 0; config->outputs[i] != NULL; i++) {
+                        GnomeOutputInfo *output = config->outputs[i];
+                        if (output->primary) {
+                                x = output->x + output->width / 2;
+                                y = output->y + output->height /2;
+
+                                gnome_rr_config_free (config);
+                                gnome_rr_screen_destroy (rw_screen);
+                                return gdk_screen_get_monitor_at_point (screen, x, y);
+                        }
+                }
+                gnome_rr_config_free (config);
+                gnome_rr_screen_destroy (rw_screen);
+        }
+
+        display = gdk_display_get_default ();
+        gdk_display_get_pointer (display, &screen, &x, &y, NULL);
+        return gdk_screen_get_monitor_at_point (screen, x, y);
+}
+
 static void
 toggle_panel (GdmGreeterSession *session,
               gboolean           enabled)
@@ -470,18 +522,12 @@ toggle_panel (GdmGreeterSession *session
         gdm_profile_start (NULL);
 
         if (enabled) {
-                GdkDisplay *display;
                 GdkScreen  *screen;
                 int         monitor;
-                int         x, y;
-
-                display = gdk_display_get_default ();
-                gdk_display_get_pointer (display, &screen, &x, &y, NULL);
-                monitor = gdk_screen_get_monitor_at_point (screen, x, y);
 
+                screen = gdk_screen_get_default (), 
+                monitor = get_monitor (session, screen);
                 session->priv->panel = gdm_greeter_panel_new (screen, monitor);
-
-
                 gtk_widget_show (session->priv->panel);
         } else {
                 gtk_widget_destroy (session->priv->panel);
diff -Npur gdm-old//gui/simple-greeter/gdm-simple-greeter.schemas.in gdm-new/gui/simple-greeter/gdm-simple-greeter.schemas.in
--- gdm-old//gui/simple-greeter/gdm-simple-greeter.schemas.in	2014-12-17 06:09:52.000000000 +0800
+++ gdm-new/gui/simple-greeter/gdm-simple-greeter.schemas.in	2014-12-17 06:15:01.000000000 +0800
@@ -2,6 +2,17 @@
   <schemalist>
 
     <schema>
+      <key>/schemas/apps/gdm/simple-greeter/greeter_on_primary_enable</key>
+      <applyto>/apps/gdm/simple-greeter/greeter_on_primary_enable</applyto>
+      <owner>gdm-simple-greeter</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Always greeter on the primary monitor</short>
+        <long>Enable to display the greeter dialog on the primary monitor.</long>
+      </locale>
+    </schema>
+    <schema>
       <key>/schemas/apps/gdm/simple-greeter/debug</key>
       <applyto>/apps/gdm/simple-greeter/debug</applyto>
       <owner>gdm-simple-greeter</owner>
