--- gdm-2.19.1/gui/gdmlogin.c.pass-ats-to-session	2007-05-21 13:38:32.000000000 -0400
+++ gdm-2.19.1/gui/gdmlogin.c	2007-05-21 13:38:32.000000000 -0400
@@ -1576,6 +1576,19 @@ process_operation (guchar       op_code,
 	fflush (stdout);
 	break;
 
+    case GDM_A11Y:
+    {
+	const char *ats_launched;
+	/* print out the assistive technologies that we've started for the user */
+	ats_launched = g_getenv ("GDM_ATS");
+	if (ats_launched != NULL)
+		printf ("%c%s\n", STX, ats_launched);
+	else
+		printf ("%c\n", STX);
+	fflush (stdout);
+	break;
+    }
+
     case GDM_LANG:
 	gdm_lang_op_lang (args);
 	break;
--- gdm-2.19.1/gui/modules/dwellmouselistener.c.pass-ats-to-session	2007-05-13 22:08:12.000000000 -0400
+++ gdm-2.19.1/gui/modules/dwellmouselistener.c	2007-05-21 13:38:32.000000000 -0400
@@ -678,6 +678,8 @@ leave_enter_emission_hook (GSignalInvoca
 					G_CALLBACK (gtk_widget_destroy), NULL);
 				gtk_widget_show (dialog);
 			} else {
+				const char *at_name;
+				const char *ats_launched;
 				GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
 				gdk_window_set_cursor (gdk_get_default_root_window (),
 					cursor);
@@ -686,6 +688,26 @@ leave_enter_emission_hook (GSignalInvoca
 				latch_core_pointer = FALSE;
 				/* once we've recognized a gesture, we need to *
 				 * leave the pointer alone */
+				
+				at_name = strstr (action, "#AT_TYPE=");
+				if (at_name != NULL) {
+					int i;
+					char **v;
+					at_name += 9;
+					v = g_strsplit (at_name, " ", 0);
+					for (i = 0; v[i] != NULL; i++) {
+						ats_launched = g_getenv ("GDM_ATS");
+						if (ats_launched == NULL) {
+							g_setenv ("GDM_ATS", v[i], TRUE);
+						} else if (strstr (ats_launched, v[i]) == NULL) {
+							char *s;
+							s = g_strdup_printf ("%s %s", ats_launched, v[i]);
+							g_setenv ("GDM_ATS", s, TRUE);
+							g_free (s);
+						}
+					}
+					g_strfreev (v);
+				}
 			}
 		}
 	}
--- gdm-2.19.1/gui/modules/AccessKeyMouseEvents.in.pass-ats-to-session	2007-05-13 22:08:12.000000000 -0400
+++ gdm-2.19.1/gui/modules/AccessKeyMouseEvents.in	2007-05-21 13:43:54.000000000 -0400
@@ -78,14 +78,14 @@
 #
 # press ctrl-s for 1 second to launch orca in speech mode
 #
-<Control>s  1 1000 10000  @AT_BINDIR@/orca -n -d main-window
+<Control>s  1 1000 10000  @AT_BINDIR@/orca -n -d main-window #AT_TYPE=screenreader
 
 # press ctrl-m for 1 second to launch orca in mag mode
 #
-<Control>m  1 1000 10000  @AT_BINDIR@/orca -n -d main-window -d speech -e magnifier
+<Control>m  1 1000 10000  @AT_BINDIR@/orca -n -d main-window -d speech -e magnifier #AT_TYPE=magnifier
 
 # press ctrl-o or ctrl-g for 1 second to launch orca in speech and mag mode
 #
-<Control>o  1 1000 10000  @AT_BINDIR@/orca -n -d main-window -e magnifier
-<Control>g  1 1000 10000  @AT_BINDIR@/orca -n -d main-window -e magnifier
+<Control>o  1 1000 10000  @AT_BINDIR@/orca -n -d main-window -e magnifier #AT_TYPE=screenreader magnifier
+<Control>g  1 1000 10000  @AT_BINDIR@/orca -n -d main-window -e magnifier #AT_TYPE=screenreader magnifier
 
--- gdm-2.19.1/gui/modules/AccessDwellMouseEvents.in.pass-ats-to-session	2007-05-13 22:08:12.000000000 -0400
+++ gdm-2.19.1/gui/modules/AccessDwellMouseEvents.in	2007-05-21 13:40:39.000000000 -0400
@@ -38,10 +38,10 @@
 # Support several different options for different user needs.  Note these
 # gestures all start by moving the mouse into the top window border.
 #
-TBLR I 10000    @AT_BINDIR@/gok --login --access-method=dwellselection
-TLBR I 10000    @AT_BINDIR@/gok --login --access-method=automaticscanning --scan-action=switch1 --select-action=switch1
-TRBL I 10000    @AT_BINDIR@/gok --login --access-method=inversescanning --scan-action=switch1 --select-action=switch2
-TBRL I 10000    @AT_BINDIR@/gok --login  --access-method=automaticscanning --scan-action=switch3 --select-action=switch3
+TBLR I 10000    @AT_BINDIR@/gok --login --access-method=dwellselection #AT_TYPE=onscreenkeyboard
+TLBR I 10000    @AT_BINDIR@/gok --login --access-method=automaticscanning --scan-action=switch1 --select-action=switch1 #AT_TYPE=onscreenkeyboard
+TRBL I 10000    @AT_BINDIR@/gok --login --access-method=inversescanning --scan-action=switch1 --select-action=switch2 #AT_TYPE=onscreenkeyboard
+TBRL I 10000    @AT_BINDIR@/gok --login  --access-method=automaticscanning --scan-action=switch3 --select-action=switch3 #AT_TYPE=onscreenkeyboard
 
 # AT Program - ORCA
 #
@@ -50,13 +50,13 @@ TBRL I 10000    @AT_BINDIR@/gok --login 
 #
 # Speech
 #
-BTRL I 10000    @AT_BINDIR@/orca -n -d main-window
+BTRL I 10000    @AT_BINDIR@/orca -n -d main-window #AT_TYPE=screenreader
 
 # Magnifier
 #
-BTLR I 10000    @AT_BINDIR@/orca -n -d main-window -d speech -e magnifier
+BTLR I 10000    @AT_BINDIR@/orca -n -d main-window -d speech -e magnifier #AT_TYPE=magnifier
 
 # Speech and Magnifier
 #
-BRTL I 10000    @AT_BINDIR@/orca -n -d main-window -e magnifier
+BRTL I 10000    @AT_BINDIR@/orca -n -d main-window -e magnifier #AT_TYPE=screenreader magnifier
 
--- gdm-2.19.1/gui/modules/keymouselistener.c.pass-ats-to-session	2007-05-13 22:08:12.000000000 -0400
+++ gdm-2.19.1/gui/modules/keymouselistener.c	2007-05-21 13:38:32.000000000 -0400
@@ -951,6 +951,8 @@ gestures_filter (GdkXEvent *gdk_xevent,
 						NULL);
 					gtk_widget_show (dialog);
 				} else {
+					char *at_name;
+					const char *ats_launched;
 					GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
 					gdk_window_set_cursor (gdk_get_default_root_window (),
 						cursor);
@@ -958,6 +960,26 @@ gestures_filter (GdkXEvent *gdk_xevent,
 					g_timeout_add (2000,
 						       change_cursor_back,
 						       NULL);
+
+					at_name = strstr (action, "#AT_TYPE=");
+					if (at_name != NULL) {
+						int i;
+						char **v;
+						at_name += 9;
+						v = g_strsplit (at_name, " ", 0);
+						for (i = 0; v[i] != NULL; i++) {
+							ats_launched = g_getenv ("GDM_ATS");
+							if (ats_launched == NULL) {
+								g_setenv ("GDM_ATS", v[i], TRUE);
+							} else if (strstr (ats_launched, v[i]) == NULL) {
+								char *s;
+								s = g_strdup_printf ("%s %s", ats_launched, v[i]);
+								g_setenv ("GDM_ATS", s, TRUE);
+								g_free (s);
+							}
+						}
+						g_strfreev (v);
+					}
 				}
 			}
    			return GDK_FILTER_CONTINUE;
--- gdm-2.19.1/gui/greeter/greeter.c.pass-ats-to-session	2007-05-21 13:38:32.000000000 -0400
+++ gdm-2.19.1/gui/greeter/greeter.c	2007-05-21 13:38:32.000000000 -0400
@@ -390,6 +390,19 @@ process_operation (guchar       op_code,
 	g_free (session);
 	break;
 
+    case GDM_A11Y:
+    {
+	const char *ats_launched;
+	/* print out the assistive technologies that we've started for the user */
+	ats_launched = g_getenv ("GDM_ATS");
+	if (ats_launched != NULL)
+		printf ("%c%s\n", STX, ats_launched);
+	else
+		printf ("%c\n", STX);
+	fflush (stdout);
+	break;
+    }
+
     case GDM_LANG:
 	gdm_lang_op_lang (args);
 	break;
--- gdm-2.19.1/daemon/gdm-socket-protocol.h.pass-ats-to-session	2007-05-21 13:44:35.000000000 -0400
+++ gdm-2.19.1/daemon/gdm-socket-protocol.h	2007-05-21 13:45:04.000000000 -0400
@@ -41,6 +41,7 @@
 #define GDM_PROMPT     'N'
 #define GDM_SESS       'G'
 #define GDM_LANG       '&'
+#define GDM_A11Y       'Z'
 #define GDM_SSESS      'C'
 #define GDM_SLANG      'R'
 #define GDM_SETLANG    'L'
--- gdm-2.19.1/daemon/slave.c.pass-ats-to-session	2007-05-21 13:38:32.000000000 -0400
+++ gdm-2.19.1/daemon/slave.c	2007-05-21 13:50:08.000000000 -0400
@@ -3489,6 +3489,7 @@ session_child_run (struct passwd *pwent,
 		   const char *session,
 		   const char *save_session,
 		   const char *language,
+		   const char *a11y_ats,
 		   const char *gnome_session,
 		   gboolean usrcfgok,
 		   gboolean savesess,
@@ -3579,6 +3580,9 @@ session_child_run (struct passwd *pwent,
 	}
 #endif
 	g_setenv ("PWD", home_dir, TRUE);
+	if (a11y_ats != NULL) {
+		g_setenv ("GDM_ATS", a11y_ats, TRUE);
+	}
 	g_setenv ("GDMSESSION", session, TRUE);
 	g_setenv ("DESKTOP_SESSION", session, TRUE);
 	g_setenv ("SHELL", pwent->pw_shell, TRUE);
@@ -3989,6 +3993,7 @@ gdm_slave_session_start (void)
 	struct passwd *pwent;
 	const char *home_dir = NULL;
 	char *save_session = NULL, *session = NULL, *language = NULL, *usrsess, *usrlang;
+	char *a11y_ats = NULL;
 	char *gnome_session = NULL;
 #ifdef WITH_CONSOLE_KIT
 	char *ck_session_cookie;
@@ -4157,9 +4162,19 @@ gdm_slave_session_start (void)
 			g_free (usrlang);
 			return;
 		}
+
+		a11y_ats = gdm_slave_greeter_ctl (GDM_A11Y, NULL);
+		if (a11y_ats != NULL && 
+		    strcmp (a11y_ats, GDM_RESPONSE_CANCEL) == 0) {
+			gdm_debug ("User canceled login");
+			gdm_verify_cleanup (d);
+			session_started = FALSE;
+			return;
+		}
 	} else {
 		session = g_strdup (usrsess);
 		language = g_strdup (usrlang);
+		a11y_ats = NULL;
 	}
 
 	tmp = gdm_strip_extension (session, ".desktop");
@@ -4180,10 +4195,15 @@ gdm_slave_session_start (void)
 		language = NULL;
 	}
 
+	if G_LIKELY (ve_string_empty (a11y_ats)) {
+		g_free (a11y_ats);
+		a11y_ats = NULL;
+	}
+
 	g_free (usrsess);
 
-	gdm_debug ("Initial setting: session: '%s' language: '%s'\n",
-		   session, ve_sure_string (language));
+	gdm_debug ("Initial setting: session: '%s' language: '%s'i ATs enabled in gdm: '%s'\n",
+		   session, ve_sure_string (language), ve_sure_string (a11y_ats));
 
 	/* save this session as the users session */
 	save_session = g_strdup (session);
@@ -4377,6 +4397,7 @@ gdm_slave_session_start (void)
 					   session,
 					   save_session,
 					   lang,
+					   a11y_ats,
 					   gnome_session,
 					   usrcfgok,
 					   savesess,
