Commit fcfe7370 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor
Browse files

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:
parent 0dcdac58
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
......
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
......
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
......
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
......
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
......
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
......
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
......
......@@ -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 ();
}
......@@ -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>
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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 ();
}
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment