* This file provides procedures that implement grabs for Tk.
*
* Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "tkPort.h"
#include "tkInt.h"
+#if !defined(__WIN32__) && !defined(MAC_TCL)
+#include "tkUnixInt.h"
+#endif
+
/*
* The grab state machine has four states: ungrabbed, button pressed,
* grabbed, and button pressed while grabbed. In addition, there are
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (dispPtr->eventualGrabWinPtr != NULL) {
- interp->result = dispPtr->eventualGrabWinPtr->pathName;
+ Tcl_SetResult(interp, dispPtr->eventualGrabWinPtr->pathName,
+ TCL_STATIC);
}
} else {
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
if (dispPtr->eventualGrabWinPtr != NULL) {
Tcl_AppendElement(interp,
}
dispPtr = winPtr->dispPtr;
if (dispPtr->eventualGrabWinPtr != winPtr) {
- interp->result = "none";
+ Tcl_SetResult(interp, "none", TCL_STATIC);
} else if (dispPtr->grabFlags & GRAB_GLOBAL) {
- interp->result = "global";
+ Tcl_SetResult(interp, "global", TCL_STATIC);
} else {
- interp->result = "local";
+ Tcl_SetResult(interp, "local", TCL_STATIC);
}
} else {
Tcl_AppendResult(interp, "unknown or ambiguous option \"", argv[1],
* Results:
* A standard Tcl result is returned. TCL_OK is the normal return
* value; if the grab could not be set then TCL_ERROR is returned
- * and interp->result will hold an error message.
+ * and the interp's result will hold an error message.
*
* Side effects:
* Once this call completes successfully, no window outside the
}
if (dispPtr->eventualGrabWinPtr->mainPtr != winPtr->mainPtr) {
alreadyGrabbed:
- interp->result = "grab failed: another application has grab";
+ Tcl_SetResult(interp, "grab failed: another application has grab",
+ TCL_STATIC);
return TCL_ERROR;
}
Tk_Ungrab((Tk_Window) dispPtr->eventualGrabWinPtr);
if (grabResult != 0) {
grabError:
if (grabResult == GrabNotViewable) {
- interp->result = "grab failed: window not viewable";
+ Tcl_SetResult(interp, "grab failed: window not viewable",
+ TCL_STATIC);
} else if (grabResult == AlreadyGrabbed) {
goto alreadyGrabbed;
} else if (grabResult == GrabFrozen) {
- interp->result = "grab failed: keyboard or pointer frozen";
+ Tcl_SetResult(interp,
+ "grab failed: keyboard or pointer frozen", TCL_STATIC);
} else if (grabResult == GrabInvalidTime) {
- interp->result = "grab failed: invalid time";
+ Tcl_SetResult(interp, "grab failed: invalid time",
+ TCL_STATIC);
} else {
- char msg[100];
+ char msg[64 + TCL_INTEGER_SPACE];
sprintf(msg, "grab failed for unknown reason (code %d)",
grabResult);
return TkPositionInTree(winPtr, grabWinPtr);
}
+