diff options
Diffstat (limited to 'macosx/tkMacOSXClipboard.c')
-rw-r--r-- | macosx/tkMacOSXClipboard.c | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 79d98ff..7daffea 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -7,29 +7,28 @@ * Copyright 2001, Apple Computer, Inc. * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net> * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.12 2007/12/13 15:27:08 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.13 2008/10/05 21:26:11 dkf Exp $ */ #include "tkMacOSXPrivate.h" #include "tkSelect.h" - /* *---------------------------------------------------------------------- * * TkSelGetSelection -- * - * Retrieve the specified selection from another process. For - * now, only fetching XA_STRING from CLIPBOARD is supported. - * Eventually other types should be allowed. + * Retrieve the specified selection from another process. For now, only + * fetching XA_STRING from CLIPBOARD is supported. Eventually other types + * should be allowed. * * Results: - * The return value is a standard Tcl return value. - * If an error occurs (such as no selection exists) - * then an error message is left in the interp's result. + * The return value is a standard Tcl return value. If an error occurs + * (such as no selection exists) then an error message is left in the + * interp's result. * * Side effects: * None. @@ -72,27 +71,28 @@ TkSelGetSelection( /* * Try UNICODE first */ + err = ChkErr(GetScrapFlavorSize, scrapRef, kScrapFlavorTypeUnicode, &length); if (err == noErr && length > 0) { Tcl_DString ds; char *data; - buf = (char *) ckalloc(length + 2); + buf = ckalloc(length + 2); buf[length] = 0; buf[length+1] = 0; /* 2-byte unicode null */ err = ChkErr(GetScrapFlavorData, scrapRef, kScrapFlavorTypeUnicode, &length, buf); if (err == noErr) { Tcl_DStringInit(&ds); - Tcl_UniCharToUtfDString((Tcl_UniChar *)buf, - Tcl_UniCharLen((Tcl_UniChar *)buf), &ds); + Tcl_UniCharToUtfDString((Tcl_UniChar *) buf, + Tcl_UniCharLen((Tcl_UniChar *) buf), &ds); for (data = Tcl_DStringValue(&ds); *data != '\0'; data++) { if (*data == '\r') { *data = '\n'; } } - result = (*proc)(clientData, interp, Tcl_DStringValue(&ds)); + result = proc(clientData, interp, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); ckfree(buf); return result; @@ -109,7 +109,7 @@ TkSelGetSelection( Tcl_DString encodedText; char *data; - buf = (char *) ckalloc(length + 1); + buf = ckalloc(length + 1); buf[length] = 0; err = ChkErr(GetScrapFlavorData, scrapRef, 'TEXT', &length, buf); if (err != noErr) { @@ -150,9 +150,8 @@ TkSelGetSelection( * * TkSetSelectionOwner -- * - * This function claims ownership of the specified selection. - * If the selection is CLIPBOARD, then we empty the system - * clipboard. + * This function claims ownership of the specified selection. If the + * selection is CLIPBOARD, then we empty the system clipboard. * * Results: * None. @@ -174,16 +173,16 @@ XSetSelectionOwner( TkDisplay *dispPtr; /* - * This is a gross hack because the Tk_InternAtom interface is broken. - * It expects a Tk_Window, even though it only needs a Tk_Display. + * This is a gross hack because the Tk_InternAtom interface is broken. It + * expects a Tk_Window, even though it only needs a Tk_Display. */ tkwin = (Tk_Window) TkGetMainInfoList()->winPtr; if (selection == Tk_InternAtom(tkwin, "CLIPBOARD")) { /* - * Only claim and empty the clipboard if we aren't already the - * owner of the clipboard. + * Only claim and empty the clipboard if we aren't already the owner + * of the clipboard. */ dispPtr = TkGetMainInfoList()->winPtr->dispPtr; @@ -199,9 +198,8 @@ XSetSelectionOwner( * * TkSelUpdateClipboard -- * - * This function is called to force the clipboard to be updated - * after new data is added. On the Mac we don't need to do - * anything. + * This function is called to force the clipboard to be updated after new + * data is added. On the Mac we don't need to do anything. * * Results: * None. @@ -225,8 +223,7 @@ TkSelUpdateClipboard( * * TkSelEventProc -- * - * This procedure is invoked whenever a selection-related - * event occurs. + * This procedure is invoked whenever a selection-related event occurs. * * Results: * None. @@ -253,9 +250,8 @@ TkSelEventProc( * * TkSelPropProc -- * - * This procedure is invoked when property-change events - * occur on windows not known to the toolkit. This is a stub - * function under Windows. + * This procedure is invoked when property-change events occur on windows + * not known to the toolkit. This is a stub function under Windows. * * Results: * None. @@ -277,8 +273,8 @@ TkSelPropProc( * * TkSuspendClipboard -- * - * Handle clipboard conversion as required by the suppend event. - * This function is also called on exit. + * Handle clipboard conversion as required by the suppend event. This + * function is also called on exit. * * Results: * None. @@ -356,9 +352,9 @@ TkSuspendClipboard(void) } /* - * The system now owns the scrap. We tell Tk that it has - * lost the selection so that it will look for it the next time - * it needs it. (Window list NULL if quiting.) + * The system now owns the scrap. We tell Tk that it has lost the + * selection so that it will look for it the next time it needs it. + * (Window list NULL if quiting.) */ if (TkGetMainInfoList() != NULL) { @@ -369,3 +365,10 @@ TkSuspendClipboard(void) return; } + +/* + * Local Variables: + * fill-column: 78 + * c-basic-offset: 4 + * End: + */ |