X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fselect-msw.c;h=616f0d6b6f854fd65fe35abb753bc65dc826b00d;hb=313d1c4d8bd1f94564e5edda76ee6aac3ecb70fd;hp=3096d542dcabb8bc4f2e72f6435f5417a5a450c9;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git- diff --git a/src/select-msw.c b/src/select-msw.c index 3096d54..616f0d6 100644 --- a/src/select-msw.c +++ b/src/select-msw.c @@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */ #include #include "lisp.h" +#include "select.h" #include "console-msw.h" @@ -92,6 +93,23 @@ Copy STRING to the mswindows clipboard. return i ? Qt : Qnil; } +/* Do protocol to assert ourself as a selection owner. Under mswindows +this is easy, we just set the clipboard. */ +static Lisp_Object +mswindows_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) +{ + Lisp_Object converted_value = get_local_selection (selection_name, QSTRING); + if (!NILP (converted_value) && + CONSP (converted_value) && + EQ (XCAR (converted_value), QSTRING) && + /* pure mswindows behaviour only says we can own the selection + if it is the clipboard */ + EQ (selection_name, QCLIPBOARD)) + Fmswindows_set_clipboard (XCDR (converted_value)); + + return Qnil; +} + DEFUN ("mswindows-get-clipboard", Fmswindows_get_clipboard, 0, 0, 0, /* Return the contents of the mswindows clipboard. */ @@ -144,6 +162,15 @@ Return the contents of the mswindows clipboard. return ret; } +static Lisp_Object +mswindows_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type) +{ + if (EQ (selection_symbol, QCLIPBOARD)) + return Fmswindows_get_clipboard (); + else + return Qnil; +} + DEFUN ("mswindows-selection-exists-p", Fmswindows_selection_exists_p, 0, 0, 0, /* Whether there is an MS-Windows selection. */ @@ -160,12 +187,27 @@ Remove the current MS-Windows selection from the clipboard. return EmptyClipboard () ? Qt : Qnil; } +static void +mswindows_disown_selection (Lisp_Object selection, Lisp_Object timeval) +{ + if (EQ (selection, QCLIPBOARD)) + Fmswindows_delete_selection (); +} + /************************************************************************/ /* initialization */ /************************************************************************/ void +console_type_create_select_mswindows (void) +{ + CONSOLE_HAS_METHOD (mswindows, own_selection); + CONSOLE_HAS_METHOD (mswindows, disown_selection); + CONSOLE_HAS_METHOD (mswindows, get_foreign_selection); +} + +void syms_of_select_mswindows (void) { DEFSUBR (Fmswindows_set_clipboard);