summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2017-09-28 14:19:34 -0400
committerRobert Ancell <robert.ancell@canonical.com>2017-09-28 14:22:50 -0400
commit6792a1ae9d659f089d42c07b9049b2f78711d553 (patch)
tree82114067c1c6fa140fc68b04f6a6b2a2e9139805
parentf31292e84321a31031e6f33bad93e26a19d0943a (diff)
downloadgdm-6792a1ae9d659f089d42c07b9049b2f78711d553.tar.gz
daemon: Remove obsolete module gdm-xerrors
https://bugzilla.gnome.org/show_bug.cgi?id=788303
-rw-r--r--daemon/Makefile.am2
-rw-r--r--daemon/gdm-display.c2
-rw-r--r--daemon/gdm-xerrors.c242
-rw-r--r--daemon/gdm-xerrors.h39
-rw-r--r--po/POTFILES.in1
5 files changed, 1 insertions, 285 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index ab5dda06..bf55cb67 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -226,8 +226,6 @@ gdm_SOURCES = \
gdm-session-worker-job.h \
gdm-dbus-util.c \
gdm-dbus-util.h \
- gdm-xerrors.c \
- gdm-xerrors.h \
$(NULL)
nodist_gdm_SOURCES = \
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 0057e2ce..f7e1166b 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -35,6 +35,7 @@
#include <glib-object.h>
#include <xcb/xcb.h>
+#include <X11/Xlib.h>
#include "gdm-common.h"
#include "gdm-display.h"
@@ -47,7 +48,6 @@
#include "gdm-launch-environment.h"
#include "gdm-dbus-util.h"
-#include "gdm-xerrors.h"
#define INITIAL_SETUP_USERNAME "gnome-initial-setup"
#define GNOME_SESSION_SESSIONS_PATH DATADIR "/gnome-session/sessions"
diff --git a/daemon/gdm-xerrors.c b/daemon/gdm-xerrors.c
deleted file mode 100644
index 44f567ee..00000000
--- a/daemon/gdm-xerrors.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2010 William Jon McCann <jmccann@redhat.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/* Most of this is derived from GTK+ (copyright GTK+ team) */
-
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "gdm-xerrors.h"
-
-typedef struct _GdmErrorTrap GdmErrorTrap;
-
-struct _GdmErrorTrap
-{
- int (*old_handler) (Display *, XErrorEvent *);
- int error_warnings;
- int error_code;
-};
-
-static int gdm_x_error (Display *display,
- XErrorEvent *error);
-static int gdm_x_io_error (Display *display);
-
-/* Private variable declarations
- */
-static GSList *gdm_error_traps = NULL; /* List of error traps */
-static GSList *gdm_error_trap_free_list = NULL; /* Free list */
-
-static int _gdm_error_warnings = TRUE;
-static int _gdm_error_code = 0;
-
-void
-gdm_xerrors_init (void)
-{
- static gboolean initialized = FALSE;
-
- if (initialized) {
- return;
- }
-
- XSetErrorHandler (gdm_x_error);
- XSetIOErrorHandler (gdm_x_io_error);
- initialized = TRUE;
-}
-
-/*
- *--------------------------------------------------------------
- * gdm_x_error
- *
- * The X error handling routine.
- *
- * Arguments:
- * "display" is the X display the error orignated from.
- * "error" is the XErrorEvent that we are handling.
- *
- * Results:
- * Either we were expecting some sort of error to occur,
- * in which case we set the "_gdm_error_code" flag, or this
- * error was unexpected, in which case we will print an
- * error message and exit. (Since trying to continue will
- * most likely simply lead to more errors).
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static int
-gdm_x_error (Display *display,
- XErrorEvent *error)
-{
- if (error->error_code) {
- if (_gdm_error_warnings) {
- gchar buf[64];
- gchar *msg;
-
- XGetErrorText (display, error->error_code, buf, 63);
-
- msg =
- g_strdup_printf ("The program '%s' received an X Window System error.\n"
- "This probably reflects a bug in the program.\n"
- "The error was '%s'.\n"
- " (Details: serial %ld error_code %d request_code %d minor_code %d)\n"
- " (Note to programmers: normally, X errors are reported asynchronously;\n"
- " that is, you will receive the error a while after causing it.\n"
- " To debug your program, run it with the --sync command line\n"
- " option to change this behavior. You can then get a meaningful\n"
- " backtrace from your debugger if you break on the gdm_x_error() function.)",
- g_get_prgname (),
- buf,
- error->serial,
- error->error_code,
- error->request_code,
- error->minor_code);
-
-#ifdef G_ENABLE_DEBUG
- g_error ("%s", msg);
-#else /* !G_ENABLE_DEBUG */
- g_fprintf (stderr, "%s\n", msg);
-
- exit (1);
-#endif /* G_ENABLE_DEBUG */
- }
- _gdm_error_code = error->error_code;
- }
-
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- * gdm_x_io_error
- *
- * The X I/O error handling routine.
- *
- * Arguments:
- * "display" is the X display the error orignated from.
- *
- * Results:
- * An X I/O error basically means we lost our connection
- * to the X server. There is not much we can do to
- * continue, so simply print an error message and exit.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static int
-gdm_x_io_error (Display *display)
-{
- /* This is basically modelled after the code in XLib. We need
- * an explicit error handler here, so we can disable our atexit()
- * which would otherwise cause a nice segfault.
- * We fprintf(stderr, instead of g_warning() because g_warning()
- * could possibly be redirected to a dialog
- */
- if (errno == EPIPE) {
- g_fprintf (stderr,
- "The application '%s' lost its connection to the display %s;\n"
- "most likely the X server was shut down or you killed/destroyed\n"
- "the application.\n",
- g_get_prgname (),
- display ? DisplayString (display) : "<unknown>");
- } else {
- g_fprintf (stderr, "%s: Fatal IO error %d (%s) on X server %s.\n",
- g_get_prgname (),
- errno, g_strerror (errno),
- display ? DisplayString (display) : "<unknown>");
- }
-
- exit(1);
-}
-
-/*************************************************************
- * gdm_error_trap_push:
- * Push an error trap. X errors will be trapped until
- * the corresponding gdm_error_pop(), which will return
- * the error code, if any.
- * arguments:
- *
- * results:
- *************************************************************/
-
-void
-gdm_error_trap_push (void)
-{
- GSList *node;
- GdmErrorTrap *trap;
-
- if (gdm_error_trap_free_list) {
- node = gdm_error_trap_free_list;
- gdm_error_trap_free_list = gdm_error_trap_free_list->next;
- } else {
- node = g_slist_alloc ();
- node->data = g_new (GdmErrorTrap, 1);
- }
-
- node->next = gdm_error_traps;
- gdm_error_traps = node;
-
- trap = node->data;
- trap->old_handler = XSetErrorHandler (gdm_x_error);
- trap->error_code = _gdm_error_code;
- trap->error_warnings = _gdm_error_warnings;
-
- _gdm_error_code = 0;
- _gdm_error_warnings = 0;
-}
-
-/*************************************************************
- * gdm_error_trap_pop:
- * Pop an error trap added with gdm_error_push()
- * arguments:
- *
- * results:
- * 0, if no error occured, otherwise the error code.
- *************************************************************/
-
-gint
-gdm_error_trap_pop (void)
-{
- GSList *node;
- GdmErrorTrap *trap;
- gint result;
-
- g_return_val_if_fail (gdm_error_traps != NULL, 0);
-
- node = gdm_error_traps;
- gdm_error_traps = gdm_error_traps->next;
-
- node->next = gdm_error_trap_free_list;
- gdm_error_trap_free_list = node;
-
- result = _gdm_error_code;
-
- trap = node->data;
- _gdm_error_code = trap->error_code;
- _gdm_error_warnings = trap->error_warnings;
- XSetErrorHandler (trap->old_handler);
-
- return result;
-}
diff --git a/daemon/gdm-xerrors.h b/daemon/gdm-xerrors.h
deleted file mode 100644
index fc7981e6..00000000
--- a/daemon/gdm-xerrors.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/* Metacity X error handling */
-
-/*
- * Copyright (C) 2001 Havoc Pennington
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef GDM_XERRORS_H
-#define GDM_XERRORS_H
-
-#include <glib.h>
-#include <X11/Xlib.h>
-
-typedef void (* GdmXErrorHandler) (Display *dpy,
- XErrorEvent *error,
- gpointer data);
-
-void gdm_xerrors_init (void);
-
-void gdm_error_trap_push (void);
-gint gdm_error_trap_pop (void);
-
-#endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7a877ccc..8fe82c5b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -34,7 +34,6 @@ daemon/gdm-wayland-session.c
daemon/gdm-xdmcp-chooser-display.c
daemon/gdm-xdmcp-display.c
daemon/gdm-xdmcp-display-factory.c
-daemon/gdm-xerrors.c
daemon/gdm-x-session.c
daemon/main.c
daemon/session-worker-main.c