forked from AuroraMiddleware/gtk
gtk/gtktextbuffer: Use accessor functions to access GtkSelectionData
This commit is contained in:
parent
2b7afcdd79
commit
1ceddae7da
@ -3156,7 +3156,7 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
|
||||
* used within-process
|
||||
*/
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
(void*)&buffer,
|
||||
sizeof (buffer));
|
||||
@ -3167,11 +3167,11 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
|
||||
gsize len;
|
||||
|
||||
str = gtk_text_buffer_serialize (buffer, buffer,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
&start, &end, &len);
|
||||
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
str, len);
|
||||
g_free (str);
|
||||
@ -3226,7 +3226,7 @@ clipboard_get_contents_cb (GtkClipboard *clipboard,
|
||||
* be used within-process. OK to supply a NULL value for contents.
|
||||
*/
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
(void*)&contents,
|
||||
sizeof (contents));
|
||||
@ -3244,11 +3244,11 @@ clipboard_get_contents_cb (GtkClipboard *clipboard,
|
||||
gtk_text_buffer_get_bounds (contents, &start, &end);
|
||||
|
||||
str = gtk_text_buffer_serialize (clipboard_source_buffer, contents,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
&start, &end, &len);
|
||||
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
str, len);
|
||||
g_free (str);
|
||||
@ -3404,23 +3404,22 @@ selection_data_get_buffer (GtkSelectionData *selection_data,
|
||||
GtkTextBuffer *src_buffer = NULL;
|
||||
|
||||
/* If we can get the owner, the selection is in-process */
|
||||
owner = gdk_selection_owner_get_for_display (selection_data->display,
|
||||
selection_data->selection);
|
||||
owner = gdk_selection_owner_get_for_display (gtk_selection_data_get_display (selection_data),
|
||||
gtk_selection_data_get_selection (selection_data));
|
||||
|
||||
if (owner == NULL)
|
||||
return NULL;
|
||||
|
||||
if (gdk_window_get_window_type (owner) == GDK_WINDOW_FOREIGN)
|
||||
return NULL;
|
||||
|
||||
if (selection_data->type !=
|
||||
gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
|
||||
|
||||
if (gtk_selection_data_get_data_type (selection_data) != gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
|
||||
return NULL;
|
||||
|
||||
if (selection_data->length != sizeof (src_buffer))
|
||||
if (gtk_selection_data_get_length (selection_data) != sizeof (src_buffer))
|
||||
return NULL;
|
||||
|
||||
memcpy (&src_buffer, selection_data->data, sizeof (src_buffer));
|
||||
|
||||
memcpy (&src_buffer, gtk_selection_data_get_data (selection_data), sizeof (src_buffer));
|
||||
|
||||
if (src_buffer == NULL)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user