summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixScrlbr.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-12-09 23:21:48 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-12-09 23:21:48 (GMT)
commit0230a88f1896a7fd9ce09fd0056808c0174143a8 (patch)
treea8e0d3ea10a8a1b58ffcb4caf103cb2fbe96c353 /unix/tkUnixScrlbr.c
parent5047348226a79fd03e452d6dcbd27c751f857669 (diff)
downloadtk-0230a88f1896a7fd9ce09fd0056808c0174143a8.zip
tk-0230a88f1896a7fd9ce09fd0056808c0174143a8.tar.gz
tk-0230a88f1896a7fd9ce09fd0056808c0174143a8.tar.bz2
minor improvements
Diffstat (limited to 'unix/tkUnixScrlbr.c')
-rw-r--r--unix/tkUnixScrlbr.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index beef224..bf210e2 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 2007/12/13 15:28:51 dgp Exp $
+ * RCS: @(#) $Id: tkUnixScrlbr.c,v 1.7 2008/12/09 23:21:48 dkf Exp $
*/
#include "tkInt.h"
@@ -62,7 +62,9 @@ TkScrollbar *
TkpCreateScrollbar(
Tk_Window tkwin)
{
- UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar));
+ UnixScrollbar *scrollPtr = (UnixScrollbar *)
+ ckalloc(sizeof(UnixScrollbar));
+
scrollPtr->troughGC = None;
scrollPtr->copyGC = None;
@@ -406,8 +408,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 +438,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 +451,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 +460,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 +469,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;