summaryrefslogtreecommitdiffstats
path: root/win/tkWinCursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinCursor.c')
-rw-r--r--win/tkWinCursor.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index 2dfba03..0d200e0 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinCursor.c,v 1.3 1999/04/16 01:51:50 stanton Exp $
+ * RCS: @(#) $Id: tkWinCursor.c,v 1.4 1999/12/16 21:59:35 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -109,7 +109,36 @@ TkGetCursorByName(interp, tkwin, string)
cursorPtr->winCursor = LoadCursor(Tk_GetHINSTANCE(), string);
cursorPtr->system = 0;
}
+ if (string[0] == '@') {
+ int argc;
+ char **argv = NULL;
+ if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
+ return NULL;
+ }
+ /*
+ * Check for system cursor of type @<filename>, where only
+ * the name is allowed. This accepts either:
+ * -cursor @/winnt/cursors/globe.ani
+ * -cursor @C:/Winnt/cursors/E_arrow.cur
+ * -cursor {@C:/Program\ Files/Cursors/bart.ani}
+ */
+ if ((argc != 1) || (argv[0][0] != '@')) {
+ ckfree((char *) argv);
+ goto badCursorSpec;
+ }
+ if (Tcl_IsSafe(interp)) {
+ Tcl_AppendResult(interp, "can't get cursor from a file in",
+ " a safe interpreter", (char *) NULL);
+ ckfree((char *) argv);
+ ckfree((char *)cursorPtr);
+ return NULL;
+ }
+ cursorPtr->winCursor = LoadCursorFromFile(&(argv[0][1]));
+ cursorPtr->system = 0;
+ ckfree((char *) argv);
+ }
if (cursorPtr->winCursor == NULL) {
+ badCursorSpec:
ckfree((char *)cursorPtr);
Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
(char *) NULL);