From 47bed428ffd4634ba0f69d192b55a26a8f552f7d Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 4 Oct 2002 21:25:47 +0000 Subject: [PATCH] Improve checks on public entry points, including, among other things Fri Oct 4 17:13:03 2002 Owen Taylor * 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. --- ChangeLog | 13 +++++++ ChangeLog.pre-2-10 | 13 +++++++ ChangeLog.pre-2-2 | 13 +++++++ ChangeLog.pre-2-4 | 13 +++++++ ChangeLog.pre-2-6 | 13 +++++++ ChangeLog.pre-2-8 | 13 +++++++ gtk/gtkdnd.c | 70 ++++++++++++++++++++++++------------- gtk/stock-icons/Makefile.am | 2 +- tests/testdnd.c | 4 +-- tests/testgtk.c | 5 +-- tests/testtext.c | 12 ++----- 11 files changed, 132 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46ff941042..2c9216b501 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Fri Oct 4 17:13:03 2002 Owen Taylor + + * 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 * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 46ff941042..2c9216b501 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +Fri Oct 4 17:13:03 2002 Owen Taylor + + * 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 * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 46ff941042..2c9216b501 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +Fri Oct 4 17:13:03 2002 Owen Taylor + + * 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 * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 46ff941042..2c9216b501 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +Fri Oct 4 17:13:03 2002 Owen Taylor + + * 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 * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 46ff941042..2c9216b501 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +Fri Oct 4 17:13:03 2002 Owen Taylor + + * 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 * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 46ff941042..2c9216b501 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +Fri Oct 4 17:13:03 2002 Owen Taylor + + * 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 * gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index d6a80a6822..da008f56c3 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -616,8 +616,9 @@ gtk_drag_get_data (GtkWidget *widget, { GtkWidget *selection_widget; - g_return_if_fail (widget != NULL); - g_return_if_fail (context != NULL); + g_return_if_fail (GTK_IS_WIDGET (widget)); + 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)); @@ -652,6 +653,9 @@ gtk_drag_get_source_widget (GdkDragContext *context) { 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; while (tmp_list) { @@ -690,7 +694,8 @@ gtk_drag_finish (GdkDragContext *context, { 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) { @@ -782,6 +787,8 @@ gtk_drag_highlight_expose (GtkWidget *widget, void gtk_drag_highlight (GtkWidget *widget) { + g_return_if_fail (GTK_IS_WIDGET (widget)); + gtk_signal_connect_after (GTK_OBJECT (widget), "expose_event", GTK_SIGNAL_FUNC (gtk_drag_highlight_expose), NULL); @@ -800,8 +807,8 @@ gtk_drag_highlight (GtkWidget *widget) void 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_FUNC (gtk_drag_highlight_expose), NULL); @@ -856,7 +863,7 @@ gtk_drag_dest_set (GtkWidget *widget, { GtkDragDestSite *site; - g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_WIDGET (widget)); site = g_new (GtkDragDestSite, 1); @@ -894,7 +901,8 @@ gtk_drag_dest_set_proxy (GtkWidget *widget, { 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); @@ -923,7 +931,7 @@ gtk_drag_dest_set_proxy (GtkWidget *widget, void 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); } @@ -941,6 +949,8 @@ GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget) { GtkDragDestSite *site; + + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); 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; + g_return_if_fail (GTK_IS_WIDGET (widget)); + site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"); 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 (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); @@ -1795,7 +1809,7 @@ gtk_drag_begin (GtkWidget *widget, GdkDragContext *context; 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 (target_list != NULL, NULL); @@ -1920,7 +1934,7 @@ gtk_drag_source_set (GtkWidget *widget, { 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"); @@ -1976,7 +1990,7 @@ gtk_drag_source_unset (GtkWidget *widget) { 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"); @@ -2037,7 +2051,7 @@ gtk_drag_source_set_icon (GtkWidget *widget, { 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_PIXMAP (pixmap)); g_return_if_fail (!mask || GDK_IS_PIXMAP (mask)); @@ -2074,7 +2088,7 @@ gtk_drag_source_set_icon_pixbuf (GtkWidget *widget, { GtkDragSourceSite *site; - g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); 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; - g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (stock_id != NULL); site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data"); @@ -2121,9 +2135,6 @@ gtk_drag_set_icon_window (GdkDragContext *context, { GtkDragSourceInfo *info; - g_return_if_fail (context != NULL); - g_return_if_fail (widget != NULL); - info = gtk_drag_get_source_info (context, FALSE); gtk_drag_remove_icon (info); @@ -2163,8 +2174,9 @@ gtk_drag_set_icon_widget (GdkDragContext *context, gint hot_x, gint hot_y) { - g_return_if_fail (context != NULL); - g_return_if_fail (widget != NULL); + g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); + 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); } @@ -2252,6 +2264,7 @@ gtk_drag_set_icon_pixbuf (GdkDragContext *context, gint hot_y) { g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); + g_return_if_fail (context->is_source); g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); 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) { g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); + g_return_if_fail (context->is_source); g_return_if_fail (stock_id != NULL); 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; gint width, height; - g_return_if_fail (context != NULL); - g_return_if_fail (colormap != NULL); - g_return_if_fail (pixmap != NULL); + g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); + g_return_if_fail (context->is_source); + 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); @@ -2342,7 +2358,8 @@ gtk_drag_set_icon_pixmap (GdkDragContext *context, void 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) 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_y) { - g_return_if_fail (colormap != NULL); - 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)); if (default_icon_colormap) gdk_colormap_unref (default_icon_colormap); @@ -3224,6 +3242,8 @@ gtk_drag_check_threshold (GtkWidget *widget, { gint drag_threshold; + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); + g_object_get (gtk_widget_get_settings (widget), "gtk-dnd-drag-threshold", &drag_threshold, NULL); diff --git a/gtk/stock-icons/Makefile.am b/gtk/stock-icons/Makefile.am index 4efcc1b8a7..affe0eba19 100644 --- a/gtk/stock-icons/Makefile.am +++ b/gtk/stock-icons/Makefile.am @@ -262,7 +262,7 @@ CLEANFILES = $(noinst_DATA) if CROSS_COMPILING pixbuf_csource=$(GDK_PIXBUF_CSOURCE) 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 gtkstockpixbufs.h: @REBUILD_PNGS@ $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource $(IMAGES) diff --git a/tests/testdnd.c b/tests/testdnd.c index 9ac1baec07..3b11a473d7 100644 --- a/tests/testdnd.c +++ b/tests/testdnd.c @@ -558,8 +558,8 @@ test_init () if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la", G_FILE_TEST_EXISTS)) { - putenv ("GDK_PIXBUF_MODULEDIR=../gdk-pixbuf/"); - putenv ("GTK_IM_MODULE_FILE=./gtk.immodules"); + putenv ("GDK_PIXBUF_MODULE_FILE=../gdk-pixbuf/gdk-pixbuf.loaders"); + putenv ("GTK_IM_MODULE_FILE=../modules/input/gtk.immodules"); } } diff --git a/tests/testgtk.c b/tests/testgtk.c index cbcd8faa16..a83af98972 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -12194,9 +12194,10 @@ create_main_window (void) static void 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"); } } diff --git a/tests/testtext.c b/tests/testtext.c index 2097f3b46e..6541c43837 100644 --- a/tests/testtext.c +++ b/tests/testtext.c @@ -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 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"); } }