diff options
| author | Dmitry Antipov | 2013-09-11 17:35:28 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-09-11 17:35:28 +0400 |
| commit | 927eec55795f20df2e4817e4678939a108325012 (patch) | |
| tree | bf729258c804a3b224cf7549d84bc500444a96b0 /src | |
| parent | feeff482d80b9f37d083497b2d3a9fec8bc58757 (diff) | |
| download | emacs-927eec55795f20df2e4817e4678939a108325012.tar.gz emacs-927eec55795f20df2e4817e4678939a108325012.zip | |
Cleaning up a few X scroll bar bits.
* termhooks.h (enum scroll_bar_part): Add scroll_bar_nowhere member.
* xterm.h (struct scroll_bar) [USE_TOOLKIT_SCROLL_BARS && USE_LUCID]:
New member last_seen_part, going to replace...
* xterm.c [USE_TOOLKIT_SCROLL_BARS]: ...global last_scroll_bar_part.
(xt_action_hook) [USE_LUCID]: Adjust user.
(xm_scroll_callback, xg_scroll_callback): Do not bloat with
Lucid-specific scroll bar support.
(xaw_jump_callback, xaw_scroll_callback): Prefer enum scroll_par_part
to int and adjust to use last_seen_part member.
(x_set_toolkit_scroll_bar_thumb) [USE_LUCID]: Adjust user.
(x_scroll_bar_create) [USE_TOOLKIT_SCROLL_BARS && USE_LUCID]:
Initialize last_seen_part.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 16 | ||||
| -rw-r--r-- | src/termhooks.h | 1 | ||||
| -rw-r--r-- | src/xterm.c | 30 | ||||
| -rw-r--r-- | src/xterm.h | 5 |
4 files changed, 37 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index db08fe6aae8..41e20465d57 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2013-09-11 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Cleaning up a few X scroll bar bits. | ||
| 4 | * termhooks.h (enum scroll_bar_part): Add scroll_bar_nowhere member. | ||
| 5 | * xterm.h (struct scroll_bar) [USE_TOOLKIT_SCROLL_BARS && USE_LUCID]: | ||
| 6 | New member last_seen_part, going to replace... | ||
| 7 | * xterm.c [USE_TOOLKIT_SCROLL_BARS]: ...global last_scroll_bar_part. | ||
| 8 | (xt_action_hook) [USE_LUCID]: Adjust user. | ||
| 9 | (xm_scroll_callback, xg_scroll_callback): Do not bloat with | ||
| 10 | Lucid-specific scroll bar support. | ||
| 11 | (xaw_jump_callback, xaw_scroll_callback): Prefer enum scroll_par_part | ||
| 12 | to int and adjust to use last_seen_part member. | ||
| 13 | (x_set_toolkit_scroll_bar_thumb) [USE_LUCID]: Adjust user. | ||
| 14 | (x_scroll_bar_create) [USE_TOOLKIT_SCROLL_BARS && USE_LUCID]: | ||
| 15 | Initialize last_seen_part. | ||
| 16 | |||
| 1 | 2013-09-11 Stefan Monnier <monnier@iro.umontreal.ca> | 17 | 2013-09-11 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 18 | ||
| 3 | * insdel.c (insert_from_buffer_1): Don't mark buffer as modified when | 19 | * insdel.c (insert_from_buffer_1): Don't mark buffer as modified when |
diff --git a/src/termhooks.h b/src/termhooks.h index 77f98938edb..30ac7957317 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -31,6 +31,7 @@ INLINE_HEADER_BEGIN | |||
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | enum scroll_bar_part { | 33 | enum scroll_bar_part { |
| 34 | scroll_bar_nowhere = -1, | ||
| 34 | scroll_bar_above_handle, | 35 | scroll_bar_above_handle, |
| 35 | scroll_bar_handle, | 36 | scroll_bar_handle, |
| 36 | scroll_bar_below_handle, | 37 | scroll_bar_below_handle, |
diff --git a/src/xterm.c b/src/xterm.c index 22671a5f168..7ad790edd61 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -4081,10 +4081,6 @@ static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *, | |||
| 4081 | 4081 | ||
| 4082 | static Lisp_Object window_being_scrolled; | 4082 | static Lisp_Object window_being_scrolled; |
| 4083 | 4083 | ||
| 4084 | /* Last scroll bar part sent in xm_scroll_callback. */ | ||
| 4085 | |||
| 4086 | static int last_scroll_bar_part; | ||
| 4087 | |||
| 4088 | /* Whether this is an Xaw with arrow-scrollbars. This should imply | 4084 | /* Whether this is an Xaw with arrow-scrollbars. This should imply |
| 4089 | that movements of 1/20 of the screen size are mapped to up/down. */ | 4085 | that movements of 1/20 of the screen size are mapped to up/down. */ |
| 4090 | 4086 | ||
| @@ -4126,20 +4122,23 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name, | |||
| 4126 | && WINDOWP (window_being_scrolled)) | 4122 | && WINDOWP (window_being_scrolled)) |
| 4127 | { | 4123 | { |
| 4128 | struct window *w; | 4124 | struct window *w; |
| 4125 | struct scroll_bar *bar; | ||
| 4129 | 4126 | ||
| 4130 | x_send_scroll_bar_event (window_being_scrolled, | 4127 | x_send_scroll_bar_event (window_being_scrolled, |
| 4131 | scroll_bar_end_scroll, 0, 0); | 4128 | scroll_bar_end_scroll, 0, 0); |
| 4132 | w = XWINDOW (window_being_scrolled); | 4129 | w = XWINDOW (window_being_scrolled); |
| 4130 | bar = XSCROLL_BAR (w->vertical_scroll_bar); | ||
| 4133 | 4131 | ||
| 4134 | if (XSCROLL_BAR (w->vertical_scroll_bar)->dragging != -1) | 4132 | if (bar->dragging != -1) |
| 4135 | { | 4133 | { |
| 4136 | XSCROLL_BAR (w->vertical_scroll_bar)->dragging = -1; | 4134 | bar->dragging = -1; |
| 4137 | /* The thumb size is incorrect while dragging: fix it. */ | 4135 | /* The thumb size is incorrect while dragging: fix it. */ |
| 4138 | set_vertical_scroll_bar (w); | 4136 | set_vertical_scroll_bar (w); |
| 4139 | } | 4137 | } |
| 4140 | window_being_scrolled = Qnil; | 4138 | window_being_scrolled = Qnil; |
| 4141 | last_scroll_bar_part = -1; | 4139 | #if defined (USE_LUCID) |
| 4142 | 4140 | bar->last_seen_part = scroll_bar_nowhere; | |
| 4141 | #endif | ||
| 4143 | /* Xt timeouts no longer needed. */ | 4142 | /* Xt timeouts no longer needed. */ |
| 4144 | toolkit_scroll_bar_interaction = 0; | 4143 | toolkit_scroll_bar_interaction = 0; |
| 4145 | } | 4144 | } |
| @@ -4323,7 +4322,6 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4323 | if (part >= 0) | 4322 | if (part >= 0) |
| 4324 | { | 4323 | { |
| 4325 | window_being_scrolled = bar->window; | 4324 | window_being_scrolled = bar->window; |
| 4326 | last_scroll_bar_part = part; | ||
| 4327 | x_send_scroll_bar_event (bar->window, part, portion, whole); | 4325 | x_send_scroll_bar_event (bar->window, part, portion, whole); |
| 4328 | } | 4326 | } |
| 4329 | } | 4327 | } |
| @@ -4384,7 +4382,6 @@ xg_scroll_callback (GtkRange *range, | |||
| 4384 | if (part >= 0) | 4382 | if (part >= 0) |
| 4385 | { | 4383 | { |
| 4386 | window_being_scrolled = bar->window; | 4384 | window_being_scrolled = bar->window; |
| 4387 | last_scroll_bar_part = part; | ||
| 4388 | x_send_scroll_bar_event (bar->window, part, portion, whole); | 4385 | x_send_scroll_bar_event (bar->window, part, portion, whole); |
| 4389 | } | 4386 | } |
| 4390 | 4387 | ||
| @@ -4426,7 +4423,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4426 | float top = *top_addr; | 4423 | float top = *top_addr; |
| 4427 | float shown; | 4424 | float shown; |
| 4428 | int whole, portion, height; | 4425 | int whole, portion, height; |
| 4429 | int part; | 4426 | enum scroll_bar_part part; |
| 4430 | 4427 | ||
| 4431 | /* Get the size of the thumb, a value between 0 and 1. */ | 4428 | /* Get the size of the thumb, a value between 0 and 1. */ |
| 4432 | block_input (); | 4429 | block_input (); |
| @@ -4448,7 +4445,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4448 | 4445 | ||
| 4449 | window_being_scrolled = bar->window; | 4446 | window_being_scrolled = bar->window; |
| 4450 | bar->dragging = portion; | 4447 | bar->dragging = portion; |
| 4451 | last_scroll_bar_part = part; | 4448 | bar->last_seen_part = part; |
| 4452 | x_send_scroll_bar_event (bar->window, part, portion, whole); | 4449 | x_send_scroll_bar_event (bar->window, part, portion, whole); |
| 4453 | } | 4450 | } |
| 4454 | 4451 | ||
| @@ -4468,7 +4465,7 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4468 | /* The position really is stored cast to a pointer. */ | 4465 | /* The position really is stored cast to a pointer. */ |
| 4469 | int position = (intptr_t) call_data; | 4466 | int position = (intptr_t) call_data; |
| 4470 | Dimension height; | 4467 | Dimension height; |
| 4471 | int part; | 4468 | enum scroll_bar_part part; |
| 4472 | 4469 | ||
| 4473 | /* Get the height of the scroll bar. */ | 4470 | /* Get the height of the scroll bar. */ |
| 4474 | block_input (); | 4471 | block_input (); |
| @@ -4487,7 +4484,7 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4487 | 4484 | ||
| 4488 | window_being_scrolled = bar->window; | 4485 | window_being_scrolled = bar->window; |
| 4489 | bar->dragging = -1; | 4486 | bar->dragging = -1; |
| 4490 | last_scroll_bar_part = part; | 4487 | bar->last_seen_part = part; |
| 4491 | x_send_scroll_bar_event (bar->window, part, position, height); | 4488 | x_send_scroll_bar_event (bar->window, part, position, height); |
| 4492 | } | 4489 | } |
| 4493 | 4490 | ||
| @@ -4797,7 +4794,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio | |||
| 4797 | NULL); | 4794 | NULL); |
| 4798 | 4795 | ||
| 4799 | /* Massage the top+shown values. */ | 4796 | /* Massage the top+shown values. */ |
| 4800 | if (bar->dragging == -1 || last_scroll_bar_part == scroll_bar_down_arrow) | 4797 | if (bar->dragging == -1 || bar->last_seen_part == scroll_bar_down_arrow) |
| 4801 | top = max (0, min (1, top)); | 4798 | top = max (0, min (1, top)); |
| 4802 | else | 4799 | else |
| 4803 | top = old_top; | 4800 | top = old_top; |
| @@ -4902,6 +4899,9 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 4902 | bar->end = 0; | 4899 | bar->end = 0; |
| 4903 | bar->dragging = -1; | 4900 | bar->dragging = -1; |
| 4904 | bar->fringe_extended_p = 0; | 4901 | bar->fringe_extended_p = 0; |
| 4902 | #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID) | ||
| 4903 | bar->last_seen_part = scroll_bar_nowhere; | ||
| 4904 | #endif | ||
| 4905 | 4905 | ||
| 4906 | /* Add bar to its frame's list of scroll bars. */ | 4906 | /* Add bar to its frame's list of scroll bars. */ |
| 4907 | bar->next = FRAME_SCROLL_BARS (f); | 4907 | bar->next = FRAME_SCROLL_BARS (f); |
diff --git a/src/xterm.h b/src/xterm.h index 883a249629d..f4a2d4c01b2 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -801,6 +801,11 @@ struct scroll_bar | |||
| 801 | being dragged, this is -1. */ | 801 | being dragged, this is -1. */ |
| 802 | int dragging; | 802 | int dragging; |
| 803 | 803 | ||
| 804 | #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID) | ||
| 805 | /* Last scroll bar part seen in xaw_jump_callback and xaw_scroll_callback. */ | ||
| 806 | enum scroll_bar_part last_seen_part; | ||
| 807 | #endif | ||
| 808 | |||
| 804 | /* 1 if the background of the fringe that is adjacent to a scroll | 809 | /* 1 if the background of the fringe that is adjacent to a scroll |
| 805 | bar is extended to the gap between the fringe and the bar. */ | 810 | bar is extended to the gap between the fringe and the bar. */ |
| 806 | unsigned fringe_extended_p : 1; | 811 | unsigned fringe_extended_p : 1; |