summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1998-12-16 20:09:30 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-12-16 20:09:30 +0000
commitfcfe7370d8a9ac7b169282418e4f2bc58e6d9eb4 (patch)
treeb1629251195a04377d72cbb49a90af3db3c18afb
parent0dcdac5828bfb039f0a35be2d21fd6b3b8750d4c (diff)
downloadgdk-pixbuf-fcfe7370d8a9ac7b169282418e4f2bc58e6d9eb4.tar.gz
Move main thread lock back to GDK - we need it there for locking when
Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main thread lock back to GDK - we need it there for locking when translating events. Rename things appropriately. Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo. CVS:
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.pre-2-010
-rw-r--r--ChangeLog.pre-2-1010
-rw-r--r--ChangeLog.pre-2-210
-rw-r--r--ChangeLog.pre-2-410
-rw-r--r--ChangeLog.pre-2-610
-rw-r--r--ChangeLog.pre-2-810
-rw-r--r--gdk/gdk.c16
-rw-r--r--gdk/gdk.h21
-rw-r--r--gdk/gdkevents.c28
-rw-r--r--gdk/gdkglobals.c2
-rw-r--r--gdk/x11/gdkevents-x11.c28
-rw-r--r--gdk/x11/gdkglobals-x11.c2
-rw-r--r--gdk/x11/gdkmain-x11.c16
-rw-r--r--gtk/gtkaccellabel.c5
-rw-r--r--gtk/gtkclist.c9
-rw-r--r--gtk/gtkcolorsel.c5
-rw-r--r--gtk/gtkcombo.c5
-rw-r--r--gtk/gtkcontainer.c4
-rw-r--r--gtk/gtkdnd.c5
-rw-r--r--gtk/gtkentry.c5
-rw-r--r--gtk/gtklayout.c3
-rw-r--r--gtk/gtklist.c9
-rw-r--r--gtk/gtkmain.c21
-rw-r--r--gtk/gtkmain.h3
-rw-r--r--gtk/gtkmenuitem.c5
-rw-r--r--gtk/gtknotebook.c5
-rw-r--r--gtk/gtkprivate.h19
-rw-r--r--gtk/gtkrange.c11
-rw-r--r--gtk/gtkselection.c9
-rw-r--r--gtk/gtkspinbutton.c5
-rw-r--r--gtk/gtkstyle.c1
-rw-r--r--gtk/gtktext.c5
-rw-r--r--gtk/gtkthemes.c1
-rw-r--r--gtk/gtktooltips.c5
-rw-r--r--gtk/gtkwidget.c4
-rw-r--r--gtk/testthreads.c14
-rw-r--r--tests/testthreads.c14
38 files changed, 237 insertions, 118 deletions
diff --git a/ChangeLog b/ChangeLog
index e29129302..03789eac7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main
+ thread lock back to GDK - we need it there for locking
+ when translating events. Rename things appropriately.
+
+Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo.
+
Wed Dec 16 10:20:27 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GTK+ 1.1.8
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index e29129302..03789eac7 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,13 @@
+Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main
+ thread lock back to GDK - we need it there for locking
+ when translating events. Rename things appropriately.
+
+Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo.
+
Wed Dec 16 10:20:27 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GTK+ 1.1.8
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index e29129302..03789eac7 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,13 @@
+Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main
+ thread lock back to GDK - we need it there for locking
+ when translating events. Rename things appropriately.
+
+Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo.
+
Wed Dec 16 10:20:27 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GTK+ 1.1.8
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index e29129302..03789eac7 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,13 @@
+Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main
+ thread lock back to GDK - we need it there for locking
+ when translating events. Rename things appropriately.
+
+Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo.
+
Wed Dec 16 10:20:27 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GTK+ 1.1.8
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index e29129302..03789eac7 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,13 @@
+Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main
+ thread lock back to GDK - we need it there for locking
+ when translating events. Rename things appropriately.
+
+Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo.
+
Wed Dec 16 10:20:27 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GTK+ 1.1.8
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index e29129302..03789eac7 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,13 @@
+Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main
+ thread lock back to GDK - we need it there for locking
+ when translating events. Rename things appropriately.
+
+Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo.
+
Wed Dec 16 10:20:27 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GTK+ 1.1.8
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index e29129302..03789eac7 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,13 @@
+Wed Dec 16 13:06:17 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdk.[ch] gtk/gtkmain.[ch] gtk/gtkprivate.h: Move main
+ thread lock back to GDK - we need it there for locking
+ when translating events. Rename things appropriately.
+
+Wed Dec 16 11:44:21 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkrange.c (gtk_range_expose): Fix a x/y typo.
+
Wed Dec 16 10:20:27 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GTK+ 1.1.8
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 97c2a8c22..e09548083 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -149,6 +149,9 @@ gdk_init (int *argc,
if (gdk_initialized)
return;
+ if (g_thread_supported ())
+ gdk_threads_mutex = g_mutex_new ();
+
if (argc && argv)
{
argc_orig = *argc;
@@ -1265,3 +1268,16 @@ gdk_keyval_is_lower (guint keyval)
}
return TRUE;
}
+
+void
+gdk_threads_enter ()
+{
+ GDK_THREADS_ENTER ();
+}
+
+void
+gdk_threads_leave ()
+{
+ GDK_THREADS_LEAVE ();
+}
+
diff --git a/gdk/gdk.h b/gdk/gdk.h
index f21cede9c..48cc2acec 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -959,6 +959,27 @@ guint gdk_keyval_to_lower (guint keyval);
gboolean gdk_keyval_is_upper (guint keyval);
gboolean gdk_keyval_is_lower (guint keyval);
+/* Threading
+ */
+
+extern GMutex *gdk_threads_mutex;
+
+void gdk_threads_enter (void);
+void gdk_threads_leave (void);
+
+#ifdef G_THREADS_ENABLED
+# define GDK_THREADS_ENTER() G_STMT_START { \
+ if (gdk_threads_mutex) \
+ g_mutex_lock (gdk_threads_mutex); \
+ } G_STMT_END
+# define GDK_THREADS_LEAVE() G_STMT_START { \
+ if (gdk_threads_mutex) \
+ g_mutex_unlock (gdk_threads_mutex); \
+ } G_STMT_END
+#else /* !G_THREADS_ENABLED */
+# define GDK_THREADS_ENTER()
+# define GDK_THREADS_LEAVE()
+#endif /* !G_THREADS_ENABLED */
#include <gdk/gdkrgb.h>
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 8ddf913da..1c1ebc0ad 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1891,20 +1891,36 @@ gdk_event_prepare (gpointer source_data,
GTimeVal *current_time,
gint *timeout)
{
+ gboolean retval;
+
+ GDK_THREADS_ENTER ();
+
*timeout = -1;
gdk_events_queue ();
- return (queued_events || putback_events);
+ retval = (queued_events || putback_events);
+
+ GDK_THREADS_LEAVE ();
+
+ return retval;
}
static gboolean
gdk_event_check (gpointer source_data,
GTimeVal *current_time)
{
+ gboolean retval;
+
+ GDK_THREADS_ENTER ();
+
if (event_poll_fd.revents & G_IO_IN)
gdk_events_queue ();
- return (queued_events || putback_events);
+ retval = (queued_events || putback_events);
+
+ GDK_THREADS_LEAVE ();
+
+ return retval;
}
static GdkEvent *
@@ -1942,7 +1958,11 @@ gdk_event_dispatch (gpointer source_data,
GTimeVal *current_time,
gpointer user_data)
{
- GdkEvent *event = gdk_event_unqueue();
+ GdkEvent *event;
+
+ GDK_THREADS_ENTER ();
+
+ event = gdk_event_unqueue();
if (event)
{
@@ -1952,6 +1972,8 @@ gdk_event_dispatch (gpointer source_data,
gdk_event_free (event);
}
+ GDK_THREADS_LEAVE ();
+
return TRUE;
}
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
index d0832767c..eabd107db 100644
--- a/gdk/gdkglobals.c
+++ b/gdk/gdkglobals.c
@@ -64,6 +64,8 @@ GdkWindowPrivate *gdk_xgrab_window = NULL; /* Window that currently holds the
* x pointer grab
*/
+GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
+
#ifdef USE_XIM
GdkICPrivate *gdk_xim_ic; /* currently using IC */
GdkWindow *gdk_xim_window; /* currently using Window */
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 8ddf913da..1c1ebc0ad 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -1891,20 +1891,36 @@ gdk_event_prepare (gpointer source_data,
GTimeVal *current_time,
gint *timeout)
{
+ gboolean retval;
+
+ GDK_THREADS_ENTER ();
+
*timeout = -1;
gdk_events_queue ();
- return (queued_events || putback_events);
+ retval = (queued_events || putback_events);
+
+ GDK_THREADS_LEAVE ();
+
+ return retval;
}
static gboolean
gdk_event_check (gpointer source_data,
GTimeVal *current_time)
{
+ gboolean retval;
+
+ GDK_THREADS_ENTER ();
+
if (event_poll_fd.revents & G_IO_IN)
gdk_events_queue ();
- return (queued_events || putback_events);
+ retval = (queued_events || putback_events);
+
+ GDK_THREADS_LEAVE ();
+
+ return retval;
}
static GdkEvent *
@@ -1942,7 +1958,11 @@ gdk_event_dispatch (gpointer source_data,
GTimeVal *current_time,
gpointer user_data)
{
- GdkEvent *event = gdk_event_unqueue();
+ GdkEvent *event;
+
+ GDK_THREADS_ENTER ();
+
+ event = gdk_event_unqueue();
if (event)
{
@@ -1952,6 +1972,8 @@ gdk_event_dispatch (gpointer source_data,
gdk_event_free (event);
}
+ GDK_THREADS_LEAVE ();
+
return TRUE;
}
diff --git a/gdk/x11/gdkglobals-x11.c b/gdk/x11/gdkglobals-x11.c
index d0832767c..eabd107db 100644
--- a/gdk/x11/gdkglobals-x11.c
+++ b/gdk/x11/gdkglobals-x11.c
@@ -64,6 +64,8 @@ GdkWindowPrivate *gdk_xgrab_window = NULL; /* Window that currently holds the
* x pointer grab
*/
+GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
+
#ifdef USE_XIM
GdkICPrivate *gdk_xim_ic; /* currently using IC */
GdkWindow *gdk_xim_window; /* currently using Window */
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
index 97c2a8c22..e09548083 100644
--- a/gdk/x11/gdkmain-x11.c
+++ b/gdk/x11/gdkmain-x11.c
@@ -149,6 +149,9 @@ gdk_init (int *argc,
if (gdk_initialized)
return;
+ if (g_thread_supported ())
+ gdk_threads_mutex = g_mutex_new ();
+
if (argc && argv)
{
argc_orig = *argc;
@@ -1265,3 +1268,16 @@ gdk_keyval_is_lower (guint keyval)
}
return TRUE;
}
+
+void
+gdk_threads_enter ()
+{
+ GDK_THREADS_ENTER ();
+}
+
+void
+gdk_threads_leave ()
+{
+ GDK_THREADS_LEAVE ();
+}
+
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 407e283f2..2b3445a5f 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -24,7 +24,6 @@
#include "gtkmain.h"
#include "gtksignal.h"
#include "gtkaccellabel.h"
-#include "gtkprivate.h"
enum {
@@ -354,9 +353,9 @@ gtk_accel_label_refetch_idle (GtkAccelLabel *accel_label)
{
gboolean retval;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
retval = gtk_accel_label_refetch (accel_label);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return retval;
}
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 718eaec82..6b88a7abf 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -24,7 +24,6 @@
#include "gtkclist.h"
#include "gtkbindings.h"
#include "gtkdnd.h"
-#include "gtkprivate.h"
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
@@ -7014,7 +7013,7 @@ horizontal_timeout (GtkCList *clist)
GdkEventMotion event;
GdkModifierType mask;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
clist->htimer = 0;
gdk_window_get_pointer (clist->clist_window, &x, &y, &mask);
@@ -7026,7 +7025,7 @@ horizontal_timeout (GtkCList *clist)
gtk_clist_motion (GTK_WIDGET (clist), &event);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
@@ -7038,7 +7037,7 @@ vertical_timeout (GtkCList *clist)
GdkEventMotion event;
GdkModifierType mask;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
clist->vtimer = 0;
gdk_window_get_pointer (clist->clist_window, &x, &y, &mask);
@@ -7050,7 +7049,7 @@ vertical_timeout (GtkCList *clist)
gtk_clist_motion (GTK_WIDGET (clist), &event);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index 23a621a27..eb660b9d4 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -24,7 +24,6 @@
#include "gtkwindow.h"
#include "gtkhbbox.h"
#include "gtkdnd.h"
-#include "gtkprivate.h"
#include "gtkselection.h"
/*
@@ -1028,13 +1027,13 @@ gtk_color_selection_value_timeout (GtkColorSelection *colorsel)
{
gint x, y;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
gdk_window_get_pointer (colorsel->value_area->window, &x, &y, NULL);
gtk_color_selection_update_value (colorsel, y);
gtk_color_selection_color_changed (colorsel);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return (TRUE);
}
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index c9302b43e..8d29d206f 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -28,7 +28,6 @@
#include "gtklistitem.h"
#include "gtkscrolledwindow.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtkwindow.h"
#include "gdk/gdkkeysyms.h"
@@ -237,9 +236,9 @@ gtk_combo_focus_idle (GtkCombo * combo)
{
if (combo)
{
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
gtk_widget_grab_focus (combo->entry);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
}
return FALSE;
}
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 31eb7816d..22b67db56 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -811,7 +811,7 @@ gtk_container_get_resize_container (GtkContainer *container)
static gboolean
gtk_container_idle_sizer (gpointer data)
{
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
@@ -833,7 +833,7 @@ gtk_container_idle_sizer (gpointer data)
gtk_container_check_resize (GTK_CONTAINER (widget));
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 9dcb375c7..877322c66 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -22,7 +22,6 @@
#include "gtkdnd.h"
#include "gtkinvisible.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtkwindow.h"
@@ -2272,7 +2271,7 @@ gtk_drag_anim_timeout (gpointer data)
gint x, y;
gboolean retval;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
if (anim->step == anim->n_steps)
{
@@ -2295,7 +2294,7 @@ gtk_drag_anim_timeout (gpointer data)
retval = TRUE;
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return retval;
}
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 39a01313b..ca5a3728e 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -22,7 +22,6 @@
#include "gdk/gdki18n.h"
#include "gtkentry.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtkselection.h"
#include "gtksignal.h"
#include "gtkstyle.h"
@@ -1481,13 +1480,13 @@ gtk_entry_timer (gpointer data)
{
GtkEntry *entry;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
entry = GTK_ENTRY (data);
entry->timer = 0;
gtk_entry_draw_text (entry);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index ac961d87c..e2616f1dd 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -508,6 +508,9 @@ gtk_layout_unrealize (GtkWidget *widget)
tmp_list = tmp_list->next;
}
+
+ if (GTK_WIDGET_CLASS (parent_class)->unrealize)
+ (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
static void
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 32856d73a..d0049ec7e 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -19,7 +19,6 @@
#include "gtklist.h"
#include "gtklistitem.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtklabel.h"
@@ -2309,7 +2308,7 @@ gtk_list_horizontal_timeout (GtkWidget *list)
GdkEventMotion event;
GdkModifierType mask;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
GTK_LIST (list)->htimer = 0;
gdk_window_get_pointer (list->window, &x, &y, &mask);
@@ -2321,7 +2320,7 @@ gtk_list_horizontal_timeout (GtkWidget *list)
gtk_list_motion_notify (list, &event);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
@@ -2334,7 +2333,7 @@ gtk_list_vertical_timeout (GtkWidget *list)
GdkEventMotion event;
GdkModifierType mask;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
GTK_LIST (list)->vtimer = 0;
gdk_window_get_pointer (list->window, &x, &y, &mask);
@@ -2346,7 +2345,7 @@ gtk_list_vertical_timeout (GtkWidget *list)
gtk_list_motion_notify (list, &event);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 949aab3c4..ff595d51f 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -133,8 +133,6 @@ static GdkColormap *gtk_colormap; /* The colormap to be used in creating new
guint gtk_debug_flags = 0; /* Global GTK debug flag */
-GMutex *gtk_threads_mutex = NULL; /* Global GTK lock */
-
#ifdef G_ENABLE_DEBUG
static const GDebugKey gtk_debug_keys[] = {
{"objects", GTK_DEBUG_OBJECTS},
@@ -185,9 +183,6 @@ gtk_init (int *argc,
* single threaded until gtk_init().
*/
- if (g_thread_supported ())
- gtk_threads_mutex = g_mutex_new ();
-
#if 0
g_set_error_handler (gtk_error);
g_set_warning_handler (gtk_warning);
@@ -459,9 +454,9 @@ gtk_main (void)
loop = g_main_new ();
main_loops = g_slist_prepend (main_loops, loop);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
g_main_run (loop);
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
g_main_destroy (loop);
@@ -1248,18 +1243,6 @@ gtk_propagate_event (GtkWidget *widget,
}
}
-void
-gtk_threads_enter ()
-{
- GTK_THREADS_ENTER ();
-}
-
-void
-gtk_threads_leave ()
-{
- GTK_THREADS_LEAVE ();
-}
-
#if 0
static void
gtk_error (gchar *str)
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 8856716a5..69dda5a9d 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -131,9 +131,6 @@ void gtk_key_snooper_remove (guint snooper_handler_id);
GdkEvent* gtk_get_current_event (void);
GtkWidget* gtk_get_event_widget (GdkEvent *event);
-void gtk_threads_enter (void);
-void gtk_threads_leave (void);
-
/* deprecated */
guint gtk_idle_add_interp (GtkCallbackMarshal marshal,
gpointer data,
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 1af6d8e17..143121067 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -19,7 +19,6 @@
#include <string.h>
#include "gtkaccellabel.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtkmenu.h"
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
@@ -621,7 +620,7 @@ gtk_menu_item_select_timeout (gpointer data)
{
GtkMenuItem *menu_item;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
menu_item = GTK_MENU_ITEM (data);
menu_item->timer = 0;
@@ -644,7 +643,7 @@ gtk_menu_item_select_timeout (gpointer data)
gtk_menu_shell_select_item (submenu, submenu->children->data);
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index f8f30549d..b3a2210ca 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -19,7 +19,6 @@
#include "gtknotebook.h"
#include "gtksignal.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtklabel.h"
@@ -1837,7 +1836,7 @@ gtk_notebook_timer (GtkNotebook *notebook)
{
gboolean retval = FALSE;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
if (notebook->timer)
{
@@ -1866,7 +1865,7 @@ gtk_notebook_timer (GtkNotebook *notebook)
retval = TRUE;
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return retval;
}
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 9c22b1019..a71cd7316 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -60,25 +60,6 @@ typedef enum
#define GTK_PRIVATE_SET_FLAG(wid,flag) G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) |= (PRIVATE_ ## flag)); }G_STMT_END
#define GTK_PRIVATE_UNSET_FLAG(wid,flag) G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) &= ~(PRIVATE_ ## flag)); }G_STMT_END
-/* Threading functions */
-
-extern GMutex *gtk_threads_mutex;
-
-#ifdef G_THREADS_ENABLED
-# define GTK_THREADS_ENTER() G_STMT_START { \
- if (gtk_threads_mutex) \
- g_mutex_lock (gtk_threads_mutex); \
- } G_STMT_END
-# define GTK_THREADS_LEAVE() G_STMT_START { \
- if (gtk_threads_mutex) \
- g_mutex_unlock (gtk_threads_mutex); \
- } G_STMT_END
-#else /* !G_THREADS_ENABLED */
-# define GTK_THREADS_ENTER()
-# define GTK_THREADS_LEAVE()
-#endif /* !G_THREADS_ENABLED */
-
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index e75d7046a..b81d213ed 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -19,7 +19,6 @@
#include <stdio.h>
#include "gtkmain.h"
#include "gtkrange.h"
-#include "gtkprivate.h"
#include "gtksignal.h"
@@ -815,12 +814,12 @@ gtk_range_expose (GtkWidget *widget,
(event->area.x + event->area.width <=
widget->allocation.width - xt) &&
(event->area.y + event->area.height <=
- widget->allocation.height - xt)))
+ widget->allocation.height - yt)))
gtk_range_draw_trough (range);
}
else if (event->window == widget->window)
{
- gtk_range_draw_background (range);
+ gtk_range_draw_background (range);
}
else if (event->window == range->slider)
{
@@ -1237,7 +1236,7 @@ gtk_real_range_timer (GtkRange *range)
{
gint return_val;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
return_val = TRUE;
if (range->click_child == RANGE_CLASS (range)->slider)
@@ -1259,7 +1258,7 @@ gtk_real_range_timer (GtkRange *range)
(gpointer) range);
else
{
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
range->need_timer = FALSE;
@@ -1287,7 +1286,7 @@ gtk_real_range_timer (GtkRange *range)
return_val = gtk_range_scroll (range, -1);
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return return_val;
}
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 06cb5ceac..2aa6c8cbd 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -49,7 +49,6 @@
#include <gdk/gdkx.h>
/* we need this for gdk_window_lookup() */
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtkselection.h"
#include "gtksignal.h"
@@ -1092,7 +1091,7 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
GList *tmp_list;
gboolean retval;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
@@ -1129,7 +1128,7 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
retval = TRUE; /* timeout will happen again */
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return retval;
}
@@ -1334,7 +1333,7 @@ gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
GList *tmp_list;
gboolean retval;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
@@ -1369,7 +1368,7 @@ gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
retval = TRUE; /* timeout will happen again */
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return retval;
}
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index d3d4ef6b8..54162c5f0 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -28,7 +28,6 @@
#include "gdk/gdkkeysyms.h"
#include "gtkspinbutton.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtksignal.h"
@@ -910,7 +909,7 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
{
gboolean retval = FALSE;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
if (spin_button->timer)
{
@@ -943,7 +942,7 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
}
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return retval;
}
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 3765fdc46..8d737198a 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -23,7 +23,6 @@
#include "gtkthemes.h"
#include "gtkwidget.h"
#include "gtkthemes.h"
-#include "gtkprivate.h"
#include "gdk/gdkprivate.h"
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 0a629e0b1..78dffac1b 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -21,7 +21,6 @@
#include "gdk/gdkkeysyms.h"
#include "gdk/gdki18n.h"
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtkselection.h"
#include "gtksignal.h"
#include "gtktext.h"
@@ -1701,7 +1700,7 @@ gtk_text_scroll_timeout (gpointer data)
gint x, y;
GdkModifierType mask;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
text = GTK_TEXT (data);
@@ -1718,7 +1717,7 @@ gtk_text_scroll_timeout (gpointer data)
gtk_text_motion_notify (GTK_WIDGET (text), &event);
}
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/gtkthemes.c b/gtk/gtkthemes.c
index c0510d046..8f8eeda61 100644
--- a/gtk/gtkthemes.c
+++ b/gtk/gtkthemes.c
@@ -26,7 +26,6 @@
#include "gtkselection.h"
#include "gtksignal.h"
#include "gtkwidget.h"
-#include "gtkprivate.h"
#include "config.h"
typedef struct _GtkThemeEnginePrivate GtkThemeEnginePrivate;
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
index 41bb12d71..03d99774f 100644
--- a/gtk/gtktooltips.c
+++ b/gtk/gtktooltips.c
@@ -21,7 +21,6 @@
#include <stdio.h>
#include "gtkmain.h"
-#include "gtkprivate.h"
#include "gtkwidget.h"
#include "gtkwindow.h"
#include "gtksignal.h"
@@ -495,13 +494,13 @@ gtk_tooltips_timeout (gpointer data)
{
GtkTooltips *tooltips = (GtkTooltips *) data;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
if (tooltips->active_tips_data != NULL &&
GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
gtk_tooltips_draw_tips (tooltips);
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 449beed6e..5f6f4cab0 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -1958,7 +1958,7 @@ gtk_widget_idle_draw (gpointer data)
GSList *draw_data_list;
GtkWidget *widget;
- GTK_THREADS_ENTER ();
+ GDK_THREADS_ENTER ();
/* Translate all draw requests to be allocation-relative */
widget_list = gtk_widget_redraw_queue;
@@ -2141,7 +2141,7 @@ gtk_widget_idle_draw (gpointer data)
g_slist_free (gtk_widget_redraw_queue);
gtk_widget_redraw_queue = NULL;
- GTK_THREADS_LEAVE ();
+ GDK_THREADS_LEAVE ();
return FALSE;
}
diff --git a/gtk/testthreads.c b/gtk/testthreads.c
index 999c5e0d4..e330a74a5 100644
--- a/gtk/testthreads.c
+++ b/gtk/testthreads.c
@@ -53,7 +53,7 @@ counter (void *data)
GtkWidget *label;
GtkWidget *button;
- gtk_threads_enter();
+ gdk_threads_enter();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), name);
@@ -83,7 +83,7 @@ counter (void *data)
{
sprintf(buffer, "%d", counter);
gtk_label_set_text (GTK_LABEL (label), buffer);
- gtk_threads_leave();
+ gdk_threads_leave();
counter++;
/* Give someone else a chance to get the lock next time.
* Only necessary because we don't do anything else while
@@ -91,7 +91,7 @@ counter (void *data)
*/
sleep(0);
- gtk_threads_enter();
+ gdk_threads_enter();
}
gtk_widget_destroy (window);
@@ -102,7 +102,7 @@ counter (void *data)
gtk_main_quit();
pthread_mutex_unlock (&nthreads_mutex);
- gtk_threads_leave();
+ gdk_threads_leave();
return NULL;
}
@@ -115,7 +115,7 @@ main (int argc, char **argv)
#ifdef USE_PTHREADS
int i;
- if (!gtk_threads_init())
+ if (!gdk_threads_init())
{
fprintf(stderr, "Could not initialize threads\n");
exit(1);
@@ -141,9 +141,9 @@ main (int argc, char **argv)
pthread_mutex_unlock (&nthreads_mutex);
- gtk_threads_enter();
+ gdk_threads_enter();
gtk_main();
- gtk_threads_leave();
+ gdk_threads_leave();
fprintf(stderr, "Done\n");
#else /* !USE_PTHREADS */
fprintf (stderr, "GTK+ not compiled with threads support\n");
diff --git a/tests/testthreads.c b/tests/testthreads.c
index 999c5e0d4..e330a74a5 100644
--- a/tests/testthreads.c
+++ b/tests/testthreads.c
@@ -53,7 +53,7 @@ counter (void *data)
GtkWidget *label;
GtkWidget *button;
- gtk_threads_enter();
+ gdk_threads_enter();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), name);
@@ -83,7 +83,7 @@ counter (void *data)
{
sprintf(buffer, "%d", counter);
gtk_label_set_text (GTK_LABEL (label), buffer);
- gtk_threads_leave();
+ gdk_threads_leave();
counter++;
/* Give someone else a chance to get the lock next time.
* Only necessary because we don't do anything else while
@@ -91,7 +91,7 @@ counter (void *data)
*/
sleep(0);
- gtk_threads_enter();
+ gdk_threads_enter();
}
gtk_widget_destroy (window);
@@ -102,7 +102,7 @@ counter (void *data)
gtk_main_quit();
pthread_mutex_unlock (&nthreads_mutex);
- gtk_threads_leave();
+ gdk_threads_leave();
return NULL;
}
@@ -115,7 +115,7 @@ main (int argc, char **argv)
#ifdef USE_PTHREADS
int i;
- if (!gtk_threads_init())
+ if (!gdk_threads_init())
{
fprintf(stderr, "Could not initialize threads\n");
exit(1);
@@ -141,9 +141,9 @@ main (int argc, char **argv)
pthread_mutex_unlock (&nthreads_mutex);
- gtk_threads_enter();
+ gdk_threads_enter();
gtk_main();
- gtk_threads_leave();
+ gdk_threads_leave();
fprintf(stderr, "Done\n");
#else /* !USE_PTHREADS */
fprintf (stderr, "GTK+ not compiled with threads support\n");