Gdk selections question



Ok. I'm implementing selections in GtkFB, and I have a strange problem
that i don't understand.

I've made a (preliminary) implementation of the gdk_selection_* functions,
and if i use copy/paste on the context menu in a GtkEntry it works. But
when i try to paste with the middle button (from primary selection) this
happens:

gtk_entry_button_press() is called with event->button == 2
That means this is executed:
      gtk_editable_select_region (editable, tmp_pos, tmp_pos);
      gtk_entry_paste (entry, GDK_SELECTION_PRIMARY);

The second part would probably work unless this happens as due to the
first line:
   gtk_editable_select_region (editable, tmp_pos, tmp_pos);
-> (editable)->set_selection_bounds (editable, start, end);
-> gtk_entry_set_selection_bounds (editable, start, end);
Sets selection_bound and current_pos, then
-> gtk_entry_update_primary_selection (entry);
Which does:
 if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start, &end))
  blah
 else
  if (gtk_clipboard_get_owner (clipboard) == G_OBJECT (entry))
   gtk_clipboard_clear (clipboard);

The else part is taken, since there is no selection, and
gtk_clipboard_clear () does:
gtk_selection_owner_set (NULL, clipboard->selection, time);

This means the primary selection is owned by NULL (none) when the
gtk_entry_paste() is reached, and the paste just doesn't happen.

But pasting to the same entry the selection is in works in the X
version. Why?

/ Alex



    
    







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]