mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-28 23:16:14 +01:00
Add closure_marshal/closure_callback fields to GSourceFuncs for use by
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com> * glib/gmain.h: Add closure_marshal/closure_callback fields to GSourceFuncs for use by g_source_set_closure(). * glib/gmain.c glib/giounix.c glib/giowin32.c glib/gmain.h: Export the SourceFuncs vtables so GObject can use them to figure out closure callbacks/marshallers for the default source types. Mon Aug 27 14:55:27 2001 Owen Taylor <otaylor@redhat.com> * gsourceclosure.[ch] (g_source_set_closure): Implement. * gsourceclosure.[ch]: Add GType's for GIOChannel, GIOCondition.
This commit is contained in:
parent
49fb6c6cc2
commit
b4c3107c7a
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 27 14:56:12 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmain.h: Add closure_marshal/closure_callback
|
||||||
|
fields to GSourceFuncs for use by g_source_set_closure().
|
||||||
|
|
||||||
|
* glib/gmain.c glib/giounix.c glib/giowin32.c
|
||||||
|
glib/gmain.h: Export the SourceFuncs vtables so GObject
|
||||||
|
can use them to figure out closure callbacks/marshallers
|
||||||
|
for the default source types.
|
||||||
|
|
||||||
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Sep 2 13:05:53 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
* glib/gstrfuncs.c (g_strchomp): Replace some uses
|
||||||
|
@ -636,6 +636,8 @@ the required condition has been met, and returns TRUE if so.
|
|||||||
@check:
|
@check:
|
||||||
@dispatch:
|
@dispatch:
|
||||||
@finalize:
|
@finalize:
|
||||||
|
@closure_callback:
|
||||||
|
@closure_marshal:
|
||||||
|
|
||||||
<!-- ##### STRUCT GSourceCallbackFuncs ##### -->
|
<!-- ##### STRUCT GSourceCallbackFuncs ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
@ -284,6 +284,10 @@ GIOChannelError g_io_channel_error_from_errno (gint en);
|
|||||||
GIOChannel* g_io_channel_unix_new (int fd);
|
GIOChannel* g_io_channel_unix_new (int fd);
|
||||||
gint g_io_channel_unix_get_fd (GIOChannel *channel);
|
gint g_io_channel_unix_get_fd (GIOChannel *channel);
|
||||||
|
|
||||||
|
|
||||||
|
/* Hook for GClosure / GSource integration. Don't touch */
|
||||||
|
GLIB_VAR GSourceFuncs g_io_watch_funcs;
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
|
||||||
#define G_WIN32_MSG_HANDLE 19981206
|
#define G_WIN32_MSG_HANDLE 19981206
|
||||||
|
@ -95,7 +95,7 @@ static gboolean g_io_unix_dispatch (GSource *source,
|
|||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
static void g_io_unix_finalize (GSource *source);
|
static void g_io_unix_finalize (GSource *source);
|
||||||
|
|
||||||
GSourceFuncs unix_watch_funcs = {
|
GSourceFuncs g_io_watch_funcs = {
|
||||||
g_io_unix_prepare,
|
g_io_unix_prepare,
|
||||||
g_io_unix_check,
|
g_io_unix_check,
|
||||||
g_io_unix_dispatch,
|
g_io_unix_dispatch,
|
||||||
@ -324,7 +324,7 @@ g_io_unix_create_watch (GIOChannel *channel,
|
|||||||
GIOUnixWatch *watch;
|
GIOUnixWatch *watch;
|
||||||
|
|
||||||
|
|
||||||
source = g_source_new (&unix_watch_funcs, sizeof (GIOUnixWatch));
|
source = g_source_new (&g_io_watch_funcs, sizeof (GIOUnixWatch));
|
||||||
watch = (GIOUnixWatch *)source;
|
watch = (GIOUnixWatch *)source;
|
||||||
|
|
||||||
watch->channel = channel;
|
watch->channel = channel;
|
||||||
|
@ -595,7 +595,7 @@ g_io_win32_finalize (GSource *source)
|
|||||||
g_io_channel_unref (watch->channel);
|
g_io_channel_unref (watch->channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSourceFuncs win32_watch_funcs = {
|
GSourceFuncs g_io_watch_funcs = {
|
||||||
g_io_win32_prepare,
|
g_io_win32_prepare,
|
||||||
g_io_win32_check,
|
g_io_win32_check,
|
||||||
g_io_win32_dispatch,
|
g_io_win32_dispatch,
|
||||||
@ -611,7 +611,7 @@ g_io_win32_create_watch (GIOChannel *channel,
|
|||||||
GIOWin32Watch *watch;
|
GIOWin32Watch *watch;
|
||||||
GSource *source;
|
GSource *source;
|
||||||
|
|
||||||
source = g_source_new (&win32_watch_funcs, sizeof (GIOWin32Watch));
|
source = g_source_new (&g_io_watch_funcs, sizeof (GIOWin32Watch));
|
||||||
watch = (GIOWin32Watch *)source;
|
watch = (GIOWin32Watch *)source;
|
||||||
|
|
||||||
watch->channel = channel;
|
watch->channel = channel;
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <gobject/gparam.h>
|
#include <gobject/gparam.h>
|
||||||
#include <gobject/gparamspecs.h>
|
#include <gobject/gparamspecs.h>
|
||||||
#include <gobject/gsignal.h>
|
#include <gobject/gsignal.h>
|
||||||
|
#include <gobject/gsourceclosure.h>
|
||||||
#include <gobject/gtype.h>
|
#include <gobject/gtype.h>
|
||||||
#include <gobject/gtypemodule.h>
|
#include <gobject/gtypemodule.h>
|
||||||
#include <gobject/gtypeplugin.h>
|
#include <gobject/gtypeplugin.h>
|
||||||
|
13
glib/gmain.c
13
glib/gmain.c
@ -220,7 +220,7 @@ static gboolean g_idle_dispatch (GSource *source,
|
|||||||
G_LOCK_DEFINE_STATIC (main_loop);
|
G_LOCK_DEFINE_STATIC (main_loop);
|
||||||
static GMainContext *default_main_context;
|
static GMainContext *default_main_context;
|
||||||
|
|
||||||
static GSourceFuncs timeout_funcs =
|
GSourceFuncs g_timeout_funcs =
|
||||||
{
|
{
|
||||||
g_timeout_prepare,
|
g_timeout_prepare,
|
||||||
g_timeout_check,
|
g_timeout_check,
|
||||||
@ -228,7 +228,7 @@ static GSourceFuncs timeout_funcs =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static GSourceFuncs idle_funcs =
|
GSourceFuncs g_idle_funcs =
|
||||||
{
|
{
|
||||||
g_idle_prepare,
|
g_idle_prepare,
|
||||||
g_idle_check,
|
g_idle_check,
|
||||||
@ -1057,6 +1057,7 @@ g_source_callback_unref (gpointer cb_data)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
g_source_callback_get (gpointer cb_data,
|
g_source_callback_get (gpointer cb_data,
|
||||||
|
GSource *source,
|
||||||
GSourceFunc *func,
|
GSourceFunc *func,
|
||||||
gpointer *data)
|
gpointer *data)
|
||||||
{
|
{
|
||||||
@ -1588,7 +1589,7 @@ g_main_dispatch (GMainContext *context)
|
|||||||
UNLOCK_CONTEXT (context);
|
UNLOCK_CONTEXT (context);
|
||||||
|
|
||||||
if (cb_funcs)
|
if (cb_funcs)
|
||||||
cb_funcs->get (cb_data, &callback, &user_data);
|
cb_funcs->get (cb_data, source, &callback, &user_data);
|
||||||
|
|
||||||
need_destroy = ! dispatch (source,
|
need_destroy = ! dispatch (source,
|
||||||
callback,
|
callback,
|
||||||
@ -2966,7 +2967,7 @@ g_timeout_dispatch (GSource *source,
|
|||||||
GSource *
|
GSource *
|
||||||
g_timeout_source_new (guint interval)
|
g_timeout_source_new (guint interval)
|
||||||
{
|
{
|
||||||
GSource *source = g_source_new (&timeout_funcs, sizeof (GTimeoutSource));
|
GSource *source = g_source_new (&g_timeout_funcs, sizeof (GTimeoutSource));
|
||||||
GTimeoutSource *timeout_source = (GTimeoutSource *)source;
|
GTimeoutSource *timeout_source = (GTimeoutSource *)source;
|
||||||
GTimeVal current_time;
|
GTimeVal current_time;
|
||||||
|
|
||||||
@ -3104,7 +3105,7 @@ g_idle_dispatch (GSource *source,
|
|||||||
GSource *
|
GSource *
|
||||||
g_idle_source_new (void)
|
g_idle_source_new (void)
|
||||||
{
|
{
|
||||||
return g_source_new (&idle_funcs, sizeof (GSource));
|
return g_source_new (&g_idle_funcs, sizeof (GSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3175,6 +3176,6 @@ g_idle_add (GSourceFunc function,
|
|||||||
gboolean
|
gboolean
|
||||||
g_idle_remove_by_data (gpointer data)
|
g_idle_remove_by_data (gpointer data)
|
||||||
{
|
{
|
||||||
return g_source_remove_by_funcs_user_data (&idle_funcs, data);
|
return g_source_remove_by_funcs_user_data (&g_idle_funcs, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
glib/gmain.h
11
glib/gmain.h
@ -59,10 +59,13 @@ struct _GSourceCallbackFuncs
|
|||||||
void (*ref) (gpointer cb_data);
|
void (*ref) (gpointer cb_data);
|
||||||
void (*unref) (gpointer cb_data);
|
void (*unref) (gpointer cb_data);
|
||||||
void (*get) (gpointer cb_data,
|
void (*get) (gpointer cb_data,
|
||||||
|
GSource *source,
|
||||||
GSourceFunc *func,
|
GSourceFunc *func,
|
||||||
gpointer *data);
|
gpointer *data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef void (*GSourceDummyMarshal) (void);
|
||||||
|
|
||||||
struct _GSourceFuncs
|
struct _GSourceFuncs
|
||||||
{
|
{
|
||||||
gboolean (*prepare) (GSource *source,
|
gboolean (*prepare) (GSource *source,
|
||||||
@ -72,6 +75,10 @@ struct _GSourceFuncs
|
|||||||
GSourceFunc callback,
|
GSourceFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void (*finalize) (GSource *source); /* Can be NULL */
|
void (*finalize) (GSource *source); /* Can be NULL */
|
||||||
|
|
||||||
|
/* For use by g_source_set_closure */
|
||||||
|
GSourceFunc closure_callback;
|
||||||
|
GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Any definitions using GPollFD or GPollFunc are primarily
|
/* Any definitions using GPollFD or GPollFunc are primarily
|
||||||
@ -286,6 +293,10 @@ guint g_idle_add_full (gint priority,
|
|||||||
GDestroyNotify notify);
|
GDestroyNotify notify);
|
||||||
gboolean g_idle_remove_by_data (gpointer data);
|
gboolean g_idle_remove_by_data (gpointer data);
|
||||||
|
|
||||||
|
/* Hook for GClosure / GSource integration. Don't touch */
|
||||||
|
GLIB_VAR GSourceFuncs g_timeout_funcs;
|
||||||
|
GLIB_VAR GSourceFuncs g_idle_funcs;
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
|
||||||
/* This is used to add polling for Windows messages. GDK (GTK+) programs
|
/* This is used to add polling for Windows messages. GDK (GTK+) programs
|
||||||
|
Loading…
Reference in New Issue
Block a user