X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gdk%2Fgdk.c;h=437ecf99d0cd8446505bf380a4a2ed294e90b940;hb=HEAD;hp=d1793c922492a6240e23ac230165fa68659b725f;hpb=b6ae763e2553d31cb6bd2420c6e1eb2c4ffe8dfa;p=~andy%2Fgtk diff --git a/gdk/gdk.c b/gdk/gdk.c index d1793c922..437ecf99d 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -12,9 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ /* @@ -26,6 +24,8 @@ #include "config.h" +#define GDK_DISABLE_DEPRECATION_WARNINGS 1 + #include "gdkmain.h" #include "gdkinternals.h" @@ -45,7 +45,19 @@ * @Title: General * * This section describes the GDK initialization functions and miscellaneous - * utility functions. + * utility functions, as well as deprecation facilities. + * + * The GDK and GTK+ headers annotate deprecated APIs in a way that produces + * compiler warnings if these deprecated APIs are used. The warnings + * can be turned off by defining the macro %GDK_DISABLE_DEPRECATION_WARNINGS + * before including the glib.h header. + * + * GDK and GTK+ also provide support for building applications against + * defined subsets of deprecated or new APIs. Define the macro + * %GDK_VERSION_MIN_REQUIRED to specify up to what version + * you want to receive warnings about deprecated APIs. Define the + * macro %GDK_VERSION_MAX_ALLOWED to specify the newest version + * whose API you want to use. */ /** @@ -75,6 +87,14 @@ * Use this macro to guard code that is specific to the Quartz backend. */ +/** + * GDK_DISABLE_DEPRECATION_WARNINGS: + * + * A macro that should be defined before including the gdk.h header. + * If it is defined, no compiler warnings will be produced for uses + * of deprecated GDK APIs. + */ + typedef struct _GdkPredicate GdkPredicate; struct _GdkPredicate @@ -118,7 +138,9 @@ static const GDebugKey gdk_debug_keys[] = { {"multihead", GDK_DEBUG_MULTIHEAD}, {"xinerama", GDK_DEBUG_XINERAMA}, {"draw", GDK_DEBUG_DRAW}, - {"eventloop", GDK_DEBUG_EVENTLOOP} + {"eventloop", GDK_DEBUG_EVENTLOOP}, + {"frames", GDK_DEBUG_FRAMES}, + {"settings", GDK_DEBUG_SETTINGS} }; static gboolean @@ -254,8 +276,6 @@ gdk_pre_parse_libgtk_only (void) _gdk_rendering_mode = GDK_RENDERING_MODE_RECORDING; } - g_type_init (); - /* Do any setup particular to the windowing system */ gdk_display_manager_get (); } @@ -428,10 +448,6 @@ gdk_init (int *argc, char ***argv) * which protects all use of GTK+. That is, only one thread can use GTK+ * at any given time. * - * Unfortunately the above holds with the X11 backend only. With the - * Win32 backend, GDK calls should not be attempted from multiple threads - * at all. - * * You must call gdk_threads_init() before executing any other GTK+ or * GDK functions in a threaded GTK+ program. * @@ -633,6 +649,21 @@ gdk_init (int *argc, char ***argv) * } * * + * + * Unfortunately, all of the above documentation holds with the X11 + * backend only. With the Win32 backend, GDK and GTK+ calls should not + * be attempted from multiple threads at all. Combining the GDK lock + * with other locks such as the Python global interpreter lock can be + * complicated. + * + * For these reason, the threading support has been deprecated in + * GTK+ 3.6. Instead of calling GTK+ directly from multiple threads, + * it is recommended to use g_idle_add(), g_main_context_invoke() + * and similar functions to make these calls from the main thread + * instead. The main thread is the thread which has called gtk_init() + * and is running the GTK+ mainloop. GTK+ itself will continue to + * use the GDK lock internally as long as the deprecated functionality + * is still available, and other libraries should probably do the same. */ @@ -643,6 +674,9 @@ gdk_init (int *argc, char ***argv) * 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. + * + * Deprecated:3.6: All GDK and GTK+ calls should be made from the main + * thread */ void gdk_threads_enter (void) @@ -655,6 +689,9 @@ gdk_threads_enter (void) * gdk_threads_leave: * * Leaves a critical region begun with gdk_threads_enter(). + * + * Deprecated:3.6: All GDK and GTK+ calls should be made from the main + * thread */ void gdk_threads_leave (void) @@ -683,6 +720,9 @@ gdk_threads_impl_unlock (void) * * This call must be made before any use of the main loop from * GTK+; to be safe, call it before gtk_init(). + * + * Deprecated:3.6: All GDK and GTK+ calls should be made from the main + * thread */ void gdk_threads_init (void) @@ -720,6 +760,9 @@ gdk_threads_init (void) * This method must be called before gdk_threads_init(), and cannot * be called multiple times. * + * Deprecated:3.6: All GDK and GTK+ calls should be made from the main + * thread + * * Since: 2.4 **/ void @@ -739,12 +782,12 @@ gdk_threads_dispatch (gpointer data) GdkThreadsDispatch *dispatch = data; gboolean ret = FALSE; - GDK_THREADS_ENTER (); + gdk_threads_enter (); if (!g_source_is_destroyed (g_main_current_source ())) ret = dispatch->func (dispatch->data); - GDK_THREADS_LEAVE (); + gdk_threads_leave (); return ret; } @@ -895,7 +938,7 @@ gdk_threads_add_idle (GSourceFunc function, * * self->timeout_id = 0; * - * return FALSE; + * return G_SOURCE_REMOVE; * } * * static void some_widget_do_stuff_later (SomeWidget *self)