X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fselect-msw.c;fp=src%2Fselect-msw.c;h=a760eb0681a53b18ab69d47404f8f86121908b1a;hp=616f0d6b6f854fd65fe35abb753bc65dc826b00d;hb=b73e352f264e9da0a00159dc29f318305cbe8636;hpb=afa9772e3fcbb4e80e3e4cfd1a40b4fccc6d08b8 diff --git a/src/select-msw.c b/src/select-msw.c index 616f0d6..a760eb0 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 "frame.h" #include "select.h" #include "console-msw.h" @@ -41,6 +42,7 @@ Copy STRING to the mswindows clipboard. int rawsize, size, i; unsigned char *src, *dst, *next; HGLOBAL h = NULL; + struct frame *f = NULL; CHECK_STRING (string); @@ -52,7 +54,8 @@ Copy STRING to the mswindows clipboard. if (src[i] == '\n') size++; - if (!OpenClipboard (NULL)) + f = selected_frame (); + if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f))) return Qnil; if (!EmptyClipboard () || @@ -88,7 +91,6 @@ Copy STRING to the mswindows clipboard. i = (SetClipboardData (CF_TEXT, h) != NULL); CloseClipboard (); - GlobalFree (h); return i ? Qt : Qnil; } @@ -184,7 +186,16 @@ Remove the current MS-Windows selection from the clipboard. */ ()) { - return EmptyClipboard () ? Qt : Qnil; + BOOL success = OpenClipboard (NULL); + if (success) + { + success = EmptyClipboard (); + /* Close it regardless of whether empty worked. */ + if (!CloseClipboard ()) + success = FALSE; + } + + return success ? Qt : Qnil; } static void