diff options
Diffstat (limited to 'unix/tkUnixScrlbr.c')
-rw-r--r-- | unix/tkUnixScrlbr.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index 1e70925..0507211 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -36,8 +36,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 */ }; /* @@ -60,13 +63,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; } @@ -301,14 +305,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) { @@ -404,8 +407,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); } } @@ -434,6 +437,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); @@ -446,8 +450,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; } @@ -456,7 +459,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) { @@ -465,7 +468,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; |