#define LOCALEDIR "locale"
#endif
+#ifdef HAVE_X11_XLIB_H
+#include "X11/Xlib.h"
+#endif
+
#if GLIB_CHECK_VERSION (2, 32, 0)
/* Callback to log message */
static void log_debug(const gchar *log_domain,
}
#endif
+#if HAVE_X11_XLIB_H
+static int myXErrorHandler(Display *display, XErrorEvent *theEvent)
+{
+ g_fprintf (stderr,
+ _("Ignoring Xlib error: error code %d request code %d\n"),
+ theEvent->error_code,
+ theEvent->request_code);
+ // No exit on X errors!
+ // mainly to handle out of memory error when requesting large pixbuf from user request
+ // see vikwindow.c::save_image_file ()
+ return 0;
+}
+#endif
+
/* Options */
static GOptionEntry entries[] =
{
g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, mute_log, NULL);
#endif
+#if HAVE_X11_XLIB_H
+ XSetErrorHandler(myXErrorHandler);
+#endif
+
a_preferences_init ();
a_vik_preferences_init ();
while ( ++i < argc ) {
if ( strcmp(argv[i],"--") == 0 && !dashdash_already )
dashdash_already = TRUE; /* hack to open '-' */
- else
- vik_window_open_file ( first_window, argv[i], argc == 2 );
+ else {
+ VikWindow *newvw = first_window;
+ gboolean change_filename = (i == 1);
+
+ // Open any subsequent .vik files in their own window
+ if ( i > 1 && check_file_magic_vik ( argv[i] ) ) {
+ newvw = vik_window_new_window ();
+ change_filename = TRUE;
+ }
+
+ vik_window_open_file ( newvw, argv[i], change_filename );
+ }
}
gtk_main ();