[gtk+] Remove variables from the platform-independent GDK API



commit 3963d5aa768b4e9e9f2c02888c24e9b2d850a2f9
Author: Tor Lillqvist <tml iki fi>
Date:   Wed Sep 8 15:55:45 2010 +0300

    Remove variables from the platform-independent GDK API
    
    gdk_threads_mutex, gdk_threads_lock and gdk_threads_unlock are removed
    from public API. gdk_threads_mutex was deprecated already. Instead of
    using gdk_threads_lock and _unlock one was presumably supposed to use
    the GDK_THREADS_ENTER and _LEAVE macros, which now simply call the
    corresponding gdk_threads_enter() and _leave() functions.
    
    Remove he dllimport/dllexport ugliness for GDK for Windows.
    
    There is still a gdk_display variable being exported by the X11
    backend.

 gdk/gdk.c        |   11 +++++++++--
 gdk/gdk.h        |   22 ++--------------------
 gdk/gdk.symbols  |    6 ------
 gdk/gdkglobals.c |    4 ----
 gdk/gdktypes.h   |   10 ----------
 5 files changed, 11 insertions(+), 42 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 6f494e8..78d133b 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -63,6 +63,11 @@ static int gdk_initialized = 0;			    /* 1 if the library is initialized,
 
 static gchar  *gdk_progclass = NULL;
 
+static GMutex *gdk_threads_mutex = NULL;            /* Global GDK lock */
+
+static GCallback gdk_threads_lock = NULL;
+static GCallback gdk_threads_unlock = NULL;
+
 #ifdef G_ENABLE_DEBUG
 static const GDebugKey gdk_debug_keys[] = {
   {"events",	    GDK_DEBUG_EVENTS},
@@ -384,13 +389,15 @@ gdk_init (int *argc, char ***argv)
 void
 gdk_threads_enter (void)
 {
-  GDK_THREADS_ENTER ();
+  if (gdk_threads_lock)
+    (*gdk_threads_lock) ();
 }
 
 void
 gdk_threads_leave (void)
 {
-  GDK_THREADS_LEAVE ();
+  if (gdk_threads_unlock)
+    (*gdk_threads_unlock) ();
 }
 
 static void
diff --git a/gdk/gdk.h b/gdk/gdk.h
index d3a0ea8..9738104 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -151,13 +151,6 @@ void gdk_notify_startup_complete_with_id (const gchar* startup_id);
 /* Threading
  */
 
-#if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION)
-GDKVAR GMutex *gdk_threads_mutex; /* private */
-#endif
-
-GDKVAR GCallback gdk_threads_lock;
-GDKVAR GCallback gdk_threads_unlock;
-
 void     gdk_threads_enter                    (void);
 void     gdk_threads_leave                    (void);
 void     gdk_threads_init                     (void);
@@ -187,19 +180,8 @@ guint    gdk_threads_add_timeout_seconds      (guint          interval,
                                                GSourceFunc    function,
                                                gpointer       data);
 
-#ifdef	G_THREADS_ENABLED
-#  define GDK_THREADS_ENTER()	G_STMT_START {	\
-      if (gdk_threads_lock)                 	\
-        (*gdk_threads_lock) ();			\
-   } G_STMT_END
-#  define GDK_THREADS_LEAVE()	G_STMT_START { 	\
-      if (gdk_threads_unlock)                 	\
-        (*gdk_threads_unlock) ();		\
-   } G_STMT_END
-#else	/* !G_THREADS_ENABLED */
-#  define GDK_THREADS_ENTER()
-#  define GDK_THREADS_LEAVE()
-#endif	/* !G_THREADS_ENABLED */
+#define GDK_THREADS_ENTER() gdk_threads_enter()
+#define GDK_THREADS_LEAVE() gdk_threads_leave()
 
 G_END_DECLS
 
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index acf1470..b5e4439 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -1093,12 +1093,6 @@ gdk_window_impl_get_type G_GNUC_CONST
 #endif
 #endif
 
-#ifdef INCLUDE_VARIABLES
-gdk_threads_mutex
-gdk_threads_lock
-gdk_threads_unlock
-#endif
-
 #ifdef GDK_WINDOWING_X11
 #ifdef INCLUDE_VARIABLES
 gdk_display
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
index e92ad48..b9d86e1 100644
--- a/gdk/gdkglobals.c
+++ b/gdk/gdkglobals.c
@@ -43,7 +43,3 @@ gboolean            _gdk_native_windows = FALSE;
 gboolean            _gdk_enable_multidevice = FALSE;
 
 GSList             *_gdk_displays = NULL;
-
-GMutex              *gdk_threads_mutex = NULL;          /* Global GDK lock */
-GCallback            gdk_threads_lock = NULL;
-GCallback            gdk_threads_unlock = NULL;
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 8630d7d..ab52197 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -38,16 +38,6 @@
 #include <glib-object.h>
 #include <cairo.h>
 
-#ifdef G_OS_WIN32
-#  ifdef GDK_COMPILATION
-#    define GDKVAR __declspec(dllexport)
-#  else
-#    define GDKVAR extern __declspec(dllimport)
-#  endif
-#else
-#  define GDKVAR extern
-#endif
-
 /* The system specific file gdkconfig.h contains such configuration
  * settings that are needed not only when compiling GDK (or GTK)
  * itself, but also occasionally when compiling programs that use GDK



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]