#include <limits.h>
#include <errno.h>
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif /* HAVE_SYS_SELECT_H_ */
-
-#define XLIB_ILLEGAL_ACCESS
#include <X11/Xatom.h>
#include <X11/Xlib.h>
-#include <X11/Xos.h>
#include <X11/Xutil.h>
-#include <X11/cursorfont.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h>
#endif /* G_ENABLE_DEBUG */
-static void
-gdk_arg_xim_preedit_cb (const gchar *arg, const gchar *value, gpointer cb_data)
-{
- if (strcmp ("none", value) == 0)
- gdk_im_set_best_style (GDK_IM_PREEDIT_NONE);
- else if (strcmp ("nothing", value) == 0)
- gdk_im_set_best_style (GDK_IM_PREEDIT_NOTHING);
- else if (strcmp ("area", value) == 0)
- gdk_im_set_best_style (GDK_IM_PREEDIT_AREA);
- else if (strcmp ("position", value) == 0)
- gdk_im_set_best_style (GDK_IM_PREEDIT_POSITION);
- else if (strcmp ("callbacks", value) == 0)
- gdk_im_set_best_style (GDK_IM_PREEDIT_CALLBACKS);
-}
-
-static void
-gdk_arg_xim_status_cb (const gchar *arg, const gchar *value, gpointer cb_data)
-{
- if (strcmp ("none", value) == 0)
- gdk_im_set_best_style (GDK_IM_STATUS_NONE);
- else if (strcmp ("nothing", value) == 0)
- gdk_im_set_best_style (GDK_IM_STATUS_NOTHING);
- else if (strcmp ("area", value) == 0)
- gdk_im_set_best_style (GDK_IM_STATUS_AREA);
- else if (strcmp ("callbacks", value) == 0)
- gdk_im_set_best_style (GDK_IM_STATUS_CALLBACKS);
-}
-
GdkArgDesc _gdk_windowing_args[] = {
{ "display", GDK_ARG_STRING, &gdk_display_name, (GdkArgFunc)NULL },
{ "sync", GDK_ARG_BOOL, &gdk_synchronize, (GdkArgFunc)NULL },
{ "class", GDK_ARG_STRING, &gdk_progclass, (GdkArgFunc)NULL },
{ "gxid-host", GDK_ARG_STRING, &gdk_input_gxid_host, (GdkArgFunc)NULL },
{ "gxid-port", GDK_ARG_INT, &gdk_input_gxid_port, (GdkArgFunc)NULL },
- { "xim-preedit", GDK_ARG_CALLBACK, NULL, gdk_arg_xim_preedit_cb },
- { "xim-status", GDK_ARG_CALLBACK, NULL, gdk_arg_xim_status_cb },
{ NULL }
};
{
if (gdk_error_warnings)
{
- char buf[64];
-
+ 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 gdk_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\n serial %ld error_code %d request_code %d minor_code %d\n",
- buf,
- error->serial,
- error->error_code,
- error->request_code,
- error->minor_code);
+ g_error ("%s", msg);
#else /* !G_ENABLE_DEBUG */
- fprintf (stderr, "Gdk-ERROR **: %s\n serial %ld error_code %d request_code %d minor_code %d\n",
- buf,
- error->serial,
- error->error_code,
- error->request_code,
- error->minor_code);
+ fprintf (stderr, "%s\n", msg);
exit(1);
#endif /* G_ENABLE_DEBUG */
*/
if (errno == EPIPE)
{
- fprintf (stderr, "Gdk-ERROR **: X connection to %s broken (explicit kill or server shutdown).\n", gdk_display ? DisplayString (gdk_display) : gdk_get_display());
+ 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 (),
+ gdk_display ? DisplayString (gdk_display) : gdk_get_display());
}
else
{
- fprintf (stderr, "Gdk-ERROR **: Fatal IO error %d (%s) on X server %s.\n",
+ fprintf (stderr, "%s: Fatal IO error %d (%s) on X server %s.\n",
+ g_get_prgname (),
errno, g_strerror (errno),
gdk_display ? DisplayString (gdk_display) : gdk_get_display());
}