summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>1999-12-16 21:59:35 (GMT)
committerhobbs <hobbs@noemail.net>1999-12-16 21:59:35 (GMT)
commitc92300e38ba9e522dbb1f486bf865a7fe8176be7 (patch)
tree430ef5d08bf9e4fa76ad95f77476a11e1130e693
parent9224853436ab88137d142091b56b33b0d37e6952 (diff)
downloadtk-c92300e38ba9e522dbb1f486bf865a7fe8176be7.zip
tk-c92300e38ba9e522dbb1f486bf865a7fe8176be7.tar.gz
tk-c92300e38ba9e522dbb1f486bf865a7fe8176be7.tar.bz2
* win/tkWinCursor.c: added support for Windows cursors to
TkGetCursorByName (.ani, .cur) using -cursor @<filename> (Ascher) [Bug: 1350] * win/tkWinWm.c: fixed 'wm deiconify' to update position of the toplevel if event is waiting before mapping. (Mao) [Bug: 3687] This removes the need for 'update idle' before 'wm deiconify' on Windows. FossilOrigin-Name: e7aa2a517ac9d86186daa5274230776997172f85
-rw-r--r--win/tkWinCursor.c31
-rw-r--r--win/tkWinFont.c8
-rw-r--r--win/tkWinWm.c13
3 files changed, 46 insertions, 6 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);
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 7680b97..74c9739 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinFont.c,v 1.5 1999/04/16 01:51:51 stanton Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.6 1999/12/16 21:59:35 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -657,7 +657,7 @@ Tk_MeasureChars(
p - source, &runString);
(*familyPtr->getTextExtentPoint32Proc)(hdc,
Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
+ Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
curX += size.cx;
Tcl_DStringFree(&runString);
@@ -685,7 +685,7 @@ Tk_MeasureChars(
FontFamily *familyPtr;
SubFont *thisSubFontPtr;
CONST char *term, *end, *p, *next;
- int newX, termX, sawNonSpace, srcRead, dstWrote;
+ int newX, termX, sawNonSpace, dstWrote;
/*
* How many chars will fit in the space allotted?
@@ -717,7 +717,7 @@ Tk_MeasureChars(
}
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p,
- 0, NULL, buf, sizeof(buf), &srcRead, &dstWrote, NULL);
+ 0, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL);
(*familyPtr->getTextExtentPoint32Proc)(hdc, buf,
dstWrote >> familyPtr->isWideFont, &size);
newX += size.cx;
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 09f497a..9b60c25 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinWm.c,v 1.11 1999/09/21 06:43:06 hobbs Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.12 1999/12/16 21:59:35 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -1389,6 +1389,17 @@ Tk_WmCmd(clientData, interp, argc, argv)
": it is an embedded window", (char *) NULL);
return TCL_ERROR;
}
+ /*
+ * If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may
+ * need to be called first to update a withdrew toplevel's geometry
+ * before it is deiconified by TkpWmSetState.
+ * UpdateGeometryInfo has no effect on an iconified toplevel.
+ */
+ if (wmPtr->flags & WM_UPDATE_PENDING) {
+ Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ UpdateGeometryInfo((ClientData) winPtr);
+ }
+
TkpWmSetState(winPtr, NormalState);
/*
* Follow Windows-like style here: