diff options
| author | Martin Rudalics | 2014-08-16 17:47:38 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2014-08-16 17:47:38 +0200 |
| commit | 266821b087057c25c5f7169d832b0bdc8b8a0aa5 (patch) | |
| tree | 85b58a3f30f4bb732a65659eaa7ddef87fb10cab /src | |
| parent | ed30c57cc9cdcf8ddc169f4b042146db9b3b7179 (diff) | |
| download | emacs-266821b087057c25c5f7169d832b0bdc8b8a0aa5.tar.gz emacs-266821b087057c25c5f7169d832b0bdc8b8a0aa5.zip | |
Preliminary attempt to fix horizontal scroll bar dragging with bidi text.
* w32term.c (w32_horizontal_scroll_bar_handle_click): In y part
of emacs_event return length from si.nPage to si.nMax.
* xdisp.c (set_horizontal_scroll_bar): For right-to-left text
interchange start and end of thumb.
* scroll-bar.el (scroll-bar-horizontal-drag-1): Use cdr of
portion-whole for scrolling right-to-left text.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/w32term.c | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 29 |
3 files changed, 31 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 91b72e479d7..8e6e75e8b53 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-08-16 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * w32term.c (w32_horizontal_scroll_bar_handle_click): In y part | ||
| 4 | of emacs_event return length from si.nPage to si.nMax. | ||
| 5 | * xdisp.c (set_horizontal_scroll_bar): For right-to-left text | ||
| 6 | interchange start and end of thumb. | ||
| 7 | |||
| 1 | 2014-08-15 Ken Brown <kbrown@cornell.edu> | 8 | 2014-08-15 Ken Brown <kbrown@cornell.edu> |
| 2 | 9 | ||
| 3 | * gmalloc.c (_malloc_mutex, _aligned_blocks_mutex) [CYGWIN]: Use | 10 | * gmalloc.c (_malloc_mutex, _aligned_blocks_mutex) [CYGWIN]: Use |
diff --git a/src/w32term.c b/src/w32term.c index dfda29fb903..4eff5ab4cdd 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -4272,15 +4272,15 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, | |||
| 4272 | 4272 | ||
| 4273 | { | 4273 | { |
| 4274 | int left_range = HORIZONTAL_SCROLL_BAR_LEFT_RANGE (f, bar->width); | 4274 | int left_range = HORIZONTAL_SCROLL_BAR_LEFT_RANGE (f, bar->width); |
| 4275 | int x; | 4275 | int x, y; |
| 4276 | int dragging = bar->dragging; | 4276 | int dragging = bar->dragging; |
| 4277 | SCROLLINFO si; | 4277 | SCROLLINFO si; |
| 4278 | 4278 | ||
| 4279 | si.cbSize = sizeof (si); | 4279 | si.cbSize = sizeof (si); |
| 4280 | si.fMask = SIF_POS; | 4280 | si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE; |
| 4281 | |||
| 4282 | GetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si); | 4281 | GetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si); |
| 4283 | x = si.nPos; | 4282 | x = si.nPos; |
| 4283 | y = si.nMax - si.nPos - si.nPage; | ||
| 4284 | 4284 | ||
| 4285 | bar->dragging = 0; | 4285 | bar->dragging = 0; |
| 4286 | FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam; | 4286 | FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam; |
| @@ -4354,7 +4354,7 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, | |||
| 4354 | } | 4354 | } |
| 4355 | 4355 | ||
| 4356 | XSETINT (emacs_event->x, x); | 4356 | XSETINT (emacs_event->x, x); |
| 4357 | XSETINT (emacs_event->y, left_range); | 4357 | XSETINT (emacs_event->y, y); |
| 4358 | 4358 | ||
| 4359 | return TRUE; | 4359 | return TRUE; |
| 4360 | } | 4360 | } |
diff --git a/src/xdisp.c b/src/xdisp.c index fe16b2c6a07..c46b4159de0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -15779,7 +15779,7 @@ set_vertical_scroll_bar (struct window *w) | |||
| 15779 | void | 15779 | void |
| 15780 | set_horizontal_scroll_bar (struct window *w) | 15780 | set_horizontal_scroll_bar (struct window *w) |
| 15781 | { | 15781 | { |
| 15782 | int start, end, whole, box_width; | 15782 | int start, end, whole, portion; |
| 15783 | 15783 | ||
| 15784 | if (!MINI_WINDOW_P (w) | 15784 | if (!MINI_WINDOW_P (w) |
| 15785 | || (w == XWINDOW (minibuf_window) | 15785 | || (w == XWINDOW (minibuf_window) |
| @@ -15806,14 +15806,25 @@ set_horizontal_scroll_bar (struct window *w) | |||
| 15806 | MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); */ | 15806 | MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); */ |
| 15807 | 15807 | ||
| 15808 | start = w->hscroll * FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)); | 15808 | start = w->hscroll * FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)); |
| 15809 | box_width = window_box_width (w, TEXT_AREA); | 15809 | end = start + window_box_width (w, TEXT_AREA); |
| 15810 | end = start + box_width; | 15810 | portion = end - start; |
| 15811 | /* After enlarging a horizontally scrolled window such that it | ||
| 15812 | gets at least as wide as the text it contains, make sure that | ||
| 15813 | the thumb doesn't fill the entire scroll bar so we can still | ||
| 15814 | drag it back to see the entire text. */ | ||
| 15815 | whole = max (whole, end); | ||
| 15811 | 15816 | ||
| 15812 | /* The following is needed to ensure that if after maximizing a | 15817 | if (it.bidi_p) |
| 15813 | window we get hscroll > 0, we can still drag the thumb to the | 15818 | { |
| 15814 | left. */ | 15819 | Lisp_Object pdir; |
| 15815 | whole = max (whole, w->hscroll + box_width); | 15820 | |
| 15816 | whole = max (whole, end - start); | 15821 | pdir = Fcurrent_bidi_paragraph_direction (Qnil); |
| 15822 | if (EQ (pdir, Qright_to_left)) | ||
| 15823 | { | ||
| 15824 | start = whole - end; | ||
| 15825 | end = start + portion; | ||
| 15826 | } | ||
| 15827 | } | ||
| 15817 | 15828 | ||
| 15818 | if (old_buffer) | 15829 | if (old_buffer) |
| 15819 | set_buffer_internal (old_buffer); | 15830 | set_buffer_internal (old_buffer); |
| @@ -15826,7 +15837,7 @@ set_horizontal_scroll_bar (struct window *w) | |||
| 15826 | /* Indicate what this scroll bar ought to be displaying now. */ | 15837 | /* Indicate what this scroll bar ought to be displaying now. */ |
| 15827 | if (FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook) | 15838 | if (FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook) |
| 15828 | (*FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook) | 15839 | (*FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook) |
| 15829 | (w, end - start, whole, start); | 15840 | (w, portion, whole, start); |
| 15830 | } | 15841 | } |
| 15831 | 15842 | ||
| 15832 | 15843 | ||