X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fselect-gtk.c;h=b1251baa2194972236ddd743cf9b1cd8cad44c7b;hb=5d0cf827247def2db200614bf5d3ab700776d641;hp=a11cb635e984871afab73165e15715180809a1e4;hpb=7ee7b9fd0c91842f267cf6e412286d647f68e32a;p=chise%2Fxemacs-chise.git.1 diff --git a/src/select-gtk.c b/src/select-gtk.c index a11cb63..b1251ba 100644 --- a/src/select-gtk.c +++ b/src/select-gtk.c @@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */ #include "opaque.h" #include "frame.h" +int lisp_to_time (Lisp_Object, time_t *); static Lisp_Object Vretrieved_selection; static gboolean waiting_for_selection; Lisp_Object Vgtk_sent_selection_hooks; @@ -208,6 +209,40 @@ emacs_gtk_selection_handle (GtkWidget *widget, } +void +emacs_gtk_selection_clear_event_handle (GtkWidget *widget, + GdkEventSelection *event, + gpointer data) +{ + GdkAtom selection = event->selection; + guint32 changed_owner_time = event->time; + struct device *d = decode_gtk_device (Qnil); + + Lisp_Object selection_symbol, local_selection_time_lisp; + guint32 local_selection_time; + + selection_symbol = atom_to_symbol (d, selection); + + local_selection_time_lisp = Fget_selection_timestamp (selection_symbol); + + /* We don't own the selection, so that's fine. */ + if (NILP (local_selection_time_lisp)) + return; + + local_selection_time = *(guint32 *) XOPAQUE_DATA (local_selection_time_lisp); + + /* This SelectionClear is for a selection that we no longer own, so we can + disregard it. (That is, we have reasserted the selection since this + request was generated.) + */ + if (changed_owner_time != GDK_CURRENT_TIME && + local_selection_time > changed_owner_time) + return; + + handle_selection_clear (selection_symbol); +} + + static GtkWidget *reading_selection_reply; static GdkAtom reading_which_selection;