Fix cut and paste typo where wrong pixmap was being unref'ed. (Pointed out

Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
	cut and paste typo where wrong pixmap was being
	unref'ed. (Pointed out by a friend of KUSANO Takayuki.)

Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkselection.c (gtk_selection_bytes_per_item):
	Add helper function to compute format / bytes
	relationship. Use in a couple places to fix up
	errors which assume 8 * format.

	* gtk/gtkselection.c (gtk_selection_request): Use 32
	rather than 8 * sizeof (GdkAtom), to work correctly
	on Alpha.
This commit is contained in:
Owen Taylor
2000-06-11 18:06:04 +00:00
committed by Owen Taylor
parent b166924b0c
commit 62e5119872
9 changed files with 164 additions and 59 deletions

View File

@ -1,13 +1,24 @@
Thu Jun 8 15:44:42 2000 Elliot Lee <sopwith@redhat.com> Sun Jun 11 12:46:19 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Save cflags for all backends, not just X11.
Wed Jun 7 15:44:42 2000 Elliot Lee <sopwith@redhat.com> * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
* configure.in: Use $PANGO_CONFIG instead of pango-config cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
Sun Jun 11 10:22:36 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.
* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.
Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com> Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
GTK+ from even building at all GTK+ from building at all.
* gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues. * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.

View File

@ -1,13 +1,24 @@
Thu Jun 8 15:44:42 2000 Elliot Lee <sopwith@redhat.com> Sun Jun 11 12:46:19 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Save cflags for all backends, not just X11.
Wed Jun 7 15:44:42 2000 Elliot Lee <sopwith@redhat.com> * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
* configure.in: Use $PANGO_CONFIG instead of pango-config cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
Sun Jun 11 10:22:36 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.
* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.
Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com> Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
GTK+ from even building at all GTK+ from building at all.
* gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues. * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.

View File

@ -1,13 +1,24 @@
Thu Jun 8 15:44:42 2000 Elliot Lee <sopwith@redhat.com> Sun Jun 11 12:46:19 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Save cflags for all backends, not just X11.
Wed Jun 7 15:44:42 2000 Elliot Lee <sopwith@redhat.com> * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
* configure.in: Use $PANGO_CONFIG instead of pango-config cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
Sun Jun 11 10:22:36 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.
* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.
Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com> Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
GTK+ from even building at all GTK+ from building at all.
* gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues. * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.

View File

@ -1,13 +1,24 @@
Thu Jun 8 15:44:42 2000 Elliot Lee <sopwith@redhat.com> Sun Jun 11 12:46:19 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Save cflags for all backends, not just X11.
Wed Jun 7 15:44:42 2000 Elliot Lee <sopwith@redhat.com> * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
* configure.in: Use $PANGO_CONFIG instead of pango-config cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
Sun Jun 11 10:22:36 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.
* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.
Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com> Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
GTK+ from even building at all GTK+ from building at all.
* gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues. * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.

View File

@ -1,13 +1,24 @@
Thu Jun 8 15:44:42 2000 Elliot Lee <sopwith@redhat.com> Sun Jun 11 12:46:19 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Save cflags for all backends, not just X11.
Wed Jun 7 15:44:42 2000 Elliot Lee <sopwith@redhat.com> * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
* configure.in: Use $PANGO_CONFIG instead of pango-config cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
Sun Jun 11 10:22:36 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.
* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.
Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com> Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
GTK+ from even building at all GTK+ from building at all.
* gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues. * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.

View File

@ -1,13 +1,24 @@
Thu Jun 8 15:44:42 2000 Elliot Lee <sopwith@redhat.com> Sun Jun 11 12:46:19 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Save cflags for all backends, not just X11.
Wed Jun 7 15:44:42 2000 Elliot Lee <sopwith@redhat.com> * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
* configure.in: Use $PANGO_CONFIG instead of pango-config cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
Sun Jun 11 10:22:36 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.
* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.
Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com> Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
GTK+ from even building at all GTK+ from building at all.
* gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues. * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.

View File

@ -1,13 +1,24 @@
Thu Jun 8 15:44:42 2000 Elliot Lee <sopwith@redhat.com> Sun Jun 11 12:46:19 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Save cflags for all backends, not just X11.
Wed Jun 7 15:44:42 2000 Elliot Lee <sopwith@redhat.com> * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
* configure.in: Use $PANGO_CONFIG instead of pango-config cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
Sun Jun 11 10:22:36 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.
* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.
Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com> Wed Jun 7 15:44:42 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
GTK+ from even building at all GTK+ from building at all.
* gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues. * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.

View File

@ -2065,7 +2065,7 @@ gtk_drag_set_default_icon (GdkColormap *colormap,
if (default_icon_pixmap) if (default_icon_pixmap)
gdk_pixmap_unref (default_icon_pixmap); gdk_pixmap_unref (default_icon_pixmap);
if (default_icon_mask) if (default_icon_mask)
gdk_pixmap_unref (default_icon_pixmap); gdk_pixmap_unref (default_icon_mask);
default_icon_colormap = colormap; default_icon_colormap = colormap;
gdk_colormap_ref (colormap); gdk_colormap_ref (colormap);

View File

@ -139,18 +139,21 @@ struct _GtkRetrievalInfo
}; };
/* Local Functions */ /* Local Functions */
static void gtk_selection_init (void); static void gtk_selection_init (void);
static gint gtk_selection_incr_timeout (GtkIncrInfo *info); static gint gtk_selection_incr_timeout (GtkIncrInfo *info);
static gint gtk_selection_retrieval_timeout (GtkRetrievalInfo *info); static gint gtk_selection_retrieval_timeout (GtkRetrievalInfo *info);
static void gtk_selection_retrieval_report (GtkRetrievalInfo *info, static void gtk_selection_retrieval_report (GtkRetrievalInfo *info,
GdkAtom type, gint format, GdkAtom type,
guchar *buffer, gint length, gint format,
guint32 time); guchar *buffer,
static void gtk_selection_invoke_handler (GtkWidget *widget, gint length,
GtkSelectionData *data, guint32 time);
guint time); static void gtk_selection_invoke_handler (GtkWidget *widget,
static void gtk_selection_default_handler (GtkWidget *widget, GtkSelectionData *data,
GtkSelectionData *data); guint time);
static void gtk_selection_default_handler (GtkWidget *widget,
GtkSelectionData *data);
static int gtk_selection_bytes_per_item (gint format);
/* Local Data */ /* Local Data */
static gint initialize = TRUE; static gint initialize = TRUE;
@ -891,7 +894,7 @@ gtk_selection_request (GtkWidget *widget,
for (i=0; i<info->num_conversions; i++) for (i=0; i<info->num_conversions; i++)
{ {
GtkSelectionData data; GtkSelectionData data;
gint items; glong items;
data.selection = event->selection; data.selection = event->selection;
data.target = info->conversions[i].target; data.target = info->conversions[i].target;
@ -916,7 +919,7 @@ gtk_selection_request (GtkWidget *widget,
g_return_val_if_fail ((data.format >= 8) && (data.format % 8 == 0), FALSE); g_return_val_if_fail ((data.format >= 8) && (data.format % 8 == 0), FALSE);
items = (data.length + data.format/8 - 1) / (data.format/8); items = data.length / gtk_selection_bytes_per_item (data.format);
if (data.length > GTK_SELECTION_MAX_SIZE) if (data.length > GTK_SELECTION_MAX_SIZE)
{ {
@ -929,7 +932,7 @@ gtk_selection_request (GtkWidget *widget,
gdk_property_change (info->requestor, gdk_property_change (info->requestor,
info->conversions[i].property, info->conversions[i].property,
gtk_selection_atoms[INCR], gtk_selection_atoms[INCR],
8*sizeof (GdkAtom), 32,
GDK_PROP_MODE_REPLACE, GDK_PROP_MODE_REPLACE,
(guchar *)&items, 1); (guchar *)&items, 1);
} }
@ -972,7 +975,7 @@ gtk_selection_request (GtkWidget *widget,
if (event->target == gtk_selection_atoms[MULTIPLE]) if (event->target == gtk_selection_atoms[MULTIPLE])
{ {
gdk_property_change (info->requestor, event->property, gdk_property_change (info->requestor, event->property,
GDK_SELECTION_TYPE_ATOM, 8*sizeof(GdkAtom), GDK_SELECTION_TYPE_ATOM, 32,
GDK_PROP_MODE_REPLACE, GDK_PROP_MODE_REPLACE,
mult_atoms, 2*info->num_conversions); mult_atoms, 2*info->num_conversions);
g_free (mult_atoms); g_free (mult_atoms);
@ -1053,6 +1056,8 @@ gtk_selection_incr_event (GdkWindow *window,
if (info->conversions[i].property == event->atom && if (info->conversions[i].property == event->atom &&
info->conversions[i].offset != -1) info->conversions[i].offset != -1)
{ {
int bytes_per_item;
info->idle_time = 0; info->idle_time = 0;
if (info->conversions[i].offset == -2) /* only the last 0-length if (info->conversions[i].offset == -2) /* only the last 0-length
@ -1081,13 +1086,14 @@ gtk_selection_incr_event (GdkWindow *window,
num_bytes, info->conversions[i].offset, num_bytes, info->conversions[i].offset,
GDK_WINDOW_XWINDOW(info->requestor), event->atom); GDK_WINDOW_XWINDOW(info->requestor), event->atom);
#endif #endif
bytes_per_item = gtk_selection_bytes_per_item (info->conversions[i].data.format);
gdk_property_change (info->requestor, event->atom, gdk_property_change (info->requestor, event->atom,
info->conversions[i].data.type, info->conversions[i].data.type,
info->conversions[i].data.format, info->conversions[i].data.format,
GDK_PROP_MODE_REPLACE, GDK_PROP_MODE_REPLACE,
buffer, buffer,
(num_bytes + info->conversions[i].data.format/8 - 1) / num_bytes / bytes_per_item);
(info->conversions[i].data.format/8));
if (info->conversions[i].offset == -2) if (info->conversions[i].offset == -2)
{ {
@ -1517,11 +1523,13 @@ gtk_selection_default_handler (GtkWidget *widget,
if ((selection_info->widget == widget) && if ((selection_info->widget == widget) &&
(selection_info->selection == data->selection)) (selection_info->selection == data->selection))
{ {
gulong time = selection_info->time;
gtk_selection_data_set (data, gtk_selection_data_set (data,
GDK_SELECTION_TYPE_INTEGER, GDK_SELECTION_TYPE_INTEGER,
sizeof (guint32)*8, 32,
(guchar *)&selection_info->time, (guchar *)&time,
sizeof (guint32)); sizeof (time));
return; return;
} }
@ -1544,7 +1552,7 @@ gtk_selection_default_handler (GtkWidget *widget,
count = g_list_length (target_list->list) + 3; count = g_list_length (target_list->list) + 3;
data->type = GDK_SELECTION_TYPE_ATOM; data->type = GDK_SELECTION_TYPE_ATOM;
data->format = 8*sizeof (GdkAtom); data->format = 32;
data->length = count * sizeof (GdkAtom); data->length = count * sizeof (GdkAtom);
p = g_new (GdkAtom, count); p = g_new (GdkAtom, count);
@ -1590,3 +1598,23 @@ gtk_selection_data_free (GtkSelectionData *data)
g_free (data); g_free (data);
} }
static int
gtk_selection_bytes_per_item (gint format)
{
switch (format)
{
case 8:
return sizeof (char);
break;
case 16:
return sizeof (short);
break;
case 32:
return sizeof (long);
break;
default:
g_assert_not_reached();
}
return 0;
}