Commented out testthreads from the build process, since we won't have any

Tue Dec 15 01:38:53 1998  Owen Taylor  <otaylor@redhat.com>

	* gtk/Makefile.am: Commented out testthreads from
	the build process, since we won't have any idea
	how to create a thread.

	* configure.in (LIBS): use glib-config ... gthread
	so we always build a thread-compatible library.

        * gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
	  gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
	  gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
	  gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
	  gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:

	Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
	and idles to account for the fact that they are no
	longer called within the GTK+ lock.

	* gtk/gtkprivate.h: Added definitions for locking
	the main GTK+ mutex.

	* gtk/gtkmain.c: Re-implement the main loop
	in terms of the GLib main loop.

	* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
	functionality, as it seems better to subsume GDK within the
	GTK+ lock than vice-versa.

        * gdk/gdkevents.c: New file, containing event handling bits
	from gdk.c.

	* gdk/gdkevents.c: Implement event source for GDK
	events.

	* configure.in gdk/gdkevents.c: Removed attempts to
	subtract base_id, which were already non-functional.
This commit is contained in:
Owen Taylor 1998-12-15 07:32:11 +00:00 committed by Owen Taylor
parent 58475f05a5
commit a0c84d6818
46 changed files with 1044 additions and 5340 deletions

View File

@ -1,3 +1,41 @@
Tue Dec 15 01:38:53 1998 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Commented out testthreads from
the build process, since we won't have any idea
how to create a thread.
* configure.in (LIBS): use glib-config ... gthread
so we always build a thread-compatible library.
* gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:
Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
and idles to account for the fact that they are no
longer called within the GTK+ lock.
* gtk/gtkprivate.h: Added definitions for locking
the main GTK+ mutex.
* gtk/gtkmain.c: Re-implement the main loop
in terms of the GLib main loop.
* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
functionality, as it seems better to subsume GDK within the
GTK+ lock than vice-versa.
* gdk/gdkevents.c: New file, containing event handling bits
from gdk.c.
* gdk/gdkevents.c: Implement event source for GDK
events.
* configure.in gdk/gdkevents.c: Removed attempts to
subtract base_id, which were already non-functional.
Mon Dec 14 23:05:20 PST 1998 Manish Singh <yosh@gimp.org>
* acconfig.h
@ -871,6 +909,8 @@ Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
* testgtk.c: Modified layout test to test scrolling over
long distances.
* gtk/gtkplug.c: Added a few blank lines.
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.

View File

@ -1,3 +1,41 @@
Tue Dec 15 01:38:53 1998 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Commented out testthreads from
the build process, since we won't have any idea
how to create a thread.
* configure.in (LIBS): use glib-config ... gthread
so we always build a thread-compatible library.
* gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:
Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
and idles to account for the fact that they are no
longer called within the GTK+ lock.
* gtk/gtkprivate.h: Added definitions for locking
the main GTK+ mutex.
* gtk/gtkmain.c: Re-implement the main loop
in terms of the GLib main loop.
* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
functionality, as it seems better to subsume GDK within the
GTK+ lock than vice-versa.
* gdk/gdkevents.c: New file, containing event handling bits
from gdk.c.
* gdk/gdkevents.c: Implement event source for GDK
events.
* configure.in gdk/gdkevents.c: Removed attempts to
subtract base_id, which were already non-functional.
Mon Dec 14 23:05:20 PST 1998 Manish Singh <yosh@gimp.org>
* acconfig.h
@ -871,6 +909,8 @@ Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
* testgtk.c: Modified layout test to test scrolling over
long distances.
* gtk/gtkplug.c: Added a few blank lines.
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.

View File

@ -1,3 +1,41 @@
Tue Dec 15 01:38:53 1998 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Commented out testthreads from
the build process, since we won't have any idea
how to create a thread.
* configure.in (LIBS): use glib-config ... gthread
so we always build a thread-compatible library.
* gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:
Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
and idles to account for the fact that they are no
longer called within the GTK+ lock.
* gtk/gtkprivate.h: Added definitions for locking
the main GTK+ mutex.
* gtk/gtkmain.c: Re-implement the main loop
in terms of the GLib main loop.
* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
functionality, as it seems better to subsume GDK within the
GTK+ lock than vice-versa.
* gdk/gdkevents.c: New file, containing event handling bits
from gdk.c.
* gdk/gdkevents.c: Implement event source for GDK
events.
* configure.in gdk/gdkevents.c: Removed attempts to
subtract base_id, which were already non-functional.
Mon Dec 14 23:05:20 PST 1998 Manish Singh <yosh@gimp.org>
* acconfig.h
@ -871,6 +909,8 @@ Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
* testgtk.c: Modified layout test to test scrolling over
long distances.
* gtk/gtkplug.c: Added a few blank lines.
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.

View File

@ -1,3 +1,41 @@
Tue Dec 15 01:38:53 1998 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Commented out testthreads from
the build process, since we won't have any idea
how to create a thread.
* configure.in (LIBS): use glib-config ... gthread
so we always build a thread-compatible library.
* gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:
Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
and idles to account for the fact that they are no
longer called within the GTK+ lock.
* gtk/gtkprivate.h: Added definitions for locking
the main GTK+ mutex.
* gtk/gtkmain.c: Re-implement the main loop
in terms of the GLib main loop.
* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
functionality, as it seems better to subsume GDK within the
GTK+ lock than vice-versa.
* gdk/gdkevents.c: New file, containing event handling bits
from gdk.c.
* gdk/gdkevents.c: Implement event source for GDK
events.
* configure.in gdk/gdkevents.c: Removed attempts to
subtract base_id, which were already non-functional.
Mon Dec 14 23:05:20 PST 1998 Manish Singh <yosh@gimp.org>
* acconfig.h
@ -871,6 +909,8 @@ Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
* testgtk.c: Modified layout test to test scrolling over
long distances.
* gtk/gtkplug.c: Added a few blank lines.
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.

View File

@ -1,3 +1,41 @@
Tue Dec 15 01:38:53 1998 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Commented out testthreads from
the build process, since we won't have any idea
how to create a thread.
* configure.in (LIBS): use glib-config ... gthread
so we always build a thread-compatible library.
* gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:
Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
and idles to account for the fact that they are no
longer called within the GTK+ lock.
* gtk/gtkprivate.h: Added definitions for locking
the main GTK+ mutex.
* gtk/gtkmain.c: Re-implement the main loop
in terms of the GLib main loop.
* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
functionality, as it seems better to subsume GDK within the
GTK+ lock than vice-versa.
* gdk/gdkevents.c: New file, containing event handling bits
from gdk.c.
* gdk/gdkevents.c: Implement event source for GDK
events.
* configure.in gdk/gdkevents.c: Removed attempts to
subtract base_id, which were already non-functional.
Mon Dec 14 23:05:20 PST 1998 Manish Singh <yosh@gimp.org>
* acconfig.h
@ -871,6 +909,8 @@ Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
* testgtk.c: Modified layout test to test scrolling over
long distances.
* gtk/gtkplug.c: Added a few blank lines.
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.

View File

@ -1,3 +1,41 @@
Tue Dec 15 01:38:53 1998 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Commented out testthreads from
the build process, since we won't have any idea
how to create a thread.
* configure.in (LIBS): use glib-config ... gthread
so we always build a thread-compatible library.
* gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:
Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
and idles to account for the fact that they are no
longer called within the GTK+ lock.
* gtk/gtkprivate.h: Added definitions for locking
the main GTK+ mutex.
* gtk/gtkmain.c: Re-implement the main loop
in terms of the GLib main loop.
* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
functionality, as it seems better to subsume GDK within the
GTK+ lock than vice-versa.
* gdk/gdkevents.c: New file, containing event handling bits
from gdk.c.
* gdk/gdkevents.c: Implement event source for GDK
events.
* configure.in gdk/gdkevents.c: Removed attempts to
subtract base_id, which were already non-functional.
Mon Dec 14 23:05:20 PST 1998 Manish Singh <yosh@gimp.org>
* acconfig.h
@ -871,6 +909,8 @@ Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
* testgtk.c: Modified layout test to test scrolling over
long distances.
* gtk/gtkplug.c: Added a few blank lines.
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.

View File

@ -1,3 +1,41 @@
Tue Dec 15 01:38:53 1998 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Commented out testthreads from
the build process, since we won't have any idea
how to create a thread.
* configure.in (LIBS): use glib-config ... gthread
so we always build a thread-compatible library.
* gtk/gtkaccellabel.c gtk/gtkclist.c gtk/gtkcolorsel.c
gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkentry.c
gtk/gtklist.c gtk/gtkmenuitem.c gtk/gtknotebook.c
gtk/gtkrange.c gtk/gtkselection.c gtk/gtkspinbutton.c
gtk/gtktext.c gtk/gtktooltips.c gtk/gtkwidget.c:
Add GTK_THREADS_ENTER/LEAVE pairs around timeouts
and idles to account for the fact that they are no
longer called within the GTK+ lock.
* gtk/gtkprivate.h: Added definitions for locking
the main GTK+ mutex.
* gtk/gtkmain.c: Re-implement the main loop
in terms of the GLib main loop.
* gdk/gdk.h gdk/gdkthreads.c gdk/Makefile.am: Removed threading
functionality, as it seems better to subsume GDK within the
GTK+ lock than vice-versa.
* gdk/gdkevents.c: New file, containing event handling bits
from gdk.c.
* gdk/gdkevents.c: Implement event source for GDK
events.
* configure.in gdk/gdkevents.c: Removed attempts to
subtract base_id, which were already non-functional.
Mon Dec 14 23:05:20 PST 1998 Manish Singh <yosh@gimp.org>
* acconfig.h
@ -871,6 +909,8 @@ Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
* testgtk.c: Modified layout test to test scrolling over
long distances.
* gtk/gtkplug.c: Added a few blank lines.
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.

View File

@ -66,11 +66,6 @@
#undef NO_FD_SET
#undef RESOURCE_BASE
/* Define to enable POSIX threading awareness */
#undef USE_PTHREADS
#undef XINPUT_NONE
#undef XINPUT_GXI
#undef XINPUT_XFREE

View File

@ -184,7 +184,7 @@ if test x$with_glib = x ; then
AC_MSG_ERROR([
*** GLIB 1.1.6 or better is required. The latest version of GLIB
*** is always available from ftp://ftp.gtk.org.]),
gmodule)
gmodule gthread)
glib_cflags=$GLIB_CFLAGS
glib_libs=$GLIB_LIBS
@ -305,20 +305,6 @@ else
AC_DEFINE(XINPUT_NONE)
fi
# Threads
if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
AC_CHECK_LIB(pthread, pthread_attr_init,
[AC_DEFINE(USE_PTHREADS)
x_libs="$x_libs -lpthread"
GTK_THREAD_FLAGS="-D_REENTRANT"],
# AIX has libpthreads, cause they're special. Special friends (TM)
AC_CHECK_LIB(pthreads, pthread_attr_init,
[AC_DEFINE(USE_PTHREADS)
x_libs="$x_libs -lpthreads"
GTK_THREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE"]))
fi
CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"
@ -349,27 +335,6 @@ if test "x$enable_shm" = "xyes"; then
fi
fi
# Check for private display resource base variable
AC_MSG_CHECKING(resource base field in XDisplay)
AC_CACHE_VAL(gtk_cv_display_resource_base,
[AC_TRY_RUN([
#define XLIB_ILLEGAL_ACCESS
#include <X11/Xlib.h>
int
main ()
{
Display *display;
return 0;
display->resource_base;
}],
gtk_cv_display_resource_base="resource_base",
gtk_cv_display_resource_base="private3")])
AC_MSG_RESULT($gtk_cv_display_resource_base)
AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
# Check if X_LOCALE definition is necessary
AC_MSG_CHECKING(need -DX_LOCALE)

View File

@ -84,23 +84,76 @@ Incompatible Changes from GTK+-1.0 to GTK+-1.2:
Window. The scrollbar policy is set on the scrolled window with
gtk_scrolled_window_set_policy() and not on the child widgets
(e.g. GtkCList's gtk_clist_set_policy() was removed).
* The "main loop" of GTK+ has been moved to GLib. This should not
affect existing programs, since compatibility functions have
been provided. However, you may want to consider migrating
your code to use the GLib main loop directly.
* the GTK_BASIC flag got removed, and with it the corresponding
Minor known incompatibilities:
- gtk_idle_remove_by_data() and gtk_timeout_remove_by_data() now
work from a common pool of "input sources", so
gtk_idle_remove_by_data() will remove timeouts and
vice-versa.
* the GTK_BASIC flag was removed, and with it the corresponding
macro and function GTK_WIDGET_BASIC() and gtk_widget_basic().
* all freeze/thaw methods in gtk work in an incremental way now.
code portions like:
* All freeze/thaw methods are now recursive - that is, if you
freeze a widget n times, you must also thaw it n times.
Therefore, if you have code like:
gboolean frozen;
frozen = GTK_CLIST_FROZEN (clist);
gtk_clist_freeze (clist);
[...]
if (!frozen)
gtk_clist_thaw (clist);
will not work anymore, they have to be modified to simply:
it will not work anymore. It must be, simply:
gtk_clist_freeze (clist);
[...]
gtk_clist_thaw (clist);
* The thread safety in GTK+ 1.2 is slightly different than
that which appeared in early versions in the 1.1
development track. The main difference is that it relies on
the thread primitives in GLib, and on the thread-safe
GLib main loop.
This means:
- You must call g_thread_init(), then gtk_thread_init()
in a threaded GTK+ program.
- Idles, timeouts, and input functions are executed outside
of the main GTK+ lock. So, if you need to call GTK+
inside of such a callback, you must surround the callback
with a gtk_thread_enter()/gtk_thread_leave() pair.
[ However, signals are still executed within the main
GTK+ lock ]
In particular, this means, if you are writing widgets
that might be used in threaded programs, you _must_
surround timeouts and idle functions in this matter.
- There is no longer a special --with-threads configure
option for GTK+. To use threads in a GTK+ program, you
must:
a) If you want to use the native thread implementation,
make sure GLib found this in configuration, otherwise,
call you must provide a thread implementation to
g_thread_init().
b) Link with the libraries returned by:
gtk-config --libs gthread
* All functions matching g_message* are deprecated
* Functions *_interp are deprecated, *_full variants are available

View File

@ -21,6 +21,7 @@ libgdk_la_SOURCES = \
gdkcursor.c \
gdkdnd.c \
gdkdraw.c \
gdkevents.c \
gdkfont.c \
gdkgc.c \
gdkglobals.c \
@ -38,7 +39,6 @@ libgdk_la_SOURCES = \
gdkrectangle.c \
gdkregion.c \
gdkselection.c \
gdkthreads.c \
gdkvisual.c \
gdkwindow.c \
gdkxid.c \

2183
gdk/gdk.c

File diff suppressed because it is too large Load Diff

View File

@ -37,12 +37,16 @@ gchar* gdk_set_locale (void);
gint gdk_events_pending (void);
GdkEvent *gdk_event_get (void);
GdkEvent *gdk_event_get_graphics_expose (GdkWindow *window);
void gdk_event_put (GdkEvent *event);
void gdk_event_put (GdkEvent *event);
GdkEvent *gdk_event_copy (GdkEvent *event);
void gdk_event_free (GdkEvent *event);
guint32 gdk_event_get_time (GdkEvent *event);
void gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify);
void gdk_set_show_events (gint show_events);
void gdk_set_use_xshm (gint use_xshm);
@ -933,18 +937,6 @@ GdkRegion* gdk_regions_subtract (GdkRegion *source1,
GdkRegion* gdk_regions_xor (GdkRegion *source1,
GdkRegion *source2);
/* Threads
*/
gboolean gdk_threads_init (void);
void gdk_threads_enter (void);
void gdk_threads_leave (void);
/* If the mainloop thread is in its select, wake it up.
* For GTK's idle handling
*/
void gdk_threads_wake (void);
/* Miscellaneous */
void gdk_event_send_clientmessage_toall (GdkEvent *event);
gboolean gdk_event_send_client_message (GdkEvent *event,

View File

@ -54,6 +54,14 @@ gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GList *gdk_default_filters = NULL;
gboolean gdk_xim_using; /* using XIM Protocol if TRUE */
GdkICPrivate *gdk_xim_ic; /* currently using IC */
GdkWindow *gdk_xim_window; /* currently using Widow */
GdkWindowPrivate *gdk_xgrab_window = NULL; /* Window that currently holds the
* x pointer grab
*/
gboolean gdk_using_threads = FALSE;
/* Used to signal the mainloop thread from its select() */

View File

@ -1235,8 +1235,6 @@ gdk_ic_get_events (GdkIC *ic)
gint i;
/* From gdkwindow.c */
extern int nevent_masks;
extern int event_mask_table[];
g_return_val_if_fail (ic != NULL, 0);
@ -1252,11 +1250,11 @@ gdk_ic_get_events (GdkIC *ic)
}
mask = 0;
for (i=0, bit=2; i < nevent_masks; i++, bit <<= 1)
if (xmask & event_mask_table [i])
for (i=0, bit=2; i < gdk_nevent_masks; i++, bit <<= 1)
if (xmask & gdk_event_mask_table [i])
{
mask |= bit;
xmask &= ~ event_mask_table [i];
xmask &= ~ gdk_event_mask_table [i];
}
if (xmask)

View File

@ -218,6 +218,7 @@ typedef enum {
GDK_DEBUG_XIM = 1 << 4
} GdkDebugFlag;
void gdk_events_init (void);
void gdk_window_init (void);
void gdk_visual_init (void);
void gdk_dnd_init (void);
@ -276,6 +277,12 @@ extern gint gdk_error_warnings;
extern gint gdk_null_window_warnings;
extern GList *gdk_default_filters;
extern gboolean gdk_using_threads;
extern const int gdk_nevent_masks;
extern const int gdk_event_mask_table[];
extern GdkWindowPrivate *gdk_xgrab_window; /* Window that currently holds the
* x pointer grab
*/
/* Threading stuff */
#ifdef USE_PTHREADS

View File

@ -1,68 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
*/
#include "config.h"
#include "gdk.h"
#include "gdkprivate.h"
#ifdef USE_PTHREADS
#include <unistd.h>
#include <pthread.h>
pthread_mutex_t gdk_threads_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif /* USE_PTHREADS */
gboolean
gdk_threads_init (void)
{
#ifdef USE_PTHREADS
pipe (gdk_threads_pipe);
gdk_using_threads = TRUE;
return TRUE;
#else
return FALSE;
#endif
}
void
gdk_threads_enter (void)
{
#ifdef USE_PTHREADS
pthread_mutex_lock (&gdk_threads_mutex);
#endif
}
void
gdk_threads_leave (void)
{
#ifdef USE_PTHREADS
pthread_mutex_unlock (&gdk_threads_mutex);
#endif
}
void
gdk_threads_wake (void)
{
#ifdef USE_PTHREADS
if (gdk_select_waiting)
{
gdk_select_waiting = FALSE;
write (gdk_threads_pipe[1], "A", 1);
}
#endif
}

View File

@ -86,7 +86,7 @@ typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceInfo GdkDeviceInfo;
typedef struct _GdkTimeCoord GdkTimeCoord;
typedef struct _GdkRegion GdkRegion;
typedef gint (*GdkEventFunc) (GdkEvent *event,
typedef void (*GdkEventFunc) (GdkEvent *event,
gpointer data);
typedef struct _GdkIC GdkIC;

View File

@ -33,7 +33,7 @@
#include <X11/extensions/shape.h>
#endif
const int event_mask_table[20] =
const int gdk_event_mask_table[20] =
{
ExposureMask,
PointerMotionMask,
@ -56,7 +56,7 @@ const int event_mask_table[20] =
0, /* PROXIMTY_OUT */
SubstructureNotifyMask
};
const int nevent_masks = sizeof(event_mask_table)/sizeof(int);
const int gdk_nevent_masks = sizeof(gdk_event_mask_table)/sizeof(int);
static gboolean gdk_window_have_shape_ext (void);
@ -299,10 +299,10 @@ gdk_window_new (GdkWindow *parent,
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
xattributes.event_mask = StructureNotifyMask;
for (i = 0; i < nevent_masks; i++)
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attributes->event_mask & (1 << (i + 1)))
xattributes.event_mask |= event_mask_table[i];
xattributes.event_mask |= gdk_event_mask_table[i];
}
if (xattributes.event_mask)
@ -1703,9 +1703,9 @@ gdk_window_get_events (GdkWindow *window)
&attrs);
event_mask = 0;
for (i = 0; i < nevent_masks; i++)
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attrs.your_event_mask & event_mask_table[i])
if (attrs.your_event_mask & gdk_event_mask_table[i])
event_mask |= 1 << (i + 1);
}
@ -1727,10 +1727,10 @@ gdk_window_set_events (GdkWindow *window,
return;
xevent_mask = StructureNotifyMask;
for (i = 0; i < nevent_masks; i++)
for (i = 0; i < gdk_nevent_masks; i++)
{
if (event_mask & (1 << (i + 1)))
xevent_mask |= event_mask_table[i];
xevent_mask |= gdk_event_mask_table[i];
}
XSelectInput (gdk_display, private->xwindow,

View File

@ -54,6 +54,14 @@ gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GList *gdk_default_filters = NULL;
gboolean gdk_xim_using; /* using XIM Protocol if TRUE */
GdkICPrivate *gdk_xim_ic; /* currently using IC */
GdkWindow *gdk_xim_window; /* currently using Widow */
GdkWindowPrivate *gdk_xgrab_window = NULL; /* Window that currently holds the
* x pointer grab
*/
gboolean gdk_using_threads = FALSE;
/* Used to signal the mainloop thread from its select() */

View File

@ -1235,8 +1235,6 @@ gdk_ic_get_events (GdkIC *ic)
gint i;
/* From gdkwindow.c */
extern int nevent_masks;
extern int event_mask_table[];
g_return_val_if_fail (ic != NULL, 0);
@ -1252,11 +1250,11 @@ gdk_ic_get_events (GdkIC *ic)
}
mask = 0;
for (i=0, bit=2; i < nevent_masks; i++, bit <<= 1)
if (xmask & event_mask_table [i])
for (i=0, bit=2; i < gdk_nevent_masks; i++, bit <<= 1)
if (xmask & gdk_event_mask_table [i])
{
mask |= bit;
xmask &= ~ event_mask_table [i];
xmask &= ~ gdk_event_mask_table [i];
}
if (xmask)

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@
#include <X11/extensions/shape.h>
#endif
const int event_mask_table[20] =
const int gdk_event_mask_table[20] =
{
ExposureMask,
PointerMotionMask,
@ -56,7 +56,7 @@ const int event_mask_table[20] =
0, /* PROXIMTY_OUT */
SubstructureNotifyMask
};
const int nevent_masks = sizeof(event_mask_table)/sizeof(int);
const int gdk_nevent_masks = sizeof(gdk_event_mask_table)/sizeof(int);
static gboolean gdk_window_have_shape_ext (void);
@ -299,10 +299,10 @@ gdk_window_new (GdkWindow *parent,
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
xattributes.event_mask = StructureNotifyMask;
for (i = 0; i < nevent_masks; i++)
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attributes->event_mask & (1 << (i + 1)))
xattributes.event_mask |= event_mask_table[i];
xattributes.event_mask |= gdk_event_mask_table[i];
}
if (xattributes.event_mask)
@ -1703,9 +1703,9 @@ gdk_window_get_events (GdkWindow *window)
&attrs);
event_mask = 0;
for (i = 0; i < nevent_masks; i++)
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attrs.your_event_mask & event_mask_table[i])
if (attrs.your_event_mask & gdk_event_mask_table[i])
event_mask |= 1 << (i + 1);
}
@ -1727,10 +1727,10 @@ gdk_window_set_events (GdkWindow *window,
return;
xevent_mask = StructureNotifyMask;
for (i = 0; i < nevent_masks; i++)
for (i = 0; i < gdk_nevent_masks; i++)
{
if (event_mask & (1 << (i + 1)))
xevent_mask |= event_mask_table[i];
xevent_mask |= gdk_event_mask_table[i];
}
XSelectInput (gdk_display, private->xwindow,

View File

@ -353,7 +353,8 @@ INCLUDES = \
@GLIB_CFLAGS@ \
@x_cflags@
noinst_PROGRAMS = testgtk testinput testselection testthreads testrgb testdnd simple
noinst_PROGRAMS = testgtk testinput testselection testrgb testdnd simple
# testthreads
DEPS = \
libgtk.la \
@ -369,7 +370,7 @@ LDADDS = \
testgtk_DEPENDENCIES = $(DEPS)
testinput_DEPENDENCIES = $(DEPS)
testthreads_DEPENDENCIES = $(DEPS)
#testthreads_DEPENDENCIES = $(DEPS)
testselection_DEPENDENCIES = $(DEPS)
testrgb_DEPENDENCIES = $(DEPS)
testdnd_DEPENDENCIES = $(DEPS)
@ -377,7 +378,7 @@ simple_DEPENDENCIES = $(DEPS)
testgtk_LDADD = $(LDADDS)
testinput_LDADD = $(LDADDS)
testthreads_LDADD = $(LDADDS)
#testthreads_LDADD = $(LDADDS)
testselection_LDADD = $(LDADDS)
testrgb_LDADD = $(LDADDS)
testdnd_LDADD = $(LDADDS)

View File

@ -24,6 +24,7 @@
#include "gtkmain.h"
#include "gtksignal.h"
#include "gtkaccellabel.h"
#include "gtkprivate.h"
enum {
@ -45,6 +46,7 @@ static void gtk_accel_label_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static gint gtk_accel_label_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static gboolean gtk_accel_label_refetch_idle (GtkAccelLabel *accel_label);
static GtkAccelLabelClass *accel_label_class = NULL;
static GtkLabelClass *parent_class = NULL;
@ -304,7 +306,7 @@ gtk_accel_label_queue_refetch (GtkAccelLabel *accel_label)
if (accel_label->queue_id == 0)
accel_label->queue_id = gtk_idle_add_priority (GTK_PRIORITY_HIGH - 2,
(GtkFunction) gtk_accel_label_refetch,
(GtkFunction) gtk_accel_label_refetch_idle,
accel_label);
}
@ -347,6 +349,18 @@ gtk_accel_label_set_accel_widget (GtkAccelLabel *accel_label,
}
}
static gboolean
gtk_accel_label_refetch_idle (GtkAccelLabel *accel_label)
{
gboolean retval;
GTK_THREADS_ENTER;
retval = gtk_accel_label_refetch (accel_label);
GTK_THREADS_LEAVE;
return retval;
}
gboolean
gtk_accel_label_refetch (GtkAccelLabel *accel_label)
{

View File

@ -23,6 +23,7 @@
#include "gtkmain.h"
#include "gtkclist.h"
#include "gtkbindings.h"
#include "gtkprivate.h"
#include <gdk/gdkkeysyms.h>
/* the number rows memchunk expands at a time */
@ -5041,7 +5042,7 @@ horizontal_timeout (GtkCList *clist)
GdkEventMotion event;
GdkModifierType mask;
g_return_val_if_fail (GTK_IS_CLIST (clist), FALSE);
GTK_THREADS_ENTER;
clist->htimer = 0;
gdk_window_get_pointer (clist->clist_window, &x, &y, &mask);
@ -5053,6 +5054,8 @@ horizontal_timeout (GtkCList *clist)
gtk_clist_motion (GTK_WIDGET (clist), &event);
GTK_THREADS_LEAVE;
return FALSE;
}
@ -5063,7 +5066,7 @@ vertical_timeout (GtkCList *clist)
GdkEventMotion event;
GdkModifierType mask;
g_return_val_if_fail (GTK_IS_CLIST (clist), FALSE);
GTK_THREADS_ENTER;
clist->vtimer = 0;
gdk_window_get_pointer (clist->clist_window, &x, &y, &mask);
@ -5075,6 +5078,8 @@ vertical_timeout (GtkCList *clist)
gtk_clist_motion (GTK_WIDGET (clist), &event);
GTK_THREADS_LEAVE;
return FALSE;
}

View File

@ -24,6 +24,7 @@
#include "gtkdrawwindow.h"
#include "gtkhbbox.h"
#include "gtkdnd.h"
#include "gtkprivate.h"
#include "gtkselection.h"
/*
@ -1025,11 +1026,15 @@ static gint
gtk_color_selection_value_timeout (GtkColorSelection *colorsel)
{
gint x, y;
GTK_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;
return (TRUE);
}

View File

@ -28,6 +28,7 @@
#include "gtklistitem.h"
#include "gtkscrolledwindow.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtkwindow.h"
#include "gdk/gdkkeysyms.h"
@ -235,7 +236,11 @@ static gint
gtk_combo_focus_idle (GtkCombo * combo)
{
if (combo)
gtk_widget_grab_focus (combo->entry);
{
GTK_THREADS_ENTER;
gtk_widget_grab_focus (combo->entry);
GTK_THREADS_LEAVE;
}
return FALSE;
}

View File

@ -811,11 +811,13 @@ gtk_container_get_resize_container (GtkContainer *container)
static gboolean
gtk_container_idle_sizer (gpointer data)
{
GTK_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
* the queue still got processed. we better just ignore such case
* than trying to explicitely work around them with some extra flags,
* sine it doesn't cause any actual harm.
* since it doesn't cause any actual harm.
*/
while (container_resize_queue)
{
@ -830,6 +832,8 @@ gtk_container_idle_sizer (gpointer data)
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
gtk_container_check_resize (GTK_CONTAINER (widget));
}
GTK_THREADS_LEAVE;
return FALSE;
}

View File

@ -22,6 +22,7 @@
#include "gtkdnd.h"
#include "gtkinvisible.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtkdrawwindow.h"
@ -2268,13 +2269,16 @@ gtk_drag_anim_timeout (gpointer data)
{
GtkDragAnim *anim = data;
gint x, y;
gboolean retval;
GTK_THREADS_ENTER;
if (anim->step == anim->n_steps)
{
gtk_drag_source_info_destroy (anim->info);
g_free (anim);
return FALSE;
retval = FALSE;
}
else
{
@ -2287,8 +2291,12 @@ gtk_drag_anim_timeout (gpointer data)
anim->step++;
return TRUE;
retval = TRUE;
}
GTK_THREADS_LEAVE;
return retval;
}
static void

View File

@ -22,6 +22,7 @@
#include "gdk/gdki18n.h"
#include "gtkentry.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtkselection.h"
#include "gtksignal.h"
#include "gtkstyle.h"
@ -1480,12 +1481,14 @@ gtk_entry_timer (gpointer data)
{
GtkEntry *entry;
g_return_val_if_fail (data != NULL, FALSE);
GTK_THREADS_ENTER;
entry = GTK_ENTRY (data);
entry->timer = 0;
gtk_entry_draw_text (entry);
GTK_THREADS_LEAVE;
return FALSE;
}

View File

@ -19,6 +19,7 @@
#include "gtklist.h"
#include "gtklistitem.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtklabel.h"
@ -2308,7 +2309,7 @@ gtk_list_horizontal_timeout (GtkWidget *list)
GdkEventMotion event;
GdkModifierType mask;
g_return_val_if_fail (GTK_IS_LIST (list), FALSE);
GTK_THREADS_ENTER;
GTK_LIST (list)->htimer = 0;
gdk_window_get_pointer (list->window, &x, &y, &mask);
@ -2320,6 +2321,8 @@ gtk_list_horizontal_timeout (GtkWidget *list)
gtk_list_motion_notify (list, &event);
GTK_THREADS_LEAVE;
return FALSE;
}
@ -2331,7 +2334,7 @@ gtk_list_vertical_timeout (GtkWidget *list)
GdkEventMotion event;
GdkModifierType mask;
g_return_val_if_fail (GTK_IS_LIST (list), FALSE);
GTK_THREADS_ENTER;
GTK_LIST (list)->vtimer = 0;
gdk_window_get_pointer (list->window, &x, &y, &mask);
@ -2343,6 +2346,8 @@ gtk_list_vertical_timeout (GtkWidget *list)
gtk_list_motion_notify (list, &event);
GTK_THREADS_LEAVE;
return FALSE;
}

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ extern "C" {
#define GTK_PRIORITY_HIGH -20
#define GTK_PRIORITY_INTERNAL -10
#define GTK_PRIORITY_DEFAULT 0
#define GTK_PRIORITY_DEFAULT -5
#define GTK_PRIORITY_LOW 10
typedef void (*GtkModuleInitFunc) (gint *argc,
@ -58,6 +58,13 @@ void gtk_init (int *argc,
void gtk_exit (gint error_code);
gchar* gtk_set_locale (void);
gint gtk_events_pending (void);
/* The following is the event func GTK+ registers with GDK
* we expose it mainly to allow filtering of events between
* GDK and GTK+.
*/
void gtk_main_do_event (GdkEvent *event);
void gtk_main (void);
guint gtk_main_level (void);
void gtk_main_quit (void);
@ -122,8 +129,10 @@ guint gtk_key_snooper_install (GtkKeySnoopFunc snooper,
void gtk_key_snooper_remove (guint snooper_handler_id);
GdkEvent* gtk_get_current_event (void);
GtkWidget* gtk_get_event_widget (GdkEvent *event);
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,

View File

@ -19,6 +19,7 @@
#include <string.h>
#include "gtkaccellabel.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtkmenu.h"
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
@ -620,6 +621,8 @@ gtk_menu_item_select_timeout (gpointer data)
{
GtkMenuItem *menu_item;
GTK_THREADS_ENTER;
menu_item = GTK_MENU_ITEM (data);
menu_item->timer = 0;
@ -641,6 +644,8 @@ gtk_menu_item_select_timeout (gpointer data)
gtk_menu_shell_select_item (submenu, submenu->children->data);
}
GTK_THREADS_LEAVE;
return FALSE;
}

View File

@ -19,6 +19,7 @@
#include "gtknotebook.h"
#include "gtksignal.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtklabel.h"
@ -1834,9 +1835,10 @@ gtk_notebook_focus_changed (GtkNotebook *notebook,
static gint
gtk_notebook_timer (GtkNotebook *notebook)
{
g_return_val_if_fail (notebook != NULL, FALSE);
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
gboolean retval = FALSE;
GTK_THREADS_ENTER;
if (notebook->timer)
{
if (notebook->click_child == GTK_ARROW_LEFT)
@ -1859,11 +1861,14 @@ gtk_notebook_timer (GtkNotebook *notebook)
notebook->timer = gtk_timeout_add (NOTEBOOK_SCROLL_DELAY,
(GtkFunction) gtk_notebook_timer,
(gpointer) notebook);
return FALSE;
}
return TRUE;
else
retval = TRUE;
}
return FALSE;
GTK_THREADS_LEAVE;
return retval;
}
static gint

View File

@ -60,6 +60,19 @@ 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;
#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
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -19,6 +19,7 @@
#include <stdio.h>
#include "gtkmain.h"
#include "gtkrange.h"
#include "gtkprivate.h"
#include "gtksignal.h"
@ -1236,8 +1237,7 @@ gtk_real_range_timer (GtkRange *range)
{
gint return_val;
g_return_val_if_fail (range != NULL, FALSE);
g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
GTK_THREADS_ENTER;
return_val = TRUE;
if (range->click_child == RANGE_CLASS (range)->slider)
@ -1258,7 +1258,10 @@ gtk_real_range_timer (GtkRange *range)
(GtkFunction) RANGE_CLASS (range)->timer,
(gpointer) range);
else
return FALSE;
{
GTK_THREADS_LEAVE;
return FALSE;
}
range->need_timer = FALSE;
}
@ -1284,6 +1287,8 @@ gtk_real_range_timer (GtkRange *range)
return_val = gtk_range_scroll (range, -1);
}
GTK_THREADS_LEAVE;
return return_val;
}

View File

@ -49,6 +49,7 @@
#include <gdk/gdkx.h>
/* we need this for gdk_window_lookup() */
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtkselection.h"
#include "gtksignal.h"
@ -1089,6 +1090,9 @@ static gint
gtk_selection_incr_timeout (GtkIncrInfo *info)
{
GList *tmp_list;
gboolean retval;
GTK_THREADS_ENTER;
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
@ -1116,14 +1120,18 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
g_free (info);
return FALSE; /* remove timeout */
retval = FALSE; /* remove timeout */
}
else
{
info->idle_time++;
return TRUE; /* timeout will happen again */
retval = TRUE; /* timeout will happen again */
}
GTK_THREADS_LEAVE;
return retval;
}
/*************************************************************
@ -1324,6 +1332,9 @@ static gint
gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
{
GList *tmp_list;
gboolean retval;
GTK_THREADS_ENTER;
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
@ -1349,15 +1360,18 @@ gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
g_free (info->buffer);
g_free (info);
return FALSE; /* remove timeout */
retval = FALSE; /* remove timeout */
}
else
{
info->idle_time++;
return TRUE; /* timeout will happen again */
retval = TRUE; /* timeout will happen again */
}
GTK_THREADS_LEAVE;
return retval;
}
/*************************************************************

View File

@ -28,6 +28,7 @@
#include "gdk/gdkkeysyms.h"
#include "gtkspinbutton.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtksignal.h"
@ -907,8 +908,9 @@ gtk_spin_button_motion_notify (GtkWidget *widget,
static gint
gtk_spin_button_timer (GtkSpinButton *spin_button)
{
g_return_val_if_fail (spin_button != NULL, FALSE);
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE);
gboolean retval = FALSE;
GTK_THREADS_ENTER;
if (spin_button->timer)
{
@ -923,22 +925,27 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
spin_button->timer = gtk_timeout_add
(SPIN_BUTTON_TIMER_DELAY, (GtkFunction) gtk_spin_button_timer,
(gpointer) spin_button);
return FALSE;
}
else if (spin_button->climb_rate > 0.0 && spin_button->timer_step
< spin_button->adjustment->page_increment)
else
{
if (spin_button->timer_calls < MAX_TIMER_CALLS)
spin_button->timer_calls++;
else
if (spin_button->climb_rate > 0.0 && spin_button->timer_step
< spin_button->adjustment->page_increment)
{
spin_button->timer_calls = 0;
spin_button->timer_step += spin_button->climb_rate;
if (spin_button->timer_calls < MAX_TIMER_CALLS)
spin_button->timer_calls++;
else
{
spin_button->timer_calls = 0;
spin_button->timer_step += spin_button->climb_rate;
}
}
retval = TRUE;
}
return TRUE;
}
return FALSE;
GTK_THREADS_LEAVE;
return retval;
}
static void

View File

@ -21,6 +21,7 @@
#include "gdk/gdkkeysyms.h"
#include "gdk/gdki18n.h"
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtkselection.h"
#include "gtksignal.h"
#include "gtktext.h"
@ -1697,26 +1698,27 @@ gtk_text_scroll_timeout (gpointer data)
{
GtkText *text;
GdkEventMotion event;
gint x, y;
GdkModifierType mask;
g_return_val_if_fail (GTK_IS_TEXT (data), FALSE);
GTK_THREADS_ENTER;
text = GTK_TEXT (data);
text->timer = 0;
gdk_window_get_pointer (text->text_area, &x, &y, &mask);
if (!(mask & (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK)))
return FALSE;
event.is_hint = 0;
event.x = x;
event.y = y;
event.state = mask;
gtk_text_motion_notify (GTK_WIDGET (text), &event);
if (mask & (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK))
{
event.is_hint = 0;
event.x = x;
event.y = y;
event.state = mask;
gtk_text_motion_notify (GTK_WIDGET (text), &event);
}
GTK_THREADS_LEAVE;
return FALSE;
}

View File

@ -21,6 +21,7 @@
#include <stdio.h>
#include "gtkmain.h"
#include "gtkprivate.h"
#include "gtkwidget.h"
#include "gtkdrawwindow.h"
#include "gtksignal.h"
@ -493,10 +494,14 @@ gtk_tooltips_timeout (gpointer data)
{
GtkTooltips *tooltips = (GtkTooltips *) data;
GTK_THREADS_ENTER;
if (tooltips->active_tips_data != NULL &&
GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
gtk_tooltips_draw_tips (tooltips);
GTK_THREADS_LEAVE;
return FALSE;
}

View File

@ -1950,6 +1950,8 @@ gtk_widget_idle_draw (gpointer data)
GSList *draw_data_list;
GtkWidget *widget;
GTK_THREADS_ENTER;
/* Translate all draw requests to be allocation-relative */
widget_list = gtk_widget_redraw_queue;
while (widget_list)
@ -2131,6 +2133,8 @@ gtk_widget_idle_draw (gpointer data)
g_slist_free (gtk_widget_redraw_queue);
gtk_widget_redraw_queue = NULL;
GTK_THREADS_LEAVE;
return FALSE;
}

View File

@ -49,7 +49,8 @@ typedef enum
GTK_HAS_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15,
GTK_RC_STYLE = 1 << 16,
GTK_COMPOSITE_CHILD = 1 << 17
GTK_COMPOSITE_CHILD = 1 << 17,
GTK_NO_REPARENT = 1 << 18
} GtkWidgetFlags;
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.

View File

@ -53,7 +53,7 @@ counter (void *data)
GtkWidget *label;
GtkWidget *button;
gdk_threads_enter();
gtk_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 (GTK_LABEL (label), buffer);
gdk_threads_leave();
gtk_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);
gdk_threads_enter();
gtk_threads_enter();
}
gtk_widget_destroy (window);
@ -102,7 +102,7 @@ counter (void *data)
gtk_main_quit();
pthread_mutex_unlock (&nthreads_mutex);
gdk_threads_leave();
gtk_threads_leave();
return NULL;
}
@ -115,7 +115,7 @@ main (int argc, char **argv)
#ifdef USE_PTHREADS
int i;
if (!gdk_threads_init())
if (!gtk_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);
gdk_threads_enter();
gtk_threads_enter();
gtk_main();
gdk_threads_leave();
gtk_threads_leave();
fprintf(stderr, "Done\n");
#else /* !USE_PTHREADS */
fprintf (stderr, "GTK+ not compiled with threads support\n");

View File

@ -53,7 +53,7 @@ counter (void *data)
GtkWidget *label;
GtkWidget *button;
gdk_threads_enter();
gtk_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 (GTK_LABEL (label), buffer);
gdk_threads_leave();
gtk_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);
gdk_threads_enter();
gtk_threads_enter();
}
gtk_widget_destroy (window);
@ -102,7 +102,7 @@ counter (void *data)
gtk_main_quit();
pthread_mutex_unlock (&nthreads_mutex);
gdk_threads_leave();
gtk_threads_leave();
return NULL;
}
@ -115,7 +115,7 @@ main (int argc, char **argv)
#ifdef USE_PTHREADS
int i;
if (!gdk_threads_init())
if (!gtk_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);
gdk_threads_enter();
gtk_threads_enter();
gtk_main();
gdk_threads_leave();
gtk_threads_leave();
fprintf(stderr, "Done\n");
#else /* !USE_PTHREADS */
fprintf (stderr, "GTK+ not compiled with threads support\n");