diff options
author | Markus Steinborn <gnugv_maintainer@yahoo.de> | 2012-03-01 18:07:40 +0100 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2012-03-24 21:21:16 -0700 |
commit | 39e9a67b05d4558c065aedd2ebbe6eb11d0b88de (patch) | |
tree | 7c4c5be5fc5274c000593fd9456a74900cb614fb /src/Scrollbar.c | |
parent | c3dd42dbd2aaf95d2a1d08a52d9c2e7056ef7ac9 (diff) |
Correct XtNthumbProc usage
This ugly piece of magic was copied from libXaw, and now scrollbars
will work slightly less incorrectly than they did before.
Found at http://gitorious.org/xaw3d/xaw3d/commit/4ec68aebffbdc406139f880f92b6c18b835af6d4
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'src/Scrollbar.c')
-rw-r--r-- | src/Scrollbar.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Scrollbar.c b/src/Scrollbar.c index 5667327..69c2d54 100644 --- a/src/Scrollbar.c +++ b/src/Scrollbar.c @@ -1054,7 +1054,10 @@ static void NotifyThumb (Widget w, XEvent *event, String *params, Cardinal *num_params) { register ScrollbarWidget sbw = (ScrollbarWidget) w; - float top = sbw->scrollbar.top; + union { + XtPointer xtp; + float xtf; + } xtpf; #ifndef XAW_ARROW_SCROLLBARS if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */ @@ -1065,6 +1068,8 @@ NotifyThumb (Widget w, XEvent *event, String *params, Cardinal *num_params) /* thumbProc is not pretty, but is necessary for backwards compatibility on those architectures for which it work{s,ed}; the intent is to pass a (truncated) float by value. */ + xtpf.xtf = sbw->scrollbar.top; + /* #ifdef XAW_ARROW_SCROLLBARS */ /* This corrects for rounding errors: If the thumb is moved to the end of the scrollable area sometimes the last line/column is not displayed. @@ -1083,10 +1088,11 @@ NotifyThumb (Widget w, XEvent *event, String *params, Cardinal *num_params) /* Removed the dependancy on scrollbar arrows. Xterm as distributed in X11R6.6 by The XFree86 Project wants this correction, with or without the arrows. */ - top += 0.0001; + xtpf.xtf += 0.0001; /* #endif */ - XtCallCallbacks (w, XtNthumbProc, *(XtPointer*)&top); - XtCallCallbacks (w, XtNjumpProc, (XtPointer)&top); + + XtCallCallbacks (w, XtNthumbProc, xtpf.xtp); + XtCallCallbacks (w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top); } |