diff options
author | jingham <jingham@noemail.net> | 1999-08-10 05:04:44 (GMT) |
---|---|---|
committer | jingham <jingham@noemail.net> | 1999-08-10 05:04:44 (GMT) |
commit | c582bf35bf20084065646debe5530181755dd44e (patch) | |
tree | 7316e518597bb3d84ce7a7a7cabcf5b05832add8 /generic | |
parent | 961a6ba6f98f8f6bbb1f1654697976bd4771cc6d (diff) | |
download | tk-c582bf35bf20084065646debe5530181755dd44e.zip tk-c582bf35bf20084065646debe5530181755dd44e.tar.gz tk-c582bf35bf20084065646debe5530181755dd44e.tar.bz2 |
New Function: TkpDrawHighlightBorder. Use this in place of Tk_DrawFocusHighlight. The latter did not work on the Mac, since you need to know both foreground & background color when you draw the active focus ring.
FossilOrigin-Name: 9bb078186f93162afcdcd453066e44b705aa8186
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkCanvas.c | 17 | ||||
-rw-r--r-- | generic/tkEntry.c | 13 | ||||
-rw-r--r-- | generic/tkFrame.c | 15 | ||||
-rw-r--r-- | generic/tkInt.decls | 7 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 11 | ||||
-rw-r--r-- | generic/tkListbox.c | 13 | ||||
-rw-r--r-- | generic/tkMessage.c | 14 | ||||
-rw-r--r-- | generic/tkStubInit.c | 3 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 16 |
9 files changed, 69 insertions, 40 deletions
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 40f3555..a184769 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.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: tkCanvas.c,v 1.6 1999/04/21 21:53:24 rjohnson Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.7 1999/08/10 05:05:20 jingham Exp $ */ #include "default.h" @@ -1839,17 +1839,20 @@ DisplayCanvas(clientData) canvasPtr->borderWidth, canvasPtr->relief); } if (canvasPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + + bgGC = Tk_GCForColor(canvasPtr->highlightColorPtr, + Tk_WindowId(tkwin)); if (canvasPtr->textInfo.gotFocus) { - gc = Tk_GCForColor(canvasPtr->highlightColorPtr, + fgGC = Tk_GCForColor(canvasPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, canvasPtr->highlightWidth, + Tk_WindowId(tkwin)); } else { - gc = Tk_GCForColor(canvasPtr->highlightBgColorPtr, - Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, canvasPtr->highlightWidth, + Tk_WindowId(tkwin)); } - Tk_DrawFocusHighlight(tkwin, gc, canvasPtr->highlightWidth, - Tk_WindowId(tkwin)); } } diff --git a/generic/tkEntry.c b/generic/tkEntry.c index fb3af5e..fd46cb3 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.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: tkEntry.c,v 1.4 1999/04/24 01:50:47 stanton Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.5 1999/08/10 05:05:48 jingham Exp $ */ #include "tkInt.h" @@ -1405,14 +1405,17 @@ DisplayEntry(clientData) entryPtr->borderWidth, entryPtr->relief); } if (entryPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, pixmap); if (entryPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap); + fgGC = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, + entryPtr->highlightWidth, pixmap); } else { - gc = Tk_GCForColor(entryPtr->highlightBgColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, + entryPtr->highlightWidth, pixmap); } - Tk_DrawFocusHighlight(tkwin, gc, entryPtr->highlightWidth, pixmap); } /* diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 9bdee9a..9284deb 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.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: tkFrame.c,v 1.3 1999/04/16 01:51:14 stanton Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.4 1999/08/10 05:06:01 jingham Exp $ */ #include "default.h" @@ -694,7 +694,6 @@ DisplayFrame(clientData) { register Frame *framePtr = (Frame *) clientData; register Tk_Window tkwin = framePtr->tkwin; - GC gc; framePtr->flags &= ~REDRAW_PENDING; if ((framePtr->tkwin == NULL) || !Tk_IsMapped(tkwin) @@ -711,15 +710,19 @@ DisplayFrame(clientData) framePtr->borderWidth, framePtr->relief); } if (framePtr->highlightWidth != 0) { + GC fgGC, bgGC; + + bgGC = Tk_GCForColor(framePtr->highlightBgColorPtr, + Tk_WindowId(tkwin)); if (framePtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(framePtr->highlightColorPtr, + fgGC = Tk_GCForColor(framePtr->highlightColorPtr, + Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, framePtr->highlightWidth, Tk_WindowId(tkwin)); } else { - gc = Tk_GCForColor(framePtr->highlightBgColorPtr, + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, framePtr->highlightWidth, Tk_WindowId(tkwin)); } - Tk_DrawFocusHighlight(tkwin, gc, framePtr->highlightWidth, - Tk_WindowId(tkwin)); } } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 0ab34b2..ed501e5 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tkInt.decls,v 1.9 1999/07/31 03:36:49 hobbs Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.10 1999/08/10 05:06:14 jingham Exp $ library tk @@ -610,7 +610,10 @@ declare 134 mac { int width, int height, int flags) } - +declare 135 generic { + void TkpDrawHighlightBorder (Tk_Window tkwin, GC fgGC, GC bgGC, \ + int highlightWidth, Drawable drawable) +} ############################################################################## diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 8019da4..8aa82f7 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -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: tkIntDecls.h,v 1.6 1999/05/25 01:31:05 stanton Exp $ + * RCS: @(#) $Id: tkIntDecls.h,v 1.7 1999/08/10 05:06:26 jingham Exp $ */ #ifndef _TKINTDECLS @@ -499,6 +499,10 @@ EXTERN void TkGenWMConfigureEvent _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); #endif /* MAC_TCL */ +/* 135 */ +EXTERN void TkpDrawHighlightBorder _ANSI_ARGS_((Tk_Window tkwin, + GC fgGC, GC bgGC, int highlightWidth, + Drawable drawable)); typedef struct TkIntStubs { int magic; @@ -799,6 +803,7 @@ typedef struct TkIntStubs { #ifdef MAC_TCL void (*tkGenWMConfigureEvent) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); /* 134 */ #endif /* MAC_TCL */ + void (*tkpDrawHighlightBorder) _ANSI_ARGS_((Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable)); /* 135 */ } TkIntStubs; #ifdef __cplusplus @@ -1431,6 +1436,10 @@ extern TkIntStubs *tkIntStubsPtr; (tkIntStubsPtr->tkGenWMConfigureEvent) /* 134 */ #endif #endif /* MAC_TCL */ +#ifndef TkpDrawHighlightBorder +#define TkpDrawHighlightBorder \ + (tkIntStubsPtr->tkpDrawHighlightBorder) /* 135 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 241c05b..487ba3b 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.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: tkListbox.c,v 1.3 1999/04/16 01:51:19 stanton Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.4 1999/08/10 05:06:47 jingham Exp $ */ #include "tkPort.h" @@ -1272,14 +1272,17 @@ DisplayListbox(clientData) Tk_Height(tkwin) - 2*listPtr->highlightWidth, listPtr->borderWidth, listPtr->relief); if (listPtr->highlightWidth > 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(listPtr->highlightBgColorPtr, pixmap); if (listPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(listPtr->highlightColorPtr, pixmap); + fgGC = Tk_GCForColor(listPtr->highlightColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, + listPtr->highlightWidth, pixmap); } else { - gc = Tk_GCForColor(listPtr->highlightBgColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, + listPtr->highlightWidth, pixmap); } - Tk_DrawFocusHighlight(tkwin, gc, listPtr->highlightWidth, pixmap); } XCopyArea(listPtr->display, pixmap, Tk_WindowId(tkwin), listPtr->textGC, 0, 0, (unsigned) Tk_Width(tkwin), diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 3f7a4e7..4001ac2 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.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: tkMessage.c,v 1.3 1999/04/16 01:51:20 stanton Exp $ + * RCS: @(#) $Id: tkMessage.c,v 1.4 1999/08/10 05:06:59 jingham Exp $ */ #include "tkPort.h" @@ -670,15 +670,17 @@ DisplayMessage(clientData) msgPtr->borderWidth, msgPtr->relief); } if (msgPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (msgPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(msgPtr->highlightColorPtr, Tk_WindowId(tkwin)); + fgGC = Tk_GCForColor(msgPtr->highlightColorPtr, Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, msgPtr->highlightWidth, + Tk_WindowId(tkwin)); } else { - gc = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, msgPtr->highlightWidth, + Tk_WindowId(tkwin)); } - Tk_DrawFocusHighlight(tkwin, gc, msgPtr->highlightWidth, - Tk_WindowId(tkwin)); } } diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 3fd720f..c020383 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.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: tkStubInit.c,v 1.10 1999/07/31 03:36:49 hobbs Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.11 1999/08/10 05:07:06 jingham Exp $ */ #include "tkInt.h" @@ -337,6 +337,7 @@ TkIntStubs tkIntStubs = { #ifdef MAC_TCL TkGenWMConfigureEvent, /* 134 */ #endif /* MAC_TCL */ + TkpDrawHighlightBorder, /* 135 */ }; TkIntPlatStubs tkIntPlatStubs = { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 486f167..90b1bd2 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.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: tkTextDisp.c,v 1.6 1999/04/21 21:53:28 rjohnson Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.7 1999/08/10 05:07:36 jingham Exp $ */ #include "tkPort.h" @@ -2241,17 +2241,19 @@ DisplayText(clientData) Tk_Height(textPtr->tkwin) - 2*textPtr->highlightWidth, textPtr->borderWidth, textPtr->relief); if (textPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(textPtr->highlightBgColorPtr, + Tk_WindowId(textPtr->tkwin)); if (textPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(textPtr->highlightColorPtr, + fgGC = Tk_GCForColor(textPtr->highlightColorPtr, Tk_WindowId(textPtr->tkwin)); + TkpDrawHighlightBorder(textPtr->tkwin, fgGC, bgGC, + textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin)); } else { - gc = Tk_GCForColor(textPtr->highlightBgColorPtr, - Tk_WindowId(textPtr->tkwin)); + TkpDrawHighlightBorder(textPtr->tkwin, bgGC, bgGC, + textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin)); } - Tk_DrawFocusHighlight(textPtr->tkwin, gc, textPtr->highlightWidth, - Tk_WindowId(textPtr->tkwin)); } borders = textPtr->borderWidth + textPtr->highlightWidth; if (textPtr->padY > 0) { |