summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-06-12 23:39:14 (GMT)
committerhobbs <hobbs>2002-06-12 23:39:14 (GMT)
commit1f8f56c938ebe9865f17d61ef79173662698fc2f (patch)
tree6f506d3e6e438d226d39a9c2e9c43c98e335207a
parentd93faece0c5e133efc224a7780b3748be2a69a94 (diff)
downloadtk-1f8f56c938ebe9865f17d61ef79173662698fc2f.zip
tk-1f8f56c938ebe9865f17d61ef79173662698fc2f.tar.gz
tk-1f8f56c938ebe9865f17d61ef79173662698fc2f.tar.bz2
* win/tkWinCursor.c (TkGetCursorByName): reverted fix from
2002-06-06 because it broke the ability to use built-in cursors like left_ptr.
-rw-r--r--ChangeLog6
-rw-r--r--win/tkWinCursor.c71
2 files changed, 35 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 2509995..e08a90a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinCursor.c (TkGetCursorByName): reverted fix from
+ 2002-06-06 because it broke the ability to use built-in cursors
+ like left_ptr.
+
2002-06-12 Mo DeJong <mdejong@users.sourceforge.net>
* library/choosedir.tcl (tk::dialog::file::chooseDir):
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index a7e5542..a5d60db 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.7 2002/06/11 08:25:49 dkf Exp $
+ * RCS: @(#) $Id: tkWinCursor.c,v 1.8 2002/06/12 23:39:14 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -87,72 +87,59 @@ TkGetCursorByName(interp, tkwin, string)
{
struct CursorName *namePtr;
TkWinCursor *cursorPtr;
- int argc;
- CONST char **argv = NULL;
/*
- * All cursor names are valid lists of one element (for
- * Unix-compatability), even unadorned system cursor names.
+ * Check for the cursor in the system cursor set.
*/
- if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
- return NULL;
- }
- if (argc != 1) {
- ckfree((char *) argv);
- goto badCursorSpec;
+ for (namePtr = cursorNames; namePtr->name != NULL; namePtr++) {
+ if (strcmp(namePtr->name, string) == 0) {
+ break;
+ }
}
cursorPtr = (TkWinCursor *) ckalloc(sizeof(TkWinCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursorPtr;
cursorPtr->winCursor = NULL;
-
- if (argv[0][0] == '@') {
+ if (namePtr->name != NULL) {
+ cursorPtr->winCursor = LoadCursor(NULL, namePtr->id);
+ cursorPtr->system = 1;
+ }
+ if (cursorPtr->winCursor == NULL) {
+ cursorPtr->winCursor = LoadCursor(Tk_GetHINSTANCE(), string);
+ cursorPtr->system = 0;
+ }
+ if (string[0] == '@') {
+ int argc;
+ CONST 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 any of:
+ * 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}
- * -cursor {{@C:/Program Files/Cursors/bart.ani}}
- * -cursor [list @[file join "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);
+ ckfree((char *)cursorPtr);
return NULL;
}
cursorPtr->winCursor = LoadCursorFromFile(&(argv[0][1]));
cursorPtr->system = 0;
- } else {
- /*
- * Check for the cursor in the system cursor set.
- */
-
- for (namePtr = cursorNames; namePtr->name != NULL; namePtr++) {
- if (strcmp(namePtr->name, argv[0]) == 0) {
- /*
- * It is either a system cursor or one of ours!
- */
- cursorPtr->winCursor = LoadCursor(NULL, namePtr->id);
- if (cursorPtr->winCursor == NULL) {
- cursorPtr->winCursor =
- LoadCursor(Tk_GetHINSTANCE(), argv[0]);
- cursorPtr->system = 0;
- } else {
- cursorPtr->system = 1;
- }
- }
- }
+ ckfree((char *) argv);
}
- ckfree((char *) argv);
-
if (cursorPtr->winCursor == NULL) {
- badCursorSpec:
- ckfree((char *) cursorPtr);
+ badCursorSpec:
+ ckfree((char *)cursorPtr);
Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
(char *) NULL);
return NULL;