summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorOwen Taylor <owt1@cornell.edu>1998-02-13 05:19:06 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-02-13 05:19:06 +0000
commit888470ee29e6956efc4122bdb9c24a1af0344079 (patch)
tree93c5eb8ba8f361957ee4a98334b3a5e2ec365ea3 /gtk
parentdd07df15c1e39eb68a38ac4c15094a25f8e086cd (diff)
downloadgtk+-888470ee29e6956efc4122bdb9c24a1af0344079.tar.gz
gtk/gtksignal.[ch] gtk/gtkmain.[ch] gtk/gtkcontainer.[ch]
Thu Feb 12 23:59:49 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtksignal.[ch] gtk/gtkmain.[ch] gtk/gtkcontainer.[ch] gtk/gtkselection.[ch] gdk/gdk.[ch] gtktypeutils.h Replaced all _interp functions with _full functions. (_interp functions left in for compatibility until 0.99.5). Difference: _full functions take _both_ a C-language callback and a marshaller, and simply ignore the C-language callback if the marshaller is present. This allows the destroy notification to be used without marshalling. gtk_selection_add_handler[_full]() regularized to agree with other callbacks. Also, added gtk_input_add_full() to the header file. (gtk_input_add_interp() was never there) * gtk/gtkmain.[ch] gtk/gtkwidget.c: Idle functions are now prioritized. Added new function gtk_idle_add_priority to create an idle with a specified priority (default is zero) constants #defined - GTK_PRIORITY_[HIGH/INTERNAL/DEFAULT/LOW] (redraws, resizes run at GTK_PRIORITY_INTERNAL) * gtk/gtkentry.c gtk/testselection.c: changes to keep up with change to gtkselection.c.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkcontainer.c30
-rw-r--r--gtk/gtkcontainer.h7
-rw-r--r--gtk/gtkmain.c183
-rw-r--r--gtk/gtkmain.h32
-rw-r--r--gtk/gtkselection.c119
-rw-r--r--gtk/gtkselection.h8
-rw-r--r--gtk/gtksignal.c59
-rw-r--r--gtk/gtksignal.h8
-rw-r--r--gtk/gtktypeutils.h1
-rw-r--r--gtk/testselection.c6
10 files changed, 324 insertions, 129 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index a63bd764b5..aab16dd5e1 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -428,17 +428,33 @@ gtk_container_foreach_unmarshal (GtkWidget *child,
void
gtk_container_foreach_interp (GtkContainer *container,
- GtkCallbackMarshal callback,
+ GtkCallbackMarshal marshal,
gpointer callback_data,
GtkDestroyNotify notify)
{
- GtkForeachData fdata;
-
- fdata.container = GTK_OBJECT (container);
- fdata.callback = callback;
- fdata.callback_data = callback_data;
+ gtk_container_foreach_full (container, NULL, marshal,
+ callback_data, notify);
+}
+
+void
+gtk_container_foreach_full (GtkContainer *container,
+ GtkCallback callback,
+ GtkCallbackMarshal marshal,
+ gpointer callback_data,
+ GtkDestroyNotify notify)
+{
+ if (marshal)
+ {
+ GtkForeachData fdata;
- gtk_container_foreach (container, gtk_container_foreach_unmarshal, &fdata);
+ fdata.container = GTK_OBJECT (container);
+ fdata.callback = marshal;
+ fdata.callback_data = callback_data;
+
+ gtk_container_foreach (container, gtk_container_foreach_unmarshal, &fdata);
+ }
+ else
+ gtk_container_foreach (container, callback, &callback_data);
notify (callback_data);
}
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index 6904bc5786..146ab27f6a 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -89,7 +89,12 @@ void gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
void gtk_container_foreach_interp (GtkContainer *container,
- GtkCallbackMarshal callback,
+ GtkCallbackMarshal marshal,
+ gpointer callback_data,
+ GtkDestroyNotify notify);
+void gtk_container_foreach_full (GtkContainer *container,
+ GtkCallback callback,
+ GtkCallbackMarshal marshal,
gpointer callback_data,
GtkDestroyNotify notify);
gint gtk_container_focus (GtkContainer *container,
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index e442172454..e373a2e1ab 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -54,8 +54,8 @@ struct _GtkTimeoutFunction
guint32 start;
guint32 interval;
guint32 originterval;
- gint interp;
GtkFunction function;
+ GtkCallbackMarshal marshal;
gpointer data;
GtkDestroyNotify destroy;
};
@@ -63,7 +63,8 @@ struct _GtkTimeoutFunction
struct _GtkIdleFunction
{
gint tag;
- gint interp;
+ gint priority;
+ GtkCallbackMarshal marshal;
GtkFunction function;
gpointer data;
GtkDestroyNotify destroy;
@@ -593,16 +594,18 @@ gtk_invoke_key_snoopers (GtkWidget *grab_widget,
return return_val;
}
-static gint
-gtk_timeout_add_internal (guint32 interval,
- gint interp,
- GtkFunction function,
- gpointer data,
- GtkDestroyNotify destroy)
+gint
+gtk_timeout_add_full (guint32 interval,
+ GtkFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy)
{
static gint timeout_tag = 1;
GtkTimeoutFunction *timeoutf;
+ g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
+
/* Create a new timeout function structure.
* The start time is the current time.
*/
@@ -616,8 +619,8 @@ gtk_timeout_add_internal (guint32 interval,
timeoutf->start = gdk_time_get ();
timeoutf->interval = interval;
timeoutf->originterval = interval;
- timeoutf->interp = interp;
timeoutf->function = function;
+ timeoutf->marshal = marshal;
timeoutf->data = data;
timeoutf->destroy = destroy;
@@ -639,7 +642,7 @@ gtk_timeout_add (guint32 interval,
GtkFunction function,
gpointer data)
{
- return gtk_timeout_add_internal (interval, FALSE, function, data, NULL);
+ return gtk_timeout_add_full (interval, function, FALSE, data, NULL);
}
gint
@@ -648,9 +651,7 @@ gtk_timeout_add_interp (guint32 interval,
gpointer data,
GtkDestroyNotify destroy)
{
- return gtk_timeout_add_internal (interval, TRUE,
- (GtkFunction) function,
- data, destroy);
+ return gtk_timeout_add_full (interval, NULL, function, data, destroy);
}
void
@@ -698,15 +699,19 @@ gtk_timeout_remove (gint tag)
}
}
-static gint
-gtk_idle_add_internal (gint interp,
- GtkFunction function,
- gpointer data,
- GtkDestroyNotify destroy)
+gint
+gtk_idle_add_full (gint priority,
+ GtkFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy)
{
static gint idle_tag = 1;
- GtkIdleFunction *idlef;
+ GtkIdleFunction *idlef, *temp;
+ GList *tmp_list, *new_list;
+ g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
+
if (!idle_mem_chunk)
idle_mem_chunk = g_mem_chunk_new ("idle mem chunk", sizeof (GtkIdleFunction),
1024, G_ALLOC_AND_FREE);
@@ -714,16 +719,52 @@ gtk_idle_add_internal (gint interp,
idlef = g_chunk_new (GtkIdleFunction, idle_mem_chunk);
idlef->tag = idle_tag++;
- idlef->interp = interp;
+ idlef->priority = priority;
idlef->function = function;
+ idlef->marshal = marshal;
idlef->data = data;
idlef->destroy = destroy;
+
+ /* Insert the idle function into the list of idle functions
+ * sorted by priority. This really should just use
+ * glist_insert_sorted, but that ignores duplicates
+ */
+ tmp_list = idle_functions;
+ while (tmp_list)
+ {
+ temp = tmp_list->data;
+ if (idlef->priority < temp->priority)
+ {
+ new_list = g_list_alloc ();
+ new_list->data = idlef;
+ new_list->next = tmp_list;
+ new_list->prev = tmp_list->prev;
+ if (tmp_list->prev)
+ tmp_list->prev->next = new_list;
+ tmp_list->prev = new_list;
+
+ if (tmp_list == idle_functions)
+ idle_functions = new_list;
+
+ return idlef->tag;
+ }
+
+ tmp_list = tmp_list->next;
+ }
idle_functions = g_list_append (idle_functions, idlef);
return idlef->tag;
}
+gint
+gtk_idle_add_interp (GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy)
+{
+ return gtk_idle_add_full (GTK_PRIORITY_DEFAULT, NULL, marshal, data, destroy);
+}
+
static void
gtk_idle_destroy (GtkIdleFunction *idlef)
{
@@ -736,15 +777,15 @@ gint
gtk_idle_add (GtkFunction function,
gpointer data)
{
- return gtk_idle_add_internal (FALSE, function, data, NULL);
+ return gtk_idle_add_full (GTK_PRIORITY_DEFAULT, function, NULL, data, NULL);
}
-gint
-gtk_idle_add_interp (GtkCallbackMarshal function,
- gpointer data,
- GtkDestroyNotify destroy)
+gint
+gtk_idle_add_priority (gint priority,
+ GtkFunction function,
+ gpointer data)
{
- return gtk_idle_add_internal (TRUE, (GtkFunction)function, data, destroy);
+ return gtk_idle_add_full (priority, function, NULL, data, NULL);
}
void
@@ -856,21 +897,38 @@ gtk_destroy_input_function (GtkInputFunction *input)
}
gint
+gtk_input_add_full (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy)
+{
+ if (marshal)
+ {
+ GtkInputFunction *input = g_new (GtkInputFunction, 1);
+ input->callback = marshal;
+ input->data = data;
+ input->destroy = destroy;
+
+ return gdk_input_add_interp (source,
+ condition,
+ (GdkInputFunction) gtk_invoke_input_function,
+ input,
+ (GdkDestroyNotify) gtk_destroy_input_function);
+ }
+ else
+ return gdk_input_add_interp (source, condition, function, data, destroy);
+}
+
+gint
gtk_input_add_interp (gint source,
GdkInputCondition condition,
GtkCallbackMarshal callback,
gpointer data,
GtkDestroyNotify destroy)
{
- GtkInputFunction *input = g_new (GtkInputFunction, 1);
- input->callback = callback;
- input->data = data;
- input->destroy = destroy;
- return gdk_input_add_interp (source,
- condition,
- (GdkInputFunction) gtk_invoke_input_function,
- input,
- (GdkDestroyNotify) gtk_destroy_input_function);
+ gdk_input_add_full (source, condition, NULL, callback, data);
}
void
@@ -952,7 +1010,7 @@ gtk_timeout_insert (GtkTimeoutFunction *timeoutf)
static gint
gtk_invoke_timeout_function (GtkTimeoutFunction *timeoutf)
{
- if (!timeoutf->interp)
+ if (!timeoutf->marshal)
return timeoutf->function (timeoutf->data);
else
{
@@ -1040,7 +1098,7 @@ gtk_handle_timeouts ()
static gint
gtk_idle_invoke_function (GtkIdleFunction *idlef)
{
- if (!idlef->interp)
+ if (!idlef->marshal)
return idlef->function (idlef->data);
else
{
@@ -1049,9 +1107,9 @@ gtk_idle_invoke_function (GtkIdleFunction *idlef)
args[0].name = NULL;
args[0].type = GTK_TYPE_BOOL;
args[0].d.pointer_data = &ret_val;
- ((GtkCallbackMarshal)idlef->function) (NULL,
- idlef->data,
- 0, args);
+ ((GtkCallbackMarshal)idlef->marshal) (NULL,
+ idlef->data,
+ 0, args);
return ret_val;
}
}
@@ -1060,6 +1118,7 @@ static void
gtk_handle_current_idles ()
{
GList *tmp_list;
+ GList *tmp_list2;
GtkIdleFunction *idlef;
while (current_idles)
@@ -1076,7 +1135,30 @@ gtk_handle_current_idles ()
}
else
{
- idle_functions = g_list_concat (idle_functions, tmp_list);
+ /* Insert the idle function back into the list of idle
+ * functions at the end of the idles of this priority
+ */
+ tmp_list2 = idle_functions;
+ while (tmp_list2 &&
+ (((GtkIdleFunction *)tmp_list2->data)->priority <= idlef->priority))
+ tmp_list2 = tmp_list2->next;
+
+ if (!tmp_list2)
+ idle_functions = g_list_concat (idle_functions, tmp_list);
+ else if (tmp_list2 == idle_functions)
+ {
+ tmp_list->next = idle_functions;
+ if (idle_functions)
+ idle_functions->prev = tmp_list;
+ idle_functions = tmp_list;
+ }
+ else
+ {
+ tmp_list->prev = tmp_list2->prev;
+ tmp_list->next = tmp_list2;
+ tmp_list2->prev->next = tmp_list;
+ tmp_list2->prev = tmp_list;
+ }
}
}
}
@@ -1089,10 +1171,27 @@ gtk_handle_idle ()
*/
g_assert (current_idles == NULL);
+ /* Handle only the idle functions that have the highest priority */
if (idle_functions)
{
+ GList *tmp_list;
+ gint top_priority;
+
+ tmp_list = idle_functions;
+ top_priority = ((GtkIdleFunction *)tmp_list->data)->priority;
+
+ while (tmp_list &&
+ (((GtkIdleFunction *)tmp_list->data)->priority == top_priority))
+ tmp_list = tmp_list->next;
+
current_idles = idle_functions;
- idle_functions = NULL;
+ idle_functions = tmp_list;
+
+ if (tmp_list)
+ {
+ tmp_list->prev->next = NULL;
+ tmp_list->prev = NULL;
+ }
gtk_handle_current_idles();
}
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 6e5ba12379..8b2009a7eb 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -27,6 +27,10 @@
extern "C" {
#endif /* __cplusplus */
+#define GTK_PRIORITY_HIGH -20
+#define GTK_PRIORITY_INTERNAL -10
+#define GTK_PRIORITY_DEFAULT 0
+#define GTK_PRIORITY_LOW 10
typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
GdkEventKey *event,
@@ -56,6 +60,11 @@ void gtk_grab_remove (GtkWidget *widget);
void gtk_init_add (GtkFunction function,
gpointer data);
+gint gtk_timeout_add_full (guint32 interval,
+ GtkFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy);
gint gtk_timeout_add (guint32 interval,
GtkFunction function,
gpointer data);
@@ -65,13 +74,30 @@ gint gtk_timeout_add_interp (guint32 interval,
GtkDestroyNotify notify);
void gtk_timeout_remove (gint tag);
-gint gtk_idle_add (GtkFunction function,
- gpointer data);
-gint gtk_idle_add_interp (GtkCallbackMarshal function,
+gint gtk_idle_add (GtkFunction function,
+ gpointer data);
+gint gtk_idle_add_priority (gint priority,
+ GtkFunction function,
+ gpointer data);
+gint gtk_idle_add_full (gint priority,
+ GtkFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy);
+gint gtk_idle_add_interp (GtkCallbackMarshal marshal,
gpointer data,
GtkDestroyNotify destroy);
void gtk_idle_remove (gint tag);
void gtk_idle_remove_by_data (gpointer data);
+gint gtk_input_add_full (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy);
+void gtk_input_remove (gint tag);
+
+
gint gtk_key_snooper_install (GtkKeySnoopFunc snooper,
gpointer func_data);
void gtk_key_snooper_remove (gint snooper_id);
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 3cc66f7b1d..8f51e6c6c5 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -123,8 +123,9 @@ struct _GtkSelectionHandler
GdkAtom selection; /* selection thats handled */
GdkAtom target; /* target thats handled */
GtkSelectionFunction function; /* callback function */
- GtkRemoveFunction remove_func; /* called when callback is removed */
+ GtkCallbackMarshal marshal; /* Marshalling function */
gpointer data; /* callback data */
+ GtkDestroyNotify destroy; /* called when callback is removed */
};
/* Local Functions */
@@ -134,9 +135,8 @@ static gint gtk_selection_retrieval_timeout (GtkRetrievalInfo *info);
static void gtk_selection_retrieval_report (GtkRetrievalInfo *info,
GdkAtom type, gint format,
guchar *buffer, gint length);
-static GtkSelectionHandler *gtk_selection_find_handler (GtkWidget *widget,
- GdkAtom selection,
- GdkAtom target);
+static void gtk_selection_invoke_handler (GtkWidget *widget,
+ GtkSelectionData *data);
static void gtk_selection_default_handler (GtkWidget *widget,
GtkSelectionData *data);
@@ -251,7 +251,7 @@ gtk_selection_owner_set (GtkWidget *widget,
}
/*************************************************************
- * gtk_selection_add_handler:
+ * gtk_selection_add_handler_full:
* Add a handler for a specified selection/target pair
*
* arguments:
@@ -260,7 +260,9 @@ gtk_selection_owner_set (GtkWidget *widget,
* target:
* format: Format in which this handler will return data
* function: Callback function (can be NULL)
+ * marshal: Callback marshal function
* data: User data for callback
+ * destroy: Called when handler removed
*
* results:
*************************************************************/
@@ -270,9 +272,21 @@ gtk_selection_add_handler (GtkWidget *widget,
GdkAtom selection,
GdkAtom target,
GtkSelectionFunction function,
- GtkRemoveFunction remove_func,
gpointer data)
{
+ gtk_selection_add_handler_full (widget, selection, target, function,
+ NULL, data, NULL);
+}
+
+void
+gtk_selection_add_handler_full (GtkWidget *widget,
+ GdkAtom selection,
+ GdkAtom target,
+ GtkSelectionFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy)
+{
GList *selection_handlers;
GList *tmp_list;
GtkSelectionHandler *handler;
@@ -291,13 +305,14 @@ gtk_selection_add_handler (GtkWidget *widget,
handler = (GtkSelectionHandler *)tmp_list->data;
if ((handler->selection == selection) && (handler->target == target))
{
- if (handler->remove_func)
- (*handler->remove_func)(handler->data);
+ if (handler->destroy)
+ (*handler->destroy)(handler->data);
if (function)
{
handler->function = function;
- handler->remove_func = remove_func;
+ handler->marshal = marshal;
handler->data = data;
+ handler->destroy = destroy;
}
else
{
@@ -317,8 +332,9 @@ gtk_selection_add_handler (GtkWidget *widget,
handler->selection = selection;
handler->target = target;
handler->function = function;
- handler->remove_func = remove_func;
+ handler->marshal = marshal;
handler->data = data;
+ handler->destroy = destroy;
selection_handlers = g_list_append (selection_handlers, handler);
}
@@ -409,8 +425,8 @@ gtk_selection_remove_all (GtkWidget *widget)
next = tmp_list->next;
handler = (GtkSelectionHandler *)tmp_list->data;
- if (handler->remove_func)
- (*handler->remove_func)(handler->data);
+ if (handler->destroy)
+ (*handler->destroy)(handler->data);
g_free (handler);
@@ -487,7 +503,6 @@ gtk_selection_convert (GtkWidget *widget,
if (owner_window != NULL)
{
GtkWidget *owner_widget;
- GtkSelectionHandler *handler;
GtkSelectionData selection_data;
selection_data.selection = selection;
@@ -499,14 +514,8 @@ gtk_selection_convert (GtkWidget *widget,
if (owner_widget != NULL)
{
- handler = gtk_selection_find_handler (owner_widget, selection, target);
- if (handler)
- (* handler->function)(owner_widget,
- &selection_data,
- handler->data);
- else /* try the default handler */
- gtk_selection_default_handler (owner_widget,
- &selection_data);
+ gtk_selection_invoke_handler (owner_widget,
+ &selection_data);
gtk_selection_retrieval_report (info,
selection_data.type,
@@ -645,7 +654,6 @@ gtk_selection_request (GtkWidget *widget,
GdkEventSelection *event)
{
GtkIncrInfo *info;
- GtkSelectionHandler *handler;
GList *tmp_list;
guchar *mult_atoms;
int i;
@@ -737,12 +745,7 @@ gtk_selection_request (GtkWidget *widget,
event->requestor, event->property);
#endif
- handler = gtk_selection_find_handler (widget, event->selection,
- info->conversions[i].target);
- if (handler)
- (* handler->function)(widget, &data, handler->data);
- else
- gtk_selection_default_handler (widget, &data);
+ gtk_selection_invoke_handler (widget, &data);
if (data.length < 0)
{
@@ -1254,24 +1257,27 @@ gtk_selection_retrieval_report (GtkRetrievalInfo *info,
}
/*************************************************************
- * gtk_selection_find_handler:
- * Find handler for specified widget/selection/target
+ * gtk_selection_invoke_handler:
+ * Finds and invokes handler for specified
+ * widget/selection/target combination, calls
+ * gtk_selection_default_handler if none exists.
+ *
* arguments:
- * widget:
- * selection:
- * target:
+ * widget: selection owner
+ * data: selection data [INOUT]
+ *
* results:
+ * Number of bytes written to buffer, -1 if error
*************************************************************/
-static GtkSelectionHandler *
-gtk_selection_find_handler (GtkWidget *widget,
- GdkAtom selection,
- GdkAtom target)
+static void
+gtk_selection_invoke_handler (GtkWidget *widget,
+ GtkSelectionData *data)
{
GList *tmp_list;
GtkSelectionHandler *handler;
- g_return_val_if_fail (widget != NULL, FALSE);
+ g_return_if_fail (widget != NULL);
tmp_list = gtk_object_get_data (GTK_OBJECT (widget),
gtk_selection_handler_key);
@@ -1279,15 +1285,33 @@ gtk_selection_find_handler (GtkWidget *widget,
while (tmp_list)
{
handler = (GtkSelectionHandler *)tmp_list->data;
- if ((handler->selection == selection) && (handler->target == target))
- return handler;
+ if ((handler->selection == data->selection) &&
+ (handler->target == data->target))
+ break;
tmp_list = tmp_list->next;
}
- return NULL;
+ if (tmp_list == NULL)
+ gtk_selection_default_handler (widget, data);
+ else
+ {
+ if (handler->marshal)
+ {
+ GtkArg args[2];
+ args[0].type = GTK_TYPE_BOXED;
+ args[0].name = NULL;
+ GTK_VALUE_BOXED(args[0]) = data;
+ args[1].type = GTK_TYPE_NONE;
+ args[1].name = NULL;
+
+ handler->marshal (GTK_OBJECT(widget), handler->data, 1, args);
+ }
+ else
+ if (handler->function)
+ handler->function (widget, data, handler->data);
+ }
}
-
/*************************************************************
* gtk_selection_default_handler:
* Handles some default targets that exist for any widget
@@ -1297,15 +1321,8 @@ gtk_selection_find_handler (GtkWidget *widget,
*
* arguments:
* widget: selection owner
- * selection: selection requested
- * target: target requested
- * buffer: buffer to write results into
- * length: size of buffer
- * type: type atom
- * format: length of type's units in bits
- *
- * results:
- * Number of bytes written to buffer, -1 if error
+ * data: selection data [INOUT]
+ *
*************************************************************/
static void
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
index 18f3dc4b54..92aa12b016 100644
--- a/gtk/gtkselection.h
+++ b/gtk/gtkselection.h
@@ -50,8 +50,14 @@ void gtk_selection_add_handler (GtkWidget *widget,
GdkAtom selection,
GdkAtom target,
GtkSelectionFunction function,
- GtkRemoveFunction remove_func,
gpointer data);
+void gtk_selection_add_handler_full (GtkWidget *widget,
+ GdkAtom selection,
+ GdkAtom target,
+ GtkSelectionFunction function,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy);
gint gtk_selection_convert (GtkWidget *widget,
GdkAtom selection,
GdkAtom target,
diff --git a/gtk/gtksignal.c b/gtk/gtksignal.c
index ec115bf1b9..119f70b640 100644
--- a/gtk/gtksignal.c
+++ b/gtk/gtksignal.c
@@ -108,10 +108,10 @@ static GtkHandler* gtk_signal_get_handlers (GtkObject *object,
gint signal_type);
static gint gtk_signal_connect_by_type (GtkObject *object,
gint signal_type,
- gint object_signal,
GtkSignalFunc func,
gpointer func_data,
GtkSignalDestroy destroy_func,
+ gint object_signal,
gint after,
gint no_marshal);
static GtkEmission* gtk_emission_new (void);
@@ -421,9 +421,9 @@ gtk_signal_connect (GtkObject *object,
return 0;
}
- return gtk_signal_connect_by_type (object, type, FALSE,
+ return gtk_signal_connect_by_type (object, type,
func, func_data, NULL,
- FALSE, FALSE);
+ FALSE, FALSE, FALSE);
}
gint
@@ -447,18 +447,20 @@ gtk_signal_connect_after (GtkObject *object,
return 0;
}
- return gtk_signal_connect_by_type (object, type, FALSE,
+ return gtk_signal_connect_by_type (object, type,
func, func_data, NULL,
- TRUE, FALSE);
+ FALSE, TRUE, FALSE);
}
-gint
-gtk_signal_connect_interp (GtkObject *object,
- gchar *name,
- GtkCallbackMarshal func,
- gpointer func_data,
- GtkDestroyNotify destroy_func,
- gint after)
+gint
+gtk_signal_connect_full (GtkObject *object,
+ gchar *name,
+ GtkSignalFunc func,
+ GtkCallbackMarshal marshal,
+ gpointer func_data,
+ GtkDestroyNotify destroy_func,
+ gint object_signal,
+ gint after)
{
gint type;
@@ -475,9 +477,26 @@ gtk_signal_connect_interp (GtkObject *object,
return 0;
}
- return gtk_signal_connect_by_type (object, type, FALSE,
- (GtkSignalFunc) func, func_data,
- destroy_func, after, TRUE);
+ if (marshal)
+ return gtk_signal_connect_by_type (object, type, (GtkSignalFunc) marshal,
+ func_data, destroy_func,
+ object_signal, after, TRUE);
+ else
+ return gtk_signal_connect_by_type (object, type, func,
+ func_data, destroy_func,
+ object_signal, after, FALSE);
+}
+
+gint
+gtk_signal_connect_interp (GtkObject *object,
+ gchar *name,
+ GtkCallbackMarshal func,
+ gpointer func_data,
+ GtkDestroyNotify destroy_func,
+ gint after)
+{
+ return gtk_signal_connect_full (object, name, NULL, func,
+ func_data, destroy_func, FALSE, after);
}
gint
@@ -502,9 +521,9 @@ gtk_signal_connect_object (GtkObject *object,
return 0;
}
- return gtk_signal_connect_by_type (object, type, TRUE,
+ return gtk_signal_connect_by_type (object, type,
func, slot_object, NULL,
- FALSE, FALSE);
+ TRUE, FALSE, FALSE);
}
gint
@@ -528,9 +547,9 @@ gtk_signal_connect_object_after (GtkObject *object,
return 0;
}
- return gtk_signal_connect_by_type (object, type, TRUE,
+ return gtk_signal_connect_by_type (object, type,
func, slot_object, NULL,
- TRUE, FALSE);
+ TRUE, TRUE, FALSE);
}
typedef struct _GtkDisconnectInfo GtkDisconnectInfo;
@@ -1125,10 +1144,10 @@ gtk_signal_handler_pending (GtkObject *object,
static gint
gtk_signal_connect_by_type (GtkObject *object,
gint signal_type,
- gint object_signal,
GtkSignalFunc func,
gpointer func_data,
GtkSignalDestroy destroy_func,
+ gint object_signal,
gint after,
gint no_marshal)
{
diff --git a/gtk/gtksignal.h b/gtk/gtksignal.h
index 2212d8bb33..dd0c3eb1d8 100644
--- a/gtk/gtksignal.h
+++ b/gtk/gtksignal.h
@@ -102,6 +102,14 @@ gint gtk_signal_connect_object_after (GtkObject *object,
const gchar *name,
GtkSignalFunc func,
GtkObject *slot_object);
+gint gtk_signal_connect_full (GtkObject *object,
+ gchar *name,
+ GtkSignalFunc func,
+ GtkCallbackMarshal marshal,
+ gpointer data,
+ GtkDestroyNotify destroy_func,
+ gint object_signal,
+ gint after);
gint gtk_signal_connect_interp (GtkObject *object,
gchar *name,
GtkCallbackMarshal func,
diff --git a/gtk/gtktypeutils.h b/gtk/gtktypeutils.h
index 8365935196..2671a1d3a2 100644
--- a/gtk/gtktypeutils.h
+++ b/gtk/gtktypeutils.h
@@ -81,7 +81,6 @@ typedef void (*GtkObjectInitFunc) (gpointer object);
typedef void (*GtkArgGetFunc) (GtkObject *object, GtkArg *arg, guint arg_id);
typedef void (*GtkArgSetFunc) (GtkObject *object, GtkArg *arg, guint arg_id);
typedef gint (*GtkFunction) (gpointer data);
-typedef void (*GtkRemoveFunction) (gpointer data);
typedef void (*GtkCallbackMarshal) (GtkObject *object,
gpointer data,
int n_args,
diff --git a/gtk/testselection.c b/gtk/testselection.c
index 15ea22573d..6a05929131 100644
--- a/gtk/testselection.c
+++ b/gtk/testselection.c
@@ -407,14 +407,14 @@ main (int argc, char *argv[])
GTK_SIGNAL_FUNC (selection_received), NULL);
gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[STRING], selection_handle, NULL, NULL);
+ seltypes[STRING], selection_handle, NULL);
gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[TEXT], selection_handle, NULL, NULL);
+ seltypes[TEXT], selection_handle, NULL);
gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
seltypes[COMPOUND_TEXT],
- selection_handle, NULL, NULL);
+ selection_handle, NULL);
selection_text = gtk_text_new (NULL, NULL);
gtk_table_attach_defaults (GTK_TABLE (table), selection_text, 0, 1, 1, 2);