diff options
Diffstat (limited to 'unix/tkUnixScrlbr.c')
-rw-r--r-- | unix/tkUnixScrlbr.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index a23bba1..122c906 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -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: tkUnixScrlbr.c,v 1.6.2.1 2009/10/07 14:31:02 dkf Exp $ + * RCS: @(#) $Id: tkUnixScrlbr.c,v 1.10 2010/06/15 11:16:02 nijtmans Exp $ */ #include "tkInt.h" @@ -38,8 +38,11 @@ typedef struct UnixScrollbar { * variable is declared at this scope. */ -Tk_ClassProcs tkpScrollbarProcs = { - sizeof(Tk_ClassProcs) /* size */ +const Tk_ClassProcs tkpScrollbarProcs = { + sizeof(Tk_ClassProcs), /* size */ + NULL, /* worldChangedProc */ + NULL, /* createProc */ + NULL /* modalProc */ }; /* @@ -62,13 +65,14 @@ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { - UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar)); + UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar)); + scrollPtr->troughGC = None; scrollPtr->copyGC = None; Tk_CreateEventHandler(tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - TkScrollbarEventProc, (ClientData) scrollPtr); + TkScrollbarEventProc, scrollPtr); return (TkScrollbar *) scrollPtr; } @@ -303,14 +307,13 @@ TkpComputeScrollbarGeometry( * grabbed with the mouse). */ - if (scrollPtr->sliderFirst > (fieldLength - MIN_SLIDER_LENGTH)) { + if (scrollPtr->sliderFirst > fieldLength - MIN_SLIDER_LENGTH) { scrollPtr->sliderFirst = fieldLength - MIN_SLIDER_LENGTH; } if (scrollPtr->sliderFirst < 0) { scrollPtr->sliderFirst = 0; } - if (scrollPtr->sliderLast < (scrollPtr->sliderFirst - + MIN_SLIDER_LENGTH)) { + if (scrollPtr->sliderLast < scrollPtr->sliderFirst + MIN_SLIDER_LENGTH) { scrollPtr->sliderLast = scrollPtr->sliderFirst + MIN_SLIDER_LENGTH; } if (scrollPtr->sliderLast > fieldLength) { @@ -406,8 +409,8 @@ TkpConfigureScrollbar( unixScrollPtr->troughGC = new; if (unixScrollPtr->copyGC == None) { gcValues.graphics_exposures = False; - unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin, GCGraphicsExposures, - &gcValues); + unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin, + GCGraphicsExposures, &gcValues); } } @@ -436,6 +439,7 @@ TkpScrollbarPosition( int x, int y) /* Coordinates within scrollPtr's window. */ { int length, width, tmp; + register const int inset = scrollPtr->inset; if (scrollPtr->vertical) { length = Tk_Height(scrollPtr->tkwin); @@ -448,8 +452,7 @@ TkpScrollbarPosition( width = Tk_Height(scrollPtr->tkwin); } - if ((x < scrollPtr->inset) || (x >= (width - scrollPtr->inset)) - || (y < scrollPtr->inset) || (y >= (length - scrollPtr->inset))) { + if (x<inset || x>=width-inset || y<inset || y>=length-inset) { return OUTSIDE; } @@ -458,7 +461,7 @@ TkpScrollbarPosition( * TkpDisplayScrollbar. Be sure to keep the two consistent. */ - if (y < (scrollPtr->inset + scrollPtr->arrowLength)) { + if (y < inset + scrollPtr->arrowLength) { return TOP_ARROW; } if (y < scrollPtr->sliderFirst) { @@ -467,7 +470,7 @@ TkpScrollbarPosition( if (y < scrollPtr->sliderLast) { return SLIDER; } - if (y >= (length - (scrollPtr->arrowLength + scrollPtr->inset))) { + if (y >= length - (scrollPtr->arrowLength + inset)) { return BOTTOM_ARROW; } return BOTTOM_GAP; |