diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-02-25 05:12:14 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-02-25 05:12:14 +0000 |
commit | 3ce820584fc829d9c51f56193743415bec33decf (patch) | |
tree | 345002a3f5bb845c068d56d3ee0eeacb2ab57266 /gdk | |
parent | f9debe2f690e165944810058569503a6b207f903 (diff) | |
download | gdk-pixbuf-3ce820584fc829d9c51f56193743415bec33decf.tar.gz |
Convert over to using an GtkInvisible - selections don't work properly
Sun Feb 24 23:23:28 2002 Owen Taylor <otaylor@redhat.com>
* tests/testselection.c (main): Convert over to using
an GtkInvisible - selections don't work properly
with now NO_WINDOW GtkToggleButton. (Example really
should be using GtkClipboard.)
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Fix problems if sizeof(GdkAtom) != sizeof(Atom). (Unlikely)
* gdk/x11/gdkproperty-x11.c (gdk_property_get): Set
actual_length when converting atoms as well.
(Gregory Merchan, #72074)
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/x11/gdkproperty-x11.c | 3 | ||||
-rw-r--r-- | gdk/x11/gdkselection-x11.c | 13 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c index 74abf87ad..b5295d506 100644 --- a/gdk/x11/gdkproperty-x11.c +++ b/gdk/x11/gdkproperty-x11.c @@ -397,6 +397,9 @@ gdk_property_get (GdkWindow *window, for (i = 0; i < ret_nitems; i++) ret_atoms[i] = gdk_x11_xatom_to_atom (xatoms[i]); + + if (actual_length) + *actual_length = ret_nitems * sizeof (GdkAtom); } else { diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 2a4919dea..3ddd69e03 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -244,21 +244,24 @@ gdk_selection_property_get (GdkWindow *requestor, if (prop_type != None) { - *data = g_new (guchar, length); - if (prop_type == XA_ATOM || prop_type == gdk_x11_get_xatom_by_name ("ATOM_PAIR")) { Atom* atoms = (Atom*) t; - GdkAtom* atoms_dest = (GdkAtom*) *data; + GdkAtom* atoms_dest; gint num_atom, i; + + num_atom = (length - 1) / sizeof (Atom); + length = sizeof (GdkAtom) * num_atom + 1; + *data = g_malloc (length); + (*data)[length - 1] = '\0'; + atoms_dest = (GdkAtom *)(*data); - num_atom = (length - 1) / sizeof (GdkAtom); for (i=0; i < num_atom; i++) atoms_dest[i] = gdk_x11_xatom_to_atom (atoms[i]); } else { - memcpy (*data, t, length); + *data = g_memdup (t, length); } if (t) |