Improve checks on public entry points, including, among other things

Fri Oct  4 17:13:03 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkdnd.c: Improve checks on public entry points,
        including, among other things checking whether drag
        contexts passed in are source or dest. (Fixes
        #76762, Alexey A. Malyshev)

        * tests/testtext.c tests/testgtk.c tests/testdnd.c:
        Fix uninstalled operation for new pixbuf changes.

        * gtk/stock-icons/Makefile.am (pixbuf_csource):
        Fix makefile for uninstalled operation.
This commit is contained in:
Owen Taylor 2002-10-04 21:25:47 +00:00 committed by Owen Taylor
parent d2aa626845
commit 47bed428ff
11 changed files with 132 additions and 39 deletions

View File

@ -1,3 +1,16 @@
Fri Oct 4 17:13:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Improve checks on public entry points,
including, among other things checking whether drag
contexts passed in are source or dest. (Fixes
#76762, Alexey A. Malyshev)
* tests/testtext.c tests/testgtk.c tests/testdnd.c:
Fix uninstalled operation for new pixbuf changes.
* gtk/stock-icons/Makefile.am (pixbuf_csource):
Fix makefile for uninstalled operation.
Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk> Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused

View File

@ -1,3 +1,16 @@
Fri Oct 4 17:13:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Improve checks on public entry points,
including, among other things checking whether drag
contexts passed in are source or dest. (Fixes
#76762, Alexey A. Malyshev)
* tests/testtext.c tests/testgtk.c tests/testdnd.c:
Fix uninstalled operation for new pixbuf changes.
* gtk/stock-icons/Makefile.am (pixbuf_csource):
Fix makefile for uninstalled operation.
Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk> Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused

View File

@ -1,3 +1,16 @@
Fri Oct 4 17:13:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Improve checks on public entry points,
including, among other things checking whether drag
contexts passed in are source or dest. (Fixes
#76762, Alexey A. Malyshev)
* tests/testtext.c tests/testgtk.c tests/testdnd.c:
Fix uninstalled operation for new pixbuf changes.
* gtk/stock-icons/Makefile.am (pixbuf_csource):
Fix makefile for uninstalled operation.
Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk> Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused

View File

@ -1,3 +1,16 @@
Fri Oct 4 17:13:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Improve checks on public entry points,
including, among other things checking whether drag
contexts passed in are source or dest. (Fixes
#76762, Alexey A. Malyshev)
* tests/testtext.c tests/testgtk.c tests/testdnd.c:
Fix uninstalled operation for new pixbuf changes.
* gtk/stock-icons/Makefile.am (pixbuf_csource):
Fix makefile for uninstalled operation.
Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk> Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused

View File

@ -1,3 +1,16 @@
Fri Oct 4 17:13:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Improve checks on public entry points,
including, among other things checking whether drag
contexts passed in are source or dest. (Fixes
#76762, Alexey A. Malyshev)
* tests/testtext.c tests/testgtk.c tests/testdnd.c:
Fix uninstalled operation for new pixbuf changes.
* gtk/stock-icons/Makefile.am (pixbuf_csource):
Fix makefile for uninstalled operation.
Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk> Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused

View File

@ -1,3 +1,16 @@
Fri Oct 4 17:13:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Improve checks on public entry points,
including, among other things checking whether drag
contexts passed in are source or dest. (Fixes
#76762, Alexey A. Malyshev)
* tests/testtext.c tests/testgtk.c tests/testdnd.c:
Fix uninstalled operation for new pixbuf changes.
* gtk/stock-icons/Makefile.am (pixbuf_csource):
Fix makefile for uninstalled operation.
Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk> Fri Oct 4 21:21:47 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused

View File

@ -616,8 +616,9 @@ gtk_drag_get_data (GtkWidget *widget,
{ {
GtkWidget *selection_widget; GtkWidget *selection_widget;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (context != NULL); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (!context->is_source);
selection_widget = gtk_drag_get_ipc_widget (gtk_widget_get_screen (widget)); selection_widget = gtk_drag_get_ipc_widget (gtk_widget_get_screen (widget));
@ -652,6 +653,9 @@ gtk_drag_get_source_widget (GdkDragContext *context)
{ {
GSList *tmp_list; GSList *tmp_list;
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
g_return_val_if_fail (!context->is_source, NULL);
tmp_list = source_widgets; tmp_list = source_widgets;
while (tmp_list) while (tmp_list)
{ {
@ -690,7 +694,8 @@ gtk_drag_finish (GdkDragContext *context,
{ {
GdkAtom target = GDK_NONE; GdkAtom target = GDK_NONE;
g_return_if_fail (context != NULL); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (!context->is_source);
if (success && del) if (success && del)
{ {
@ -782,6 +787,8 @@ gtk_drag_highlight_expose (GtkWidget *widget,
void void
gtk_drag_highlight (GtkWidget *widget) gtk_drag_highlight (GtkWidget *widget)
{ {
g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_signal_connect_after (GTK_OBJECT (widget), "expose_event", gtk_signal_connect_after (GTK_OBJECT (widget), "expose_event",
GTK_SIGNAL_FUNC (gtk_drag_highlight_expose), GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
NULL); NULL);
@ -800,8 +807,8 @@ gtk_drag_highlight (GtkWidget *widget)
void void
gtk_drag_unhighlight (GtkWidget *widget) gtk_drag_unhighlight (GtkWidget *widget)
{ {
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_signal_disconnect_by_func (GTK_OBJECT (widget), gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_highlight_expose), GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
NULL); NULL);
@ -856,7 +863,7 @@ gtk_drag_dest_set (GtkWidget *widget,
{ {
GtkDragDestSite *site; GtkDragDestSite *site;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_new (GtkDragDestSite, 1); site = g_new (GtkDragDestSite, 1);
@ -894,7 +901,8 @@ gtk_drag_dest_set_proxy (GtkWidget *widget,
{ {
GtkDragDestSite *site; GtkDragDestSite *site;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (!proxy_window || GDK_IS_WINDOW (proxy_window));
site = g_new (GtkDragDestSite, 1); site = g_new (GtkDragDestSite, 1);
@ -923,7 +931,7 @@ gtk_drag_dest_set_proxy (GtkWidget *widget,
void void
gtk_drag_dest_unset (GtkWidget *widget) gtk_drag_dest_unset (GtkWidget *widget)
{ {
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_object_set_data (GTK_OBJECT (widget), "gtk-drag-dest", NULL); gtk_object_set_data (GTK_OBJECT (widget), "gtk-drag-dest", NULL);
} }
@ -941,6 +949,8 @@ GtkTargetList*
gtk_drag_dest_get_target_list (GtkWidget *widget) gtk_drag_dest_get_target_list (GtkWidget *widget)
{ {
GtkDragDestSite *site; GtkDragDestSite *site;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"); site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
@ -962,6 +972,8 @@ gtk_drag_dest_set_target_list (GtkWidget *widget,
{ {
GtkDragDestSite *site; GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"); site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
if (site == NULL) if (site == NULL)
@ -1107,6 +1119,8 @@ gtk_drag_dest_find_target (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_WIDGET (widget), GDK_NONE); g_return_val_if_fail (GTK_IS_WIDGET (widget), GDK_NONE);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_NONE); g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_NONE);
g_return_val_if_fail (!context->is_source, GDK_NONE);
source_widget = gtk_drag_get_source_widget (context); source_widget = gtk_drag_get_source_widget (context);
@ -1795,7 +1809,7 @@ gtk_drag_begin (GtkWidget *widget,
GdkDragContext *context; GdkDragContext *context;
GtkWidget *ipc_widget; GtkWidget *ipc_widget;
g_return_val_if_fail (widget != NULL, NULL); g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL); g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
g_return_val_if_fail (target_list != NULL, NULL); g_return_val_if_fail (target_list != NULL, NULL);
@ -1920,7 +1934,7 @@ gtk_drag_source_set (GtkWidget *widget,
{ {
GtkDragSourceSite *site; GtkDragSourceSite *site;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data"); site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
@ -1976,7 +1990,7 @@ gtk_drag_source_unset (GtkWidget *widget)
{ {
GtkDragSourceSite *site; GtkDragSourceSite *site;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data"); site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
@ -2037,7 +2051,7 @@ gtk_drag_source_set_icon (GtkWidget *widget,
{ {
GtkDragSourceSite *site; GtkDragSourceSite *site;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GDK_IS_COLORMAP (colormap)); g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (GDK_IS_PIXMAP (pixmap)); g_return_if_fail (GDK_IS_PIXMAP (pixmap));
g_return_if_fail (!mask || GDK_IS_PIXMAP (mask)); g_return_if_fail (!mask || GDK_IS_PIXMAP (mask));
@ -2074,7 +2088,7 @@ gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
{ {
GtkDragSourceSite *site; GtkDragSourceSite *site;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data"); site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
@ -2101,7 +2115,7 @@ gtk_drag_source_set_icon_stock (GtkWidget *widget,
{ {
GtkDragSourceSite *site; GtkDragSourceSite *site;
g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (stock_id != NULL); g_return_if_fail (stock_id != NULL);
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data"); site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
@ -2121,9 +2135,6 @@ gtk_drag_set_icon_window (GdkDragContext *context,
{ {
GtkDragSourceInfo *info; GtkDragSourceInfo *info;
g_return_if_fail (context != NULL);
g_return_if_fail (widget != NULL);
info = gtk_drag_get_source_info (context, FALSE); info = gtk_drag_get_source_info (context, FALSE);
gtk_drag_remove_icon (info); gtk_drag_remove_icon (info);
@ -2163,8 +2174,9 @@ gtk_drag_set_icon_widget (GdkDragContext *context,
gint hot_x, gint hot_x,
gint hot_y) gint hot_y)
{ {
g_return_if_fail (context != NULL); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (widget != NULL); g_return_if_fail (context->is_source);
g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_drag_set_icon_window (context, widget, hot_x, hot_y, FALSE); gtk_drag_set_icon_window (context, widget, hot_x, hot_y, FALSE);
} }
@ -2252,6 +2264,7 @@ gtk_drag_set_icon_pixbuf (GdkDragContext *context,
gint hot_y) gint hot_y)
{ {
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (context->is_source);
g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
set_icon_stock_pixbuf (context, NULL, pixbuf, hot_x, hot_y); set_icon_stock_pixbuf (context, NULL, pixbuf, hot_x, hot_y);
@ -2274,6 +2287,7 @@ gtk_drag_set_icon_stock (GdkDragContext *context,
gint hot_y) gint hot_y)
{ {
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (context->is_source);
g_return_if_fail (stock_id != NULL); g_return_if_fail (stock_id != NULL);
set_icon_stock_pixbuf (context, stock_id, NULL, hot_x, hot_y); set_icon_stock_pixbuf (context, stock_id, NULL, hot_x, hot_y);
@ -2305,9 +2319,11 @@ gtk_drag_set_icon_pixmap (GdkDragContext *context,
GtkWidget *window; GtkWidget *window;
gint width, height; gint width, height;
g_return_if_fail (context != NULL); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (colormap != NULL); g_return_if_fail (context->is_source);
g_return_if_fail (pixmap != NULL); g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (GDK_IS_PIXMAP (pixmap));
g_return_if_fail (!mask || GDK_IS_PIXMAP (mask));
gdk_window_get_size (pixmap, &width, &height); gdk_window_get_size (pixmap, &width, &height);
@ -2342,7 +2358,8 @@ gtk_drag_set_icon_pixmap (GdkDragContext *context,
void void
gtk_drag_set_icon_default (GdkDragContext *context) gtk_drag_set_icon_default (GdkDragContext *context)
{ {
g_return_if_fail (context != NULL); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (context->is_source);
if (!default_icon_pixmap) if (!default_icon_pixmap)
gtk_drag_set_icon_stock (context, GTK_STOCK_DND, -2, -2); gtk_drag_set_icon_stock (context, GTK_STOCK_DND, -2, -2);
@ -2375,8 +2392,9 @@ gtk_drag_set_default_icon (GdkColormap *colormap,
gint hot_x, gint hot_x,
gint hot_y) gint hot_y)
{ {
g_return_if_fail (colormap != NULL); g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (pixmap != NULL); g_return_if_fail (GDK_IS_PIXMAP (pixmap));
g_return_if_fail (!mask || GDK_IS_PIXMAP (mask));
if (default_icon_colormap) if (default_icon_colormap)
gdk_colormap_unref (default_icon_colormap); gdk_colormap_unref (default_icon_colormap);
@ -3224,6 +3242,8 @@ gtk_drag_check_threshold (GtkWidget *widget,
{ {
gint drag_threshold; gint drag_threshold;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
g_object_get (gtk_widget_get_settings (widget), g_object_get (gtk_widget_get_settings (widget),
"gtk-dnd-drag-threshold", &drag_threshold, "gtk-dnd-drag-threshold", &drag_threshold,
NULL); NULL);

View File

@ -262,7 +262,7 @@ CLEANFILES = $(noinst_DATA)
if CROSS_COMPILING if CROSS_COMPILING
pixbuf_csource=$(GDK_PIXBUF_CSOURCE) pixbuf_csource=$(GDK_PIXBUF_CSOURCE)
else else
pixbuf_csource=GDK_PIXBUF_MODULEDIR=$(top_builddir)/gdk-pixbuf $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource pixbuf_csource=GDK_PIXBUF_MODULE_FILE=$$topdir/gdk-pixbuf/gdk-pixbuf.loaders $$topdir/gdk-pixbuf/gdk-pixbuf-csource
endif endif
gtkstockpixbufs.h: @REBUILD_PNGS@ $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource $(IMAGES) gtkstockpixbufs.h: @REBUILD_PNGS@ $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource $(IMAGES)

View File

@ -558,8 +558,8 @@ test_init ()
if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la", if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la",
G_FILE_TEST_EXISTS)) G_FILE_TEST_EXISTS))
{ {
putenv ("GDK_PIXBUF_MODULEDIR=../gdk-pixbuf/"); putenv ("GDK_PIXBUF_MODULE_FILE=../gdk-pixbuf/gdk-pixbuf.loaders");
putenv ("GTK_IM_MODULE_FILE=./gtk.immodules"); putenv ("GTK_IM_MODULE_FILE=../modules/input/gtk.immodules");
} }
} }

View File

@ -12194,9 +12194,10 @@ create_main_window (void)
static void static void
test_init () test_init ()
{ {
if (file_exists ("../gdk-pixbuf/libpixbufloader-pnm.la")) if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la",
G_FILE_TEST_EXISTS))
{ {
putenv ("GDK_PIXBUF_MODULEDIR=../gdk-pixbuf"); putenv ("GDK_PIXBUF_MODULE_FILE=../gdk-pixbuf/gdk-pixbuf.loaders");
putenv ("GTK_IM_MODULE_FILE=../modules/input/gtk.immodules"); putenv ("GTK_IM_MODULE_FILE=../modules/input/gtk.immodules");
} }
} }

View File

@ -2528,19 +2528,13 @@ view_add_example_widgets (View *view)
} }
} }
static gboolean
file_exists (const char *filename)
{
struct stat statbuf;
return stat (filename, &statbuf) == 0;
}
void void
test_init () test_init ()
{ {
if (file_exists ("../gdk-pixbuf/libpixbufloader-pnm.la")) if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la",
G_FILE_TEST_EXISTS))
{ {
putenv ("GDK_PIXBUF_MODULEDIR=../gdk-pixbuf/.libs"); putenv ("GDK_PIXBUF_MODULE_FILE=../gdk-pixbuf/gdk-pixbuf.loaders");
putenv ("GTK_IM_MODULE_FILE=../modules/input/gtk.immodules"); putenv ("GTK_IM_MODULE_FILE=../modules/input/gtk.immodules");
} }
} }