Mercurial > hg > xemacs-beta
diff src/select-msw.c @ 430:a5df635868b2 r21-2-23
Import from CVS: tag r21-2-23
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:29:08 +0200 |
parents | 3ecd8885ac67 |
children | abe6d1db359e |
line wrap: on
line diff
--- a/src/select-msw.c Mon Aug 13 11:28:16 2007 +0200 +++ b/src/select-msw.c Mon Aug 13 11:29:08 2007 +0200 @@ -29,6 +29,7 @@ #include <config.h> #include "lisp.h" +#include "frame.h" #include "select.h" #include "console-msw.h" @@ -41,6 +42,7 @@ int rawsize, size, i; unsigned char *src, *dst, *next; HGLOBAL h = NULL; + struct frame *f = NULL; CHECK_STRING (string); @@ -52,7 +54,8 @@ 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 @@ i = (SetClipboardData (CF_TEXT, h) != NULL); CloseClipboard (); - GlobalFree (h); return i ? Qt : Qnil; } @@ -184,7 +186,16 @@ */ ()) { - 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