]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkmain.c
Merge branch 'master' into toolpalette
[~andy/gtk] / gtk / gtkmain.c
index fb5d35af7d1ff82f975e43247fbd911bc1121691..bfee6da93b31b179209c00c1f5ec8aea310de0a7 100644 (file)
@@ -85,9 +85,28 @@ DllMain (HINSTANCE hinstDLL,
   return TRUE;
 }
 
-/* This here before inclusion of gtkprivate.h so that it sees the
- * original GTK_LOCALEDIR definition. Yeah, this is a bit sucky.
+/* These here before inclusion of gtkprivate.h so that the original
+ * GTK_LIBDIR and GTK_LOCALEDIR definitions are seen. Yeah, this is a
+ * bit sucky.
  */
+const gchar *
+_gtk_get_libdir (void)
+{
+  static char *gtk_libdir = NULL;
+  if (gtk_libdir == NULL)
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      gchar *slash = strrchr (root, '\\');
+      if (g_ascii_strcasecmp (slash + 1, ".libs") == 0)
+       gtk_libdir = GTK_LIBDIR;
+      else
+       gtk_libdir = g_build_filename (root, "lib", NULL);
+      g_free (root);
+    }
+
+  return gtk_libdir;
+}
+
 const gchar *
 _gtk_get_localedir (void)
 {
@@ -332,20 +351,6 @@ _gtk_get_datadir (void)
   return gtk_datadir;
 }
 
-const gchar *
-_gtk_get_libdir (void)
-{
-  static char *gtk_libdir = NULL;
-  if (gtk_libdir == NULL)
-    {
-      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
-      gtk_libdir = g_build_filename (root, "lib", NULL);
-      g_free (root);
-    }
-
-  return gtk_libdir;
-}
-
 const gchar *
 _gtk_get_sysconfdir (void)
 {
@@ -681,6 +686,10 @@ do_post_parse_initialization (int    *argc,
 
   gettext_initialization ();
 
+#ifdef SIGPIPE
+  signal (SIGPIPE, SIG_IGN);
+#endif
+
   if (g_fatal_warnings)
     {
       GLogLevelFlags fatal_mask;
@@ -840,9 +849,9 @@ gtk_get_option_group (gboolean open_default_display)
 gboolean
 gtk_init_with_args (int            *argc,
                    char         ***argv,
-                   char           *parameter_string,  
+                   const char     *parameter_string,
                    GOptionEntry   *entries,
-                   char           *translation_domain,
+                   const char     *translation_domain,
                    GError        **error)
 {
   GOptionContext *context;
@@ -980,6 +989,15 @@ gtk_init_check (int         *argc,
  * the GUI for some reason. If you want your program to fall back to a 
  * textual interface you want to call gtk_init_check() instead.
  * </para></note>
+ *
+ * <note><para>
+ * Since 2.18, GTK+ calls <literal>signal (SIGPIPE, SIG_IGN)</literal>
+ * during initialization, to ignore SIGPIPE signals, since these are
+ * almost never wanted in graphical applications. If you do need to
+ * handle SIGPIPE for some reason, reset the handler after gtk_init(),
+ * but notice that other libraries (e.g. libdbus or gvfs) might do
+ * similar things.
+ * </para></note>
  **/
 void
 gtk_init (int *argc, char ***argv)
@@ -1554,7 +1572,15 @@ gtk_main_do_event (GdkEvent *event)
          gdk_window_end_paint (event->any.window);
        }
       else
-       gtk_widget_send_expose (event_widget, event);
+       {
+         /* The app may paint with a previously allocated cairo_t,
+            which will draw directly to the window. We can't catch cairo
+            drap operatoins to automatically flush the window, thus we
+            need to explicitly flush any outstanding moves or double
+            buffering */
+         gdk_window_flush (event->any.window);
+         gtk_widget_send_expose (event_widget, event);
+       }
       break;
 
     case GDK_PROPERTY_NOTIFY: