summaryrefslogtreecommitdiff
path: root/tests/src/X.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/X.c')
-rw-r--r--tests/src/X.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/src/X.c b/tests/src/X.c
index a367a9d4..8611e2f0 100644
--- a/tests/src/X.c
+++ b/tests/src/X.c
@@ -62,6 +62,9 @@ static guint32 xdmcp_session_id = 0;
static guint16 xdmcp_cookie_length = 0;
static guint8 *xdmcp_cookie = NULL;
+/* Terminate on server reset */
+static gboolean terminate_on_reset = FALSE;
+
static void
cleanup (void)
{
@@ -188,6 +191,16 @@ client_disconnected_cb (XServer *server, XClient *client)
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, NULL);
}
+static void
+reset_cb (XServer *server)
+{
+ if (terminate_on_reset)
+ {
+ status_notify ("%s TERMINATE", id);
+ quit (EXIT_SUCCESS);
+ }
+}
+
static guint8
get_nibble (char c)
{
@@ -466,6 +479,10 @@ main (int argc, char **argv)
seat = argv[i+1];
i++;
}
+ else if (strcmp (arg, "-terminate") == 0)
+ {
+ terminate_on_reset = TRUE;
+ }
else if (strcmp (arg, "-mir") == 0)
{
mir_id = argv[i+1];
@@ -512,6 +529,7 @@ main (int argc, char **argv)
xserver = x_server_new (display_number);
g_signal_connect (xserver, X_SERVER_SIGNAL_CLIENT_CONNECTED, G_CALLBACK (client_connected_cb), NULL);
g_signal_connect (xserver, X_SERVER_SIGNAL_CLIENT_DISCONNECTED, G_CALLBACK (client_disconnected_cb), NULL);
+ g_signal_connect (xserver, X_SERVER_SIGNAL_RESET, G_CALLBACK (reset_cb), NULL);
status_text = g_string_new ("");
g_string_printf (status_text, "%s START", id);