[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117757: Some fixes for scroll bar code.
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] trunk r117757: Some fixes for scroll bar code. |
Date: |
Thu, 28 Aug 2014 06:47:27 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117757
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2014-08-28 08:46:58 +0200
message:
Some fixes for scroll bar code.
* w32term.c (w32_horizontal_scroll_bar_handle_click): In
`event->y' return entire range (the size of the scroll bar minus
that of the thumb).
* xterm.c (xm_scroll_callback, xaw_jump_callback): In `whole'
return entire range (the scaled size of the scroll bar minus
that of the slider). In `portion' return the scaled position of
the slider.
(xaw_jump_callback): Restore part of code for vertical scroll
bar broken in change from 2014-07-27.
(xaw_scroll_callback): Provide incremental scrolling with
horizontal scroll bars.
(x_scroll_bar_handle_click): Fix typo introduced in change from
2014-07-27.
* scroll-bar.el (scroll-bar-horizontal-drag-1): Handle new
interpretation of `portion-whole'.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/scroll-bar.el
scrollbar.el-20091113204419-o5vbwnq5f7feedwu-535
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/w32term.c w32term.c-20091113204419-o5vbwnq5f7feedwu-950
src/xterm.c xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-08-28 01:59:29 +0000
+++ b/lisp/ChangeLog 2014-08-28 06:46:58 +0000
@@ -1,3 +1,8 @@
+2014-08-28 Martin Rudalics <address@hidden>
+
+ * scroll-bar.el (scroll-bar-horizontal-drag-1): Handle new
+ interpretation of `portion-whole'.
+
2014-08-28 Michael Albinus <address@hidden>
* emacs-lisp/authors.el (authors-aliases): Addition.
=== modified file 'lisp/scroll-bar.el'
--- a/lisp/scroll-bar.el 2014-08-18 14:39:26 +0000
+++ b/lisp/scroll-bar.el 2014-08-28 06:46:58 +0000
@@ -330,9 +330,11 @@
(if (eq (current-bidi-paragraph-direction (window-buffer window))
'left-to-right)
(set-window-hscroll
- window (/ (1- (+ (car portion-whole) unit)) unit))
+ window (/ (+ (car portion-whole) (1- unit)) unit))
(set-window-hscroll
- window (/ (1- (+ (cdr portion-whole) unit)) unit)))))
+ window (/ (+ (- (cdr portion-whole) (car portion-whole))
+ (1- unit))
+ unit)))))
(defun scroll-bar-horizontal-drag (event)
"Scroll the window horizontally by dragging the scroll bar slider.
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-08-28 01:59:29 +0000
+++ b/src/ChangeLog 2014-08-28 06:46:58 +0000
@@ -1,3 +1,19 @@
+2014-08-28 Martin Rudalics <address@hidden>
+
+ * w32term.c (w32_horizontal_scroll_bar_handle_click): In
+ `event->y' return entire range (the size of the scroll bar minus
+ that of the thumb).
+ * xterm.c (xm_scroll_callback, xaw_jump_callback): In `whole'
+ return entire range (the scaled size of the scroll bar minus
+ that of the slider). In `portion' return the scaled position of
+ the slider.
+ (xaw_jump_callback): Restore part of code for vertical scroll
+ bar broken in change from 2014-07-27.
+ (xaw_scroll_callback): Provide incremental scrolling with
+ horizontal scroll bars.
+ (x_scroll_bar_handle_click): Fix typo introduced in change from
+ 2014-07-27.
+
2014-08-28 Eli Zaretskii <address@hidden>
* conf_post.h (_GL_EXECINFO_INLINE) [MSDOS]: Don't define.
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2014-08-20 14:41:15 +0000
+++ b/src/w32term.c 2014-08-28 06:46:58 +0000
@@ -4293,7 +4293,7 @@
x = si.nTrackPos;
else
x = si.nPos;
- y = si.nMax - x - si.nPage;
+ y = si.nMax - si.nPage;
bar->dragging = 0;
FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam;
@@ -4350,12 +4350,9 @@
int end = bar->end;
si.cbSize = sizeof (si);
-/** si.fMask = SIF_PAGE | SIF_POS; **/
si.fMask = SIF_POS;
-/** si.nPage = end - start + HORIZONTAL_SCROLL_BAR_MIN_HANDLE; **/
si.nPos = min (last_scroll_bar_drag_pos,
XWINDOW (bar->window)->hscroll_whole - 1);
-/** si.nPos = last_scroll_bar_drag_pos; **/
SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, TRUE);
}
/* fall through */
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2014-08-07 14:17:03 +0000
+++ b/src/xterm.c 2014-08-28 06:46:58 +0000
@@ -4549,12 +4549,9 @@
if (horizontal)
{
- whole = bar->whole;
- portion = (((float) cs->value
- / (XM_SB_MAX - slider_size))
- * (whole
- - ((float) slider_size / XM_SB_MAX) * whole));
- portion = max (0, portion);
+ portion = bar->whole * ((float)cs->value / XM_SB_MAX);
+ whole = bar->whole * ((float)(XM_SB_MAX - slider_size) / XM_SB_MAX);
+ portion = min (portion, whole);
part = scroll_bar_horizontal_handle;
}
else
@@ -4687,24 +4684,51 @@
float *top_addr = call_data;
float top = *top_addr;
float shown;
- int whole, portion, height;
+ int whole, portion, height, width;
enum scroll_bar_part part;
int horizontal = bar->horizontal;
- /* Get the size of the thumb, a value between 0 and 1. */
- block_input ();
- XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL);
- unblock_input ();
if (horizontal)
{
- whole = bar->whole;
- portion = (top * (whole - (shown * whole))) / (1 - shown);
- portion = max (0, portion);
+ /* Get the size of the thumb, a value between 0 and 1. */
+ block_input ();
+ XtVaGetValues (widget, XtNshown, &shown, XtNwidth, &width, NULL);
+ unblock_input ();
+
+ if (shown < 1)
+ {
+ whole = bar->whole - (shown * bar->whole);
+ portion = min (top * bar->whole, whole);
+ }
+ else
+ {
+ whole = bar->whole;
+ portion = 0;
+ }
+
part = scroll_bar_horizontal_handle;
}
else
- part = scroll_bar_handle;
+ {
+ /* Get the size of the thumb, a value between 0 and 1. */
+ block_input ();
+ XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL);
+ unblock_input ();
+
+ whole = 10000000;
+ portion = shown < 1 ? top * whole : 0;
+
+ if (shown < 1 && (eabs (top + shown - 1) < 1.0f / height))
+ /* Some derivatives of Xaw refuse to shrink the thumb when you reach
+ the bottom, so we force the scrolling whenever we see that we're
+ too close to the bottom (in x_set_toolkit_scroll_bar_thumb
+ we try to ensure that we always stay two pixels away from the
+ bottom). */
+ part = scroll_bar_down_arrow;
+ else
+ part = scroll_bar_handle;
+ }
window_being_scrolled = bar->window;
bar->dragging = portion;
@@ -4727,28 +4751,54 @@
struct scroll_bar *bar = client_data;
/* The position really is stored cast to a pointer. */
int position = (intptr_t) call_data;
- Dimension height;
+ Dimension height, width;
enum scroll_bar_part part;
- /* Get the height of the scroll bar. */
- block_input ();
- XtVaGetValues (widget, XtNheight, &height, NULL);
- unblock_input ();
-
- if (eabs (position) >= height)
- part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle;
-
- /* If Xaw3d was compiled with ARROW_SCROLLBAR,
- it maps line-movement to call_data = max(5, height/20). */
- else if (xaw3d_arrow_scroll && eabs (position) <= max (5, height / 20))
- part = (position < 0) ? scroll_bar_up_arrow : scroll_bar_down_arrow;
+ if (bar->horizontal)
+ {
+ /* Get the width of the scroll bar. */
+ block_input ();
+ XtVaGetValues (widget, XtNwidth, &width, NULL);
+ unblock_input ();
+
+ if (eabs (position) >= width)
+ part = (position < 0) ? scroll_bar_before_handle :
scroll_bar_after_handle;
+
+ /* If Xaw3d was compiled with ARROW_SCROLLBAR,
+ it maps line-movement to call_data = max(5, height/20). */
+ else if (xaw3d_arrow_scroll && eabs (position) <= max (5, width / 20))
+ part = (position < 0) ? scroll_bar_left_arrow : scroll_bar_right_arrow;
+ else
+ part = scroll_bar_move_ratio;
+
+ window_being_scrolled = bar->window;
+ bar->dragging = -1;
+ bar->last_seen_part = part;
+ x_send_scroll_bar_event (bar->window, part, position, width,
bar->horizontal);
+ }
else
- part = scroll_bar_move_ratio;
-
- window_being_scrolled = bar->window;
- bar->dragging = -1;
- bar->last_seen_part = part;
- x_send_scroll_bar_event (bar->window, part, position, height,
bar->horizontal);
+ {
+
+ /* Get the height of the scroll bar. */
+ block_input ();
+ XtVaGetValues (widget, XtNheight, &height, NULL);
+ unblock_input ();
+
+ if (eabs (position) >= height)
+ part = (position < 0) ? scroll_bar_above_handle :
scroll_bar_below_handle;
+
+ /* If Xaw3d was compiled with ARROW_SCROLLBAR,
+ it maps line-movement to call_data = max(5, height/20). */
+ else if (xaw3d_arrow_scroll && eabs (position) <= max (5, height / 20))
+ part = (position < 0) ? scroll_bar_up_arrow : scroll_bar_down_arrow;
+ else
+ part = scroll_bar_move_ratio;
+
+ window_being_scrolled = bar->window;
+ bar->dragging = -1;
+ bar->last_seen_part = part;
+ x_send_scroll_bar_event (bar->window, part, position, height,
bar->horizontal);
+ }
}
#endif /* not USE_GTK and not USE_MOTIF */
@@ -6134,7 +6184,7 @@
/* If the user has released the handle, set it to its final position. */
if (event->type == ButtonRelease && bar->dragging != -1)
{
- int new_start = - bar->dragging;
+ int new_start = y - bar->dragging;
int new_end = new_start + bar->end - bar->start;
x_scroll_bar_set_handle (bar, new_start, new_end, 0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117757: Some fixes for scroll bar code.,
Martin Rudalics <=