Don't access GtkSelectionData fields directly
This commit is contained in:
parent
593fef7fa0
commit
8b181f7c79
@ -776,15 +776,16 @@ on_window_drag_data_received(GtkWidget *widget, GdkDragContext *drag_context,
|
||||
guint event_time, gpointer user_data)
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
gint length = gtk_selection_data_get_length(data);
|
||||
|
||||
if (data->length > 0 && data->format == 8)
|
||||
if (length > 0 && gtk_selection_data_get_format(data) == 8)
|
||||
{
|
||||
if (drag_context->action == GDK_ACTION_ASK)
|
||||
{
|
||||
drag_context->action = GDK_ACTION_COPY;
|
||||
}
|
||||
|
||||
document_open_file_list((const gchar *)data->data, data->length);
|
||||
document_open_file_list((const gchar *)gtk_selection_data_get_data(data), length);
|
||||
|
||||
success = TRUE;
|
||||
}
|
||||
|
@ -809,12 +809,12 @@ static void tb_editor_drag_data_rcvd_cb(GtkWidget *widget, GdkDragContext *conte
|
||||
GtkTreeView *tree = GTK_TREE_VIEW(widget);
|
||||
gboolean del = FALSE;
|
||||
|
||||
if (data->length >= 0 && data->format == 8)
|
||||
if (gtk_selection_data_get_length(data) >= 0 && gtk_selection_data_get_format(data) == 8)
|
||||
{
|
||||
gboolean is_sep;
|
||||
gchar *text = NULL;
|
||||
|
||||
text = (gchar*) data->data;
|
||||
text = (gchar*) gtk_selection_data_get_data(data);
|
||||
is_sep = utils_str_equal(text, TB_EDITOR_SEPARATOR);
|
||||
/* If the source of the action is equal to the target, we do just re-order and so need
|
||||
* to delete the separator to get it moved, not just copied. */
|
||||
|
@ -684,9 +684,10 @@ static void vte_drag_data_received(GtkWidget *widget, GdkDragContext *drag_conte
|
||||
{
|
||||
if (info == TARGET_TEXT_PLAIN)
|
||||
{
|
||||
if (data->format == 8 && data->length > 0)
|
||||
if (gtk_selection_data_get_format(data) == 8 && gtk_selection_data_get_length(data) > 0)
|
||||
vf->vte_terminal_feed_child(VTE_TERMINAL(widget),
|
||||
(const gchar*) data->data, data->length);
|
||||
(const gchar*) gtk_selection_data_get_data(data),
|
||||
gtk_selection_data_get_length(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user