summaryrefslogtreecommitdiffstats
path: root/win/tkWinClipboard.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-12-02 00:19:04 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-12-02 00:19:04 (GMT)
commit16d7449c764a6890a1d2b3c7e7a5132fd69640b3 (patch)
tree52d269b4d68227dbd097997cd3eb23056cdf78fe /win/tkWinClipboard.c
parentb5ed9a2687177fecfe6839deae0aefa98289dace (diff)
downloadtk-16d7449c764a6890a1d2b3c7e7a5132fd69640b3.zip
tk-16d7449c764a6890a1d2b3c7e7a5132fd69640b3.tar.gz
tk-16d7449c764a6890a1d2b3c7e7a5132fd69640b3.tar.bz2
ANSIfication
Diffstat (limited to 'win/tkWinClipboard.c')
-rw-r--r--win/tkWinClipboard.c171
1 files changed, 84 insertions, 87 deletions
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index b08147a..bb91f4d 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinClipboard.c --
*
* This file contains functions for managing the clipboard.
@@ -6,30 +6,30 @@
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * 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: tkWinClipboard.c,v 1.7 2000/04/12 18:51:11 hobbs Exp $
+ * RCS: @(#) $Id: tkWinClipboard.c,v 1.8 2005/12/02 00:19:04 dkf Exp $
*/
#include "tkWinInt.h"
#include "tkSelect.h"
-static void UpdateClipboard _ANSI_ARGS_((HWND hwnd));
+static void UpdateClipboard(HWND hwnd);
/*
*----------------------------------------------------------------------
*
* 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.
@@ -38,18 +38,17 @@ static void UpdateClipboard _ANSI_ARGS_((HWND hwnd));
*/
int
-TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
- Tcl_Interp *interp; /* Interpreter to use for reporting
- * errors. */
- Tk_Window tkwin; /* Window on whose behalf to retrieve
- * the selection (determines display
- * from which to retrieve). */
- Atom selection; /* Selection to retrieve. */
- Atom target; /* Desired form in which selection
- * is to be returned. */
- Tk_GetSelProc *proc; /* Procedure to call to process the
- * selection, once it has been retrieved. */
- ClientData clientData; /* Arbitrary value to pass to proc. */
+TkSelGetSelection(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tk_Window tkwin, /* Window on whose behalf to retrieve the
+ * selection (determines display from which to
+ * retrieve). */
+ Atom selection, /* Selection to retrieve. */
+ Atom target, /* Desired form in which selection is to be
+ * returned. */
+ Tk_GetSelProc *proc, /* Procedure to call to process the selection,
+ * once it has been retrieved. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
{
char *data, *destPtr;
Tcl_DString ds;
@@ -64,8 +63,8 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
}
/*
- * Attempt to get the data in Unicode form if available as this is
- * less work that CF_TEXT.
+ * Attempt to get the data in Unicode form if available as this is less
+ * work that CF_TEXT.
*/
result = TCL_ERROR;
@@ -93,19 +92,17 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
}
/*
- * Get the locale identifier, determine the proper code page
- * to use, and find the corresponding encoding.
+ * Get the locale identifier, determine the proper code page to
+ * use, and find the corresponding encoding.
*/
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, "cp######", -1);
data = GlobalLock(handle);
-
/*
- * Even though the documentation claims that GetLocaleInfo
- * expects an LCID, on Windows 9x it really seems to expect
- * a LanguageID.
+ * Even though the documentation claims that GetLocaleInfo expects
+ * an LCID, on Windows 9x it really seems to expect a LanguageID.
*/
locale = LANGIDFROMLCID(*((int*)data));
@@ -146,7 +143,7 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
/*
* Translate CR/LF to LF.
*/
-
+
data = destPtr = Tcl_DStringValue(&ds);
while (*data) {
if (data[0] == '\r' && data[1] == '\n') {
@@ -165,12 +162,11 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
Tcl_DStringFree(&ds);
CloseClipboard();
return result;
-
-error:
+
+ error:
Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
" selection doesn't exist or form \"",
- Tk_GetAtomName(tkwin, target),
- "\" not defined", (char *) NULL);
+ Tk_GetAtomName(tkwin, target), "\" not defined", NULL);
return TCL_ERROR;
}
@@ -179,9 +175,8 @@ error:
*
* 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.
@@ -193,27 +188,26 @@ error:
*/
void
-XSetSelectionOwner(display, selection, owner, time)
- Display* display;
- Atom selection;
- Window owner;
- Time time;
+XSetSelectionOwner(
+ Display *display,
+ Atom selection,
+ Window owner,
+ Time time)
{
HWND hwnd = owner ? TkWinGetHWND(owner) : NULL;
Tk_Window tkwin;
/*
- * 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.
*/
if (GetClipboardOwner() != hwnd) {
@@ -227,8 +221,8 @@ XSetSelectionOwner(display, selection, owner, time)
*
* TkWinClipboardRender --
*
- * This function supplies the contents of the clipboard in
- * response to a WM_RENDERFORMAT message.
+ * This function supplies the contents of the clipboard in response to a
+ * WM_RENDERFORMAT message.
*
* Results:
* None.
@@ -240,9 +234,9 @@ XSetSelectionOwner(display, selection, owner, time)
*/
void
-TkWinClipboardRender(dispPtr, format)
- TkDisplay *dispPtr;
- UINT format;
+TkWinClipboardRender(
+ TkDisplay *dispPtr,
+ UINT format)
{
TkClipboardTarget *targetPtr;
TkClipboardBuffer *cbPtr;
@@ -253,13 +247,14 @@ TkWinClipboardRender(dispPtr, format)
for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
targetPtr = targetPtr->nextPtr) {
- if (targetPtr->type == XA_STRING)
+ if (targetPtr->type == XA_STRING) {
break;
+ }
}
/*
- * Count the number of newlines so we can add space for them in
- * the resulting string.
+ * Count the number of newlines so we can add space for them in the
+ * resulting string.
*/
length = 0;
@@ -296,8 +291,8 @@ TkWinClipboardRender(dispPtr, format)
*buffer = '\0';
/*
- * Depending on the platform, turn the data into Unicode or the
- * system encoding before placing it on the clipboard.
+ * Depending on the platform, turn the data into Unicode or the system
+ * encoding before placing it on the clipboard.
*/
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
@@ -330,8 +325,6 @@ TkWinClipboardRender(dispPtr, format)
Tcl_DStringFree(&ds);
SetClipboardData(CF_TEXT, handle);
}
-
- return;
}
/*
@@ -339,8 +332,8 @@ TkWinClipboardRender(dispPtr, format)
*
* TkSelUpdateClipboard --
*
- * This function is called to force the clipboard to be updated
- * after new data is added.
+ * This function is called to force the clipboard to be updated after new
+ * data is added.
*
* Results:
* None.
@@ -352,9 +345,9 @@ TkWinClipboardRender(dispPtr, format)
*/
void
-TkSelUpdateClipboard(winPtr, targetPtr)
- TkWindow *winPtr;
- TkClipboardTarget *targetPtr;
+TkSelUpdateClipboard(
+ TkWindow *winPtr,
+ TkClipboardTarget *targetPtr)
{
HWND hwnd = TkWinGetHWND(winPtr->window);
UpdateClipboard(hwnd);
@@ -365,8 +358,8 @@ TkSelUpdateClipboard(winPtr, targetPtr)
*
* UpdateClipboard --
*
- * Take ownership of the clipboard, clear it, and indicate to the
- * system the supported formats.
+ * Take ownership of the clipboard, clear it, and indicate to the system
+ * the supported formats.
*
* Results:
* None.
@@ -378,16 +371,16 @@ TkSelUpdateClipboard(winPtr, targetPtr)
*/
static void
-UpdateClipboard(hwnd)
- HWND hwnd;
+UpdateClipboard(
+ HWND hwnd)
{
TkWinUpdatingClipboard(TRUE);
OpenClipboard(hwnd);
EmptyClipboard();
/*
- * CF_UNICODETEXT is only supported on NT, but it it is prefered
- * when possible.
+ * CF_UNICODETEXT is only supported on NT, but it it is prefered when
+ * possible.
*/
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
@@ -404,25 +397,22 @@ UpdateClipboard(hwnd)
*
* TkSelEventProc --
*
- * This procedure is invoked whenever a selection-related
- * event occurs.
+ * This procedure is invoked whenever a selection-related event occurs.
*
* Results:
* None.
*
* Side effects:
- * Lots: depends on the type of event.
+ * Lots: depends on the type of event.
*
*--------------------------------------------------------------
*/
void
-TkSelEventProc(tkwin, eventPtr)
- Tk_Window tkwin; /* Window for which event was
- * targeted. */
- register XEvent *eventPtr; /* X event: either SelectionClear,
- * SelectionRequest, or
- * SelectionNotify. */
+TkSelEventProc(
+ Tk_Window tkwin, /* Window for which event was targeted. */
+ register XEvent *eventPtr) /* X event: either SelectionClear,
+ * SelectionRequest, or SelectionNotify. */
{
if (eventPtr->type == SelectionClear) {
TkSelClearSelection(tkwin, eventPtr);
@@ -434,9 +424,8 @@ TkSelEventProc(tkwin, eventPtr)
*
* 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.
@@ -448,7 +437,15 @@ TkSelEventProc(tkwin, eventPtr)
*/
void
-TkSelPropProc(eventPtr)
- register XEvent *eventPtr; /* X PropertyChange event. */
+TkSelPropProc(
+ register XEvent *eventPtr) /* X PropertyChange event. */
{
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */