-- --PART-BOUNDARY=.19610220834.ZM19154.funws230 Content-Type: text/plain; charset=us-asciiscotties:
doug had posted a concern about the wm's tkined icon flash. i made some simple changes to tkiFlash.c to correct it -- letting you have the option of it flashing or not.
it can be toggled on/off via a resource in your tkined.defaults file.
tkined.wmIconFlash: true or tkined.wmIconFlash: false
i've included the source code -- please save your old copy and verify it before changing -- it works for me on my box { sunos5.5 }. If there is a better way please let me know.
- billa
ps: of course, if you don't want any of it just change the #if 1 to #if 0.
-- ---------------------------|------------------------------- Bill Anderson | First Union / One First Union 704-383-7191 (voice) | 301 S. College Street, TW7/NC0116 email: banderso@funb.com | Charlotte, NC ----------------------------------------------------------- http://cmwww2.capmark.funb.com/~banderso/ ---------------------------|---------------------------------PART-BOUNDARY=.19610220834.ZM19154.funws230 X-Zm-Content-Name: tkiFlash.c Content-Type: text/plain ; name="tkiFlash.c" ; charset=us-ascii
/* * tkiFlash.c -- * * Some utility functions to implement flashing icons. * * Copyright (c) 1995-1996 Technical University of Braunschweig. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */
#include "tkined.h" #include "tkiPort.h"
typedef struct FlashItem { char *id; struct FlashItem *nextPtr; } FlashItem;
/* added resource for window mgr. flash */ static char* TopIconFlash = "wmIconFlash"; static FlashItem *flashList = NULL;
/* * Forward declarations for procedures defined later in this file: */
static void FlashProc _ANSI_ARGS_((ClientData clientData));
/* * The FlashProc callback flashes every object in the flashList * and calls it again if there are any jobs left. */ static char *argv[2];
static void FlashProc (clientData) ClientData clientData; { Tcl_Interp *interp = (Tcl_Interp *) clientData; Tki_Object *object; char *color; FlashItem *p; int max = 0;
Tk_Window window; Tk_Window tkwin = Tk_MainWindow(interp);
for (p = flashList; p != NULL; p = p->nextPtr) {
if (p->id == NULL) continue;
object = Tki_LookupObject (p->id); if (object == NULL) continue;
window = Tk_NameToWindow(interp, object->editor->toplevel, tkwin); if (! window) { continue; }
if (! object->editor->color) { if ((object->flash) % 2) { color = "black"; } else { color = "white"; } } else { color = object->color; if ((object->flash) % 2) { if (strcasecmp(color, "white") == 0) color = "black"; } else { color = "white"; } }
Tcl_VarEval (interp, type_to_string (object->type), "::color ", object->id, " ", color, (char *) NULL);
#if 1
if (object->editor) { /* get window manager resource to flash or not */ Tki_EditorAttribute( object->editor, interp, 1, &TopIconFlash); /* do we flash the window manager * will recognize the first character as a boolean */ if ( (*interp->result != '\0') && ( (*interp->result == 't' ) || (*interp->result == 'T' ) || (*interp->result == '1' ) ) ) { char *buf = (object->flash % 2) ? "icon" : "noicon"; Tcl_VarEval(interp, "if ![winfo ismapped ", object->editor->toplevel, "] {", "wm iconbitmap ", object->editor->toplevel, " ", buf, "}", (char *) NULL); } } #endif
object->flash -= 1;
if (object->flash == 0) { notrace (m_color, interp, object, 1, &object->color); ckfree (p->id); p->id = NULL; }
max = ( object->flash > max ) ? object->flash : max; }
if (max <= 0) { /* everything is done - remove the flashList */
FlashItem *q;
for (p = flashList; p != NULL; p = q) { q = p->nextPtr; if (p->id != NULL) ckfree (p->id); ckfree ((char *) p); }
flashList = NULL; }
Tcl_Eval (interp, "update");
if (max > 0) { Tk_CreateTimerHandler (500, FlashProc, (ClientData) interp); } }
/* * Add a new flash node to our list of flashing objects. * Start flash callback if we create the first entry. */
void flash (interp, object) Tcl_Interp *interp; Tki_Object *object; { FlashItem *p;
if (flashList == NULL) { flashList = (FlashItem *) ckalloc (sizeof(FlashItem)); p = flashList; p->id = ckstrdup(object->id); p->nextPtr = NULL; Tk_CreateTimerHandler (500, FlashProc, (ClientData) interp);
} else {
/* * Move to the end of the list and check if it exists already. */
for (p = flashList; p->nextPtr != NULL; p = p->nextPtr) { if (p->id && strcmp (p->id, object->id) == 0) return; } if (p->id && strcmp (p->id, object->id) == 0) { return; }
/* * Create a new entry for the flash list. */
p->nextPtr = (FlashItem *) ckalloc (sizeof(FlashItem)); p = p->nextPtr; p->id = ckstrdup(object->id); p->nextPtr = NULL; } }
--PART-BOUNDARY=.19610220834.ZM19154.funws230--