]> Pileus Git - ~andy/gtk/blobdiff - gdk/gdk.c
Deprecate all the public API that is using GdkColor struct
[~andy/gtk] / gdk / gdk.c
index e65f68b3f3bc69be5dedcf89ecca79010bc6aa29..d1793c922492a6240e23ac230165fa68659b725f 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -101,7 +101,7 @@ static int gdk_initialized = 0;                     /* 1 if the library is initi
 
 static gchar  *gdk_progclass = NULL;
 
-static GMutex *gdk_threads_mutex = NULL;            /* Global GDK lock */
+static GMutex gdk_threads_mutex;
 
 static GCallback gdk_threads_lock = NULL;
 static GCallback gdk_threads_unlock = NULL;
@@ -215,6 +215,8 @@ gdk_add_option_entries_libgtk_only (GOptionGroup *group)
 void
 gdk_pre_parse_libgtk_only (void)
 {
+  const char *rendering_mode;
+
   gdk_initialized = TRUE;
 
   /* We set the fallback program class here, rather than lazily in
@@ -236,11 +238,22 @@ gdk_pre_parse_libgtk_only (void)
 
   if (getenv ("GDK_NATIVE_WINDOWS"))
     {
-      _gdk_native_windows = TRUE;
-      /* Ensure that this is not propagated to spawned applications */
+      g_warning ("The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3.\n"
+                 "See the documentation for gdk_window_ensure_native() on how to get native windows.");
       g_unsetenv ("GDK_NATIVE_WINDOWS");
     }
 
+  rendering_mode = g_getenv ("GDK_RENDERING");
+  if (rendering_mode)
+    {
+      if (g_str_equal (rendering_mode, "similar"))
+        _gdk_rendering_mode = GDK_RENDERING_MODE_SIMILAR;
+      else if (g_str_equal (rendering_mode, "image"))
+        _gdk_rendering_mode = GDK_RENDERING_MODE_IMAGE;
+      else if (g_str_equal (rendering_mode, "recording"))
+        _gdk_rendering_mode = GDK_RENDERING_MODE_RECORDING;
+    }
+
   g_type_init ();
 
   /* Do any setup particular to the windowing system */
@@ -306,7 +319,7 @@ gdk_parse_args (int    *argc,
  *
  * Since: 2.2
  */
-G_CONST_RETURN gchar *
+const gchar *
 gdk_get_display_arg_name (void)
 {
   if (!_gdk_display_arg_name)
@@ -419,13 +432,13 @@ gdk_init (int *argc, char ***argv)
  * Win32 backend, GDK calls should not be attempted from multiple threads
  * at all.
  *
- * You must call g_thread_init() and gdk_threads_init() before executing
- * any other GTK+ or GDK functions in a threaded GTK+ program.
+ * You must call gdk_threads_init() before executing any other GTK+ or
+ * GDK functions in a threaded GTK+ program.
  *
- * Idles, timeouts, and input functions from GLib, such as g_idle_add(), are
- * executed outside of the main GTK+ lock.
- * So, if you need to call GTK+ inside of such a callback, you must surround
- * the callback with a gdk_threads_enter()/gdk_threads_leave() pair or use
+ * Idles, timeouts, and input functions from GLib, such as g_idle_add(),
+ * are executed outside of the main GTK+ lock. So, if you need to call
+ * GTK+ inside of such a callback, you must surround the callback with
+ * a gdk_threads_enter()/gdk_threads_leave() pair or use
  * gdk_threads_add_idle_full() which does this for you.
  * However, event dispatching from the mainloop is still executed within
  * the main GTK+ lock, so callback functions connected to event signals
@@ -455,7 +468,6 @@ gdk_init (int *argc, char ***argv)
  * {
  *   GtkWidget *window;
  *
- *   g_thread_init (NULL);
  *   gdk_threads_init (<!-- -->);
  *   gdk_threads_enter (<!-- -->);
  *
@@ -580,7 +592,6 @@ gdk_init (int *argc, char ***argv)
  *   pthread_t no_tid, yes_tid;
  *
  *   /<!---->* init threads *<!---->/
- *   g_thread_init (NULL);
  *   gdk_threads_init (<!-- -->);
  *   gdk_threads_enter (<!-- -->);
  *
@@ -628,9 +639,9 @@ gdk_init (int *argc, char ***argv)
 /**
  * gdk_threads_enter:
  *
- * This macro marks the beginning of a critical section in which GDK and
- * GTK+ functions can be called safely and without causing race
- * conditions.  Only one thread at a time can be in such a critial
+ * This function marks the beginning of a critical section in which
+ * GDK and GTK+ functions can be called safely and without causing race
+ * conditions. Only one thread at a time can be in such a critial
  * section.
  */
 void
@@ -655,15 +666,13 @@ gdk_threads_leave (void)
 static void
 gdk_threads_impl_lock (void)
 {
-  if (gdk_threads_mutex)
-    g_mutex_lock (gdk_threads_mutex);
+  g_mutex_lock (&gdk_threads_mutex);
 }
 
 static void
 gdk_threads_impl_unlock (void)
 {
-  if (gdk_threads_mutex)
-    g_mutex_unlock (gdk_threads_mutex);
+  g_mutex_unlock (&gdk_threads_mutex);
 }
 
 /**
@@ -671,18 +680,13 @@ gdk_threads_impl_unlock (void)
  *
  * Initializes GDK so that it can be used from multiple threads
  * in conjunction with gdk_threads_enter() and gdk_threads_leave().
- * g_thread_init() must be called previous to this function.
  *
  * This call must be made before any use of the main loop from
  * GTK+; to be safe, call it before gtk_init().
- **/
+ */
 void
 gdk_threads_init (void)
 {
-  if (!g_thread_supported ())
-    g_error ("g_thread_init() must be called before gdk_threads_init()");
-
-  gdk_threads_mutex = g_mutex_new ();
   if (!gdk_threads_lock)
     gdk_threads_lock = gdk_threads_impl_lock;
   if (!gdk_threads_unlock)
@@ -770,7 +774,7 @@ gdk_threads_dispatch_free (gpointer data)
  * removed from the list of event sources and will not be called again.
  *
  * This variant of g_idle_add_full() calls @function with the GDK lock
- * held. It can be thought of a MT-safe version for GTK+ widgets for the 
+ * held. It can be thought of a MT-safe version for GTK+ widgets for the
  * following use case, where you have to worry about idle_callback()
  * running in thread A and accessing @self after it has been finalized
  * in thread B:
@@ -1039,7 +1043,7 @@ gdk_threads_add_timeout_seconds (guint       interval,
  *
  * Returns: the program class.
  */
-G_CONST_RETURN char *
+const char *
 gdk_get_program_class (void)
 {
   return gdk_progclass;