Kaydet (Commit) 8b181f7c authored tarafından Colomban Wendling's avatar Colomban Wendling

Don't access GtkSelectionData fields directly

üst 593fef7f
...@@ -776,15 +776,16 @@ on_window_drag_data_received(GtkWidget *widget, GdkDragContext *drag_context, ...@@ -776,15 +776,16 @@ on_window_drag_data_received(GtkWidget *widget, GdkDragContext *drag_context,
guint event_time, gpointer user_data) guint event_time, gpointer user_data)
{ {
gboolean success = FALSE; 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) if (drag_context->action == GDK_ACTION_ASK)
{ {
drag_context->action = GDK_ACTION_COPY; 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; success = TRUE;
} }
......
...@@ -809,12 +809,12 @@ static void tb_editor_drag_data_rcvd_cb(GtkWidget *widget, GdkDragContext *conte ...@@ -809,12 +809,12 @@ static void tb_editor_drag_data_rcvd_cb(GtkWidget *widget, GdkDragContext *conte
GtkTreeView *tree = GTK_TREE_VIEW(widget); GtkTreeView *tree = GTK_TREE_VIEW(widget);
gboolean del = FALSE; 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; gboolean is_sep;
gchar *text = NULL; gchar *text = NULL;
text = (gchar*) data->data; text = (gchar*) gtk_selection_data_get_data(data);
is_sep = utils_str_equal(text, TB_EDITOR_SEPARATOR); 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 /* 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. */ * 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 ...@@ -684,9 +684,10 @@ static void vte_drag_data_received(GtkWidget *widget, GdkDragContext *drag_conte
{ {
if (info == TARGET_TEXT_PLAIN) 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), 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 else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment