+2003-12-02 Michael Meeks <michael@ximian.com>
+
+ Based on a patch by Martin Kretzschmar; #122448
+
+ * gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
+ implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
+ (GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
+ function pointers. Deprecate the global gdk_threads_mutex variable.
+
+ * gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
+ extracted from GTK_THREADS_ENTER/LEAVE macros.
+ (gdk_threads_init): init gtk_threads_[un]lock if not set.
+ (gdk_threads_set_lock_functions): impl.
+
+ * gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
+
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
- label for the empty list. String change. (#95446, Tomas Ögren)
+ label for the empty list. String change. (#95446, Tomas Ã\83Â\96gren)
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c (event_window_still_viewable):
Before delivering an event to a widget, check that
(if relevant), the event's window is still viewable.
- (#105642, Dennis Björklund)
+ (#105642, Dennis BjÃ\83¶rklund)
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
NULL out private->parent, since after destruction
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
- #107883, Gustavo Giráldez
+ #107883, Gustavo GirÃ\83¡ldez
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
Split out the case where we know we changed, and
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
out if the level only has one item, recurse over the child if there
- is one. (Fixes #100458, reported by Gaël Le Mignot).
+ is one. (Fixes #100458, reported by GaÃ\83«l Le Mignot).
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
+2003-12-02 Michael Meeks <michael@ximian.com>
+
+ Based on a patch by Martin Kretzschmar; #122448
+
+ * gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
+ implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
+ (GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
+ function pointers. Deprecate the global gdk_threads_mutex variable.
+
+ * gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
+ extracted from GTK_THREADS_ENTER/LEAVE macros.
+ (gdk_threads_init): init gtk_threads_[un]lock if not set.
+ (gdk_threads_set_lock_functions): impl.
+
+ * gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
+
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
- label for the empty list. String change. (#95446, Tomas Ögren)
+ label for the empty list. String change. (#95446, Tomas Ã\83Â\96gren)
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c (event_window_still_viewable):
Before delivering an event to a widget, check that
(if relevant), the event's window is still viewable.
- (#105642, Dennis Björklund)
+ (#105642, Dennis BjÃ\83¶rklund)
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
NULL out private->parent, since after destruction
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
- #107883, Gustavo Giráldez
+ #107883, Gustavo GirÃ\83¡ldez
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
Split out the case where we know we changed, and
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
out if the level only has one item, recurse over the child if there
- is one. (Fixes #100458, reported by Gaël Le Mignot).
+ is one. (Fixes #100458, reported by GaÃ\83«l Le Mignot).
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
+2003-12-02 Michael Meeks <michael@ximian.com>
+
+ Based on a patch by Martin Kretzschmar; #122448
+
+ * gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
+ implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
+ (GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
+ function pointers. Deprecate the global gdk_threads_mutex variable.
+
+ * gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
+ extracted from GTK_THREADS_ENTER/LEAVE macros.
+ (gdk_threads_init): init gtk_threads_[un]lock if not set.
+ (gdk_threads_set_lock_functions): impl.
+
+ * gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
+
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
- label for the empty list. String change. (#95446, Tomas Ögren)
+ label for the empty list. String change. (#95446, Tomas Ã\83Â\96gren)
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c (event_window_still_viewable):
Before delivering an event to a widget, check that
(if relevant), the event's window is still viewable.
- (#105642, Dennis Björklund)
+ (#105642, Dennis BjÃ\83¶rklund)
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
NULL out private->parent, since after destruction
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
- #107883, Gustavo Giráldez
+ #107883, Gustavo GirÃ\83¡ldez
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
Split out the case where we know we changed, and
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
out if the level only has one item, recurse over the child if there
- is one. (Fixes #100458, reported by Gaël Le Mignot).
+ is one. (Fixes #100458, reported by GaÃ\83«l Le Mignot).
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
+2003-12-02 Michael Meeks <michael@ximian.com>
+
+ Based on a patch by Martin Kretzschmar; #122448
+
+ * gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
+ implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
+ (GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
+ function pointers. Deprecate the global gdk_threads_mutex variable.
+
+ * gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
+ extracted from GTK_THREADS_ENTER/LEAVE macros.
+ (gdk_threads_init): init gtk_threads_[un]lock if not set.
+ (gdk_threads_set_lock_functions): impl.
+
+ * gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
+
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
- label for the empty list. String change. (#95446, Tomas Ögren)
+ label for the empty list. String change. (#95446, Tomas Ã\83Â\96gren)
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c (event_window_still_viewable):
Before delivering an event to a widget, check that
(if relevant), the event's window is still viewable.
- (#105642, Dennis Björklund)
+ (#105642, Dennis BjÃ\83¶rklund)
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
NULL out private->parent, since after destruction
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
- #107883, Gustavo Giráldez
+ #107883, Gustavo GirÃ\83¡ldez
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
Split out the case where we know we changed, and
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
out if the level only has one item, recurse over the child if there
- is one. (Fixes #100458, reported by Gaël Le Mignot).
+ is one. (Fixes #100458, reported by GaÃ\83«l Le Mignot).
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
+2003-12-02 Michael Meeks <michael@ximian.com>
+
+ Based on a patch by Martin Kretzschmar; #122448
+
+ * gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
+ implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
+ (GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
+ function pointers. Deprecate the global gdk_threads_mutex variable.
+
+ * gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
+ extracted from GTK_THREADS_ENTER/LEAVE macros.
+ (gdk_threads_init): init gtk_threads_[un]lock if not set.
+ (gdk_threads_set_lock_functions): impl.
+
+ * gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
+
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
- label for the empty list. String change. (#95446, Tomas Ögren)
+ label for the empty list. String change. (#95446, Tomas Ã\83Â\96gren)
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c (event_window_still_viewable):
Before delivering an event to a widget, check that
(if relevant), the event's window is still viewable.
- (#105642, Dennis Björklund)
+ (#105642, Dennis BjÃ\83¶rklund)
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
NULL out private->parent, since after destruction
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
- #107883, Gustavo Giráldez
+ #107883, Gustavo GirÃ\83¡ldez
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
Split out the case where we know we changed, and
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
out if the level only has one item, recurse over the child if there
- is one. (Fixes #100458, reported by Gaël Le Mignot).
+ is one. (Fixes #100458, reported by GaÃ\83«l Le Mignot).
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
GDK_THREADS_LEAVE ();
}
+static void
+gdk_threads_impl_lock (void)
+{
+ if (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);
+}
+
/**
* gdk_threads_init:
*
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)
+ gdk_threads_unlock = gdk_threads_impl_unlock;
+}
+
+/**
+ * gdk_threads_set_lock_functions:
+ * @enter_fn: function called to guard gtk+
+ * @leave_fn: function called to release the guard
+ *
+ * Allows the application to replace the standard method that
+ * GDK uses to protect its data structures. Normally, GDK
+ * creates a single #GMutex that is locked by gdk_threads_enter(),
+ * and released by gdk_threads_leave(); using this function an
+ * application provides, instead, a function @enter_fn that is
+ * called by gdk_threads_enter() and a function @leave_fn that is
+ * called by gdk_threads_leave().
+ *
+ * The functions must provide at least same locking functionality
+ * as the default implementation, but can also do extra application
+ * specific processing.
+ *
+ * As an example, consider an application that has its own recursive
+ * lock that when held, holds the GTK+ lock as well. When GTK+ unlocks
+ * the GTK+ lock when entering a recursive main loop, the application
+ * must temporarily release its lock as well.
+ *
+ * Most threaded GTK+ apps won't need to use this method.
+ *
+ * This method must be called before gdk_threads_init, and cannot
+ * be called multiple times.
+ **/
+void
+gdk_threads_set_lock_functions (GCallback enter_fn,
+ GCallback leave_fn)
+{
+ g_return_if_fail (gdk_threads_lock == NULL &&
+ gdk_threads_unlock == NULL);
+
+ gdk_threads_lock = enter_fn;
+ gdk_threads_unlock = leave_fn;
}
G_CONST_RETURN char *
/* Threading
*/
-GDKVAR GMutex *gdk_threads_mutex;
+#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);
+void gdk_threads_init (void);
+void gdk_threads_set_lock_functions (GCallback enter_fn,
+ GCallback leave_fn);
#ifdef G_THREADS_ENABLED
# define GDK_THREADS_ENTER() G_STMT_START { \
- if (gdk_threads_mutex) \
- g_mutex_lock (gdk_threads_mutex); \
+ if (gdk_threads_lock) \
+ (*gdk_threads_lock) (); \
} G_STMT_END
# define GDK_THREADS_LEAVE() G_STMT_START { \
- if (gdk_threads_mutex) \
- g_mutex_unlock (gdk_threads_mutex); \
+ if (gdk_threads_unlock) \
+ (*gdk_threads_unlock) (); \
} G_STMT_END
#else /* !G_THREADS_ENABLED */
# define GDK_THREADS_ENTER()
GSList *_gdk_displays = NULL;
-GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
-
+GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
+GCallback gdk_threads_lock = NULL;
+GCallback gdk_threads_unlock = NULL;