diff options
author | hobbs <hobbs@noemail.net> | 2000-05-17 22:44:08 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2000-05-17 22:44:08 (GMT) |
commit | 4c2d96d666b30541ecc4c2ff59765181f2374b86 (patch) | |
tree | a1f1f3a1e36f8876528e945ad7a001f84cb27b9f /generic/tkCmds.c | |
parent | 15685436d121b4c4d9493132f1fec5861fb9cd50 (diff) | |
download | tk-4c2d96d666b30541ecc4c2ff59765181f2374b86.zip tk-4c2d96d666b30541ecc4c2ff59765181f2374b86.tar.gz tk-4c2d96d666b30541ecc4c2ff59765181f2374b86.tar.bz2 |
* doc/bell.n:
* tests/bell.test:
* generic/tkCmds.c (Tk_BellObjCmd): added -nice option to
optionally avoid resetting screen saver [Bug: 4279]
FossilOrigin-Name: cca6c123ec0e97991467c71bdc843f002529ce04
Diffstat (limited to 'generic/tkCmds.c')
-rw-r--r-- | generic/tkCmds.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 9bbfba3..7c98aa6 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -6,11 +6,12 @@ * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCmds.c,v 1.13 2000/04/19 23:11:23 ericm Exp $ + * RCS: @(#) $Id: tkCmds.c,v 1.14 2000/05/17 22:44:09 hobbs Exp $ */ #include "tkPort.h" @@ -62,30 +63,42 @@ Tk_BellObjCmd(clientData, interp, objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { - static char *bellOptions[] = {"-displayof", (char *) NULL}; + static char *bellOptions[] = {"-displayof", "-nice", (char *) NULL}; + enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE }; Tk_Window tkwin = (Tk_Window) clientData; - char *displayName; - int index; + int i, index, nice = 0; - if ((objc != 1) && (objc != 3)) { - Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window?"); + if (objc > 4) { + Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window? ?-nice?"); return TCL_ERROR; } - if (objc == 3) { - if (Tcl_GetIndexFromObj(interp, objv[1], bellOptions, "option", 0, + for (i = 1; i < objc; i++) { + if (Tcl_GetIndexFromObj(interp, objv[i], bellOptions, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } - displayName = Tcl_GetStringFromObj(objv[2], (int *) NULL); - - tkwin = Tk_NameToWindow(interp, displayName, tkwin); - if (tkwin == NULL) { - return TCL_ERROR; + switch ((enum options) index) { + case TK_BELL_DISPLAYOF: + if (++i >= objc) { + Tcl_WrongNumArgs(interp, 1, objv, + "?-displayof window? ?-nice?"); + return TCL_ERROR; + } + tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), tkwin); + if (tkwin == NULL) { + return TCL_ERROR; + } + break; + case TK_BELL_NICE: + nice = 1; + break; } } XBell(Tk_Display(tkwin), 0); - XForceScreenSaver(Tk_Display(tkwin), ScreenSaverReset); + if (!nice) { + XForceScreenSaver(Tk_Display(tkwin), ScreenSaverReset); + } XFlush(Tk_Display(tkwin)); return TCL_OK; } |