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.
This commit is contained in:
Owen Taylor 1998-02-13 05:19:06 +00:00 committed by Owen Taylor
parent dd07df15c1
commit 888470ee29
21 changed files with 640 additions and 143 deletions

View File

@ -1,3 +1,46 @@
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.
* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:
Change style->white to style->base[] where appropriate.
Change the default style to make this apparent. (Yes, its
ugly... it can be removed later)
Tue Feb 10 15:01:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c gtk/gtkobject.h: Add a DestroyNotify
field, and gtk_object_set_data_full() to match.
* gtk/gtkobject.c (gtk_object_finalize): ObjectData structures
were being added to a free list, then forgotten about. Just
rely on GMemChunk instead.
2018-02-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c:

View File

@ -1,3 +1,46 @@
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.
* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:
Change style->white to style->base[] where appropriate.
Change the default style to make this apparent. (Yes, its
ugly... it can be removed later)
Tue Feb 10 15:01:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c gtk/gtkobject.h: Add a DestroyNotify
field, and gtk_object_set_data_full() to match.
* gtk/gtkobject.c (gtk_object_finalize): ObjectData structures
were being added to a free list, then forgotten about. Just
rely on GMemChunk instead.
2018-02-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c:

View File

@ -1,3 +1,46 @@
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.
* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:
Change style->white to style->base[] where appropriate.
Change the default style to make this apparent. (Yes, its
ugly... it can be removed later)
Tue Feb 10 15:01:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c gtk/gtkobject.h: Add a DestroyNotify
field, and gtk_object_set_data_full() to match.
* gtk/gtkobject.c (gtk_object_finalize): ObjectData structures
were being added to a free list, then forgotten about. Just
rely on GMemChunk instead.
2018-02-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c:

View File

@ -1,3 +1,46 @@
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.
* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:
Change style->white to style->base[] where appropriate.
Change the default style to make this apparent. (Yes, its
ugly... it can be removed later)
Tue Feb 10 15:01:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c gtk/gtkobject.h: Add a DestroyNotify
field, and gtk_object_set_data_full() to match.
* gtk/gtkobject.c (gtk_object_finalize): ObjectData structures
were being added to a free list, then forgotten about. Just
rely on GMemChunk instead.
2018-02-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c:

View File

@ -1,3 +1,46 @@
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.
* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:
Change style->white to style->base[] where appropriate.
Change the default style to make this apparent. (Yes, its
ugly... it can be removed later)
Tue Feb 10 15:01:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c gtk/gtkobject.h: Add a DestroyNotify
field, and gtk_object_set_data_full() to match.
* gtk/gtkobject.c (gtk_object_finalize): ObjectData structures
were being added to a free list, then forgotten about. Just
rely on GMemChunk instead.
2018-02-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c:

View File

@ -1,3 +1,46 @@
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.
* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:
Change style->white to style->base[] where appropriate.
Change the default style to make this apparent. (Yes, its
ugly... it can be removed later)
Tue Feb 10 15:01:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c gtk/gtkobject.h: Add a DestroyNotify
field, and gtk_object_set_data_full() to match.
* gtk/gtkobject.c (gtk_object_finalize): ObjectData structures
were being added to a free list, then forgotten about. Just
rely on GMemChunk instead.
2018-02-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c:

View File

@ -1,3 +1,46 @@
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.
* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:
Change style->white to style->base[] where appropriate.
Change the default style to make this apparent. (Yes, its
ugly... it can be removed later)
Tue Feb 10 15:01:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c gtk/gtkobject.h: Add a DestroyNotify
field, and gtk_object_set_data_full() to match.
* gtk/gtkobject.c (gtk_object_finalize): ObjectData structures
were being added to a free list, then forgotten about. Just
rely on GMemChunk instead.
2018-02-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c:

View File

@ -1101,7 +1101,7 @@ gdk_timer_disable ()
}
gint
gdk_input_add_interp (gint source,
gdk_input_add_full (gint source,
GdkInputCondition condition,
GdkInputFunction function,
gpointer data,

View File

@ -57,11 +57,12 @@ void gdk_timer_set (guint32 milliseconds);
void gdk_timer_enable (void);
void gdk_timer_disable (void);
gint gdk_input_add_interp (gint source,
gint gdk_input_add_full (gint source,
GdkInputCondition condition,
GdkInputFunction function,
gpointer data,
GdkDestroyNotify destroy);
#define gdk_input_add_interp gdk_input_add_full
gint gdk_input_add (gint source,
GdkInputCondition condition,
GdkInputFunction function,

View File

@ -1101,7 +1101,7 @@ gdk_timer_disable ()
}
gint
gdk_input_add_interp (gint source,
gdk_input_add_full (gint source,
GdkInputCondition condition,
GdkInputFunction function,
gpointer data,

View File

@ -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)
{
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;
fdata.container = GTK_OBJECT (container);
fdata.callback = callback;
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);
}

View File

@ -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,

View File

@ -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,
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,14 +699,18 @@ gtk_timeout_remove (gint tag)
}
}
static gint
gtk_idle_add_internal (gint interp,
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),
@ -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)
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
@ -855,6 +896,31 @@ gtk_destroy_input_function (GtkInputFunction *input)
g_free (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,
@ -862,15 +928,7 @@ gtk_input_add_interp (gint source,
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,7 +1107,7 @@ 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,
((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
{
/* 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();
}

View File

@ -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);
@ -67,11 +76,28 @@ 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_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);

View File

@ -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,8 +272,20 @@ 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;
@ -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,13 +514,7 @@ 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,
gtk_selection_invoke_handler (owner_widget,
&selection_data);
gtk_selection_retrieval_report (info,
@ -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,14 +1285,32 @@ 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:
@ -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
* data: selection data [INOUT]
*
* results:
* Number of bytes written to buffer, -1 if error
*************************************************************/
static void

View File

@ -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,

View File

@ -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,17 +447,19 @@ 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,
gtk_signal_connect_full (GtkObject *object,
gchar *name,
GtkCallbackMarshal func,
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)
{

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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);