diff options
| author | Joakim Verona | 2013-09-11 15:47:14 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-09-11 15:47:14 +0200 |
| commit | 6070fc71f3af2a40bc3402ac387665fa713fa8e5 (patch) | |
| tree | df34ebdfa5b1bb6ca59fa248d54e78444fd015f7 /src | |
| parent | 0b086327ccb086dadf737286ffd54d5418e181c4 (diff) | |
| parent | 927eec55795f20df2e4817e4678939a108325012 (diff) | |
| download | emacs-6070fc71f3af2a40bc3402ac387665fa713fa8e5.tar.gz emacs-6070fc71f3af2a40bc3402ac387665fa713fa8e5.zip | |
merge from trunk
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 e47d9701229..3f9ccdcb1d6 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 e317b66d0fe..322bacf2332 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -4090,10 +4090,6 @@ static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *, | |||
| 4090 | 4090 | ||
| 4091 | static Lisp_Object window_being_scrolled; | 4091 | static Lisp_Object window_being_scrolled; |
| 4092 | 4092 | ||
| 4093 | /* Last scroll bar part sent in xm_scroll_callback. */ | ||
| 4094 | |||
| 4095 | static int last_scroll_bar_part; | ||
| 4096 | |||
| 4097 | /* Whether this is an Xaw with arrow-scrollbars. This should imply | 4093 | /* Whether this is an Xaw with arrow-scrollbars. This should imply |
| 4098 | that movements of 1/20 of the screen size are mapped to up/down. */ | 4094 | that movements of 1/20 of the screen size are mapped to up/down. */ |
| 4099 | 4095 | ||
| @@ -4135,20 +4131,23 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name, | |||
| 4135 | && WINDOWP (window_being_scrolled)) | 4131 | && WINDOWP (window_being_scrolled)) |
| 4136 | { | 4132 | { |
| 4137 | struct window *w; | 4133 | struct window *w; |
| 4134 | struct scroll_bar *bar; | ||
| 4138 | 4135 | ||
| 4139 | x_send_scroll_bar_event (window_being_scrolled, | 4136 | x_send_scroll_bar_event (window_being_scrolled, |
| 4140 | scroll_bar_end_scroll, 0, 0); | 4137 | scroll_bar_end_scroll, 0, 0); |
| 4141 | w = XWINDOW (window_being_scrolled); | 4138 | w = XWINDOW (window_being_scrolled); |
| 4139 | bar = XSCROLL_BAR (w->vertical_scroll_bar); | ||
| 4142 | 4140 | ||
| 4143 | if (XSCROLL_BAR (w->vertical_scroll_bar)->dragging != -1) | 4141 | if (bar->dragging != -1) |
| 4144 | { | 4142 | { |
| 4145 | XSCROLL_BAR (w->vertical_scroll_bar)->dragging = -1; | 4143 | bar->dragging = -1; |
| 4146 | /* The thumb size is incorrect while dragging: fix it. */ | 4144 | /* The thumb size is incorrect while dragging: fix it. */ |
| 4147 | set_vertical_scroll_bar (w); | 4145 | set_vertical_scroll_bar (w); |
| 4148 | } | 4146 | } |
| 4149 | window_being_scrolled = Qnil; | 4147 | window_being_scrolled = Qnil; |
| 4150 | last_scroll_bar_part = -1; | 4148 | #if defined (USE_LUCID) |
| 4151 | 4149 | bar->last_seen_part = scroll_bar_nowhere; | |
| 4150 | #endif | ||
| 4152 | /* Xt timeouts no longer needed. */ | 4151 | /* Xt timeouts no longer needed. */ |
| 4153 | toolkit_scroll_bar_interaction = 0; | 4152 | toolkit_scroll_bar_interaction = 0; |
| 4154 | } | 4153 | } |
| @@ -4332,7 +4331,6 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4332 | if (part >= 0) | 4331 | if (part >= 0) |
| 4333 | { | 4332 | { |
| 4334 | window_being_scrolled = bar->window; | 4333 | window_being_scrolled = bar->window; |
| 4335 | last_scroll_bar_part = part; | ||
| 4336 | x_send_scroll_bar_event (bar->window, part, portion, whole); | 4334 | x_send_scroll_bar_event (bar->window, part, portion, whole); |
| 4337 | } | 4335 | } |
| 4338 | } | 4336 | } |
| @@ -4393,7 +4391,6 @@ xg_scroll_callback (GtkRange *range, | |||
| 4393 | if (part >= 0) | 4391 | if (part >= 0) |
| 4394 | { | 4392 | { |
| 4395 | window_being_scrolled = bar->window; | 4393 | window_being_scrolled = bar->window; |
| 4396 | last_scroll_bar_part = part; | ||
| 4397 | x_send_scroll_bar_event (bar->window, part, portion, whole); | 4394 | x_send_scroll_bar_event (bar->window, part, portion, whole); |
| 4398 | } | 4395 | } |
| 4399 | 4396 | ||
| @@ -4435,7 +4432,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4435 | float top = *top_addr; | 4432 | float top = *top_addr; |
| 4436 | float shown; | 4433 | float shown; |
| 4437 | int whole, portion, height; | 4434 | int whole, portion, height; |
| 4438 | int part; | 4435 | enum scroll_bar_part part; |
| 4439 | 4436 | ||
| 4440 | /* Get the size of the thumb, a value between 0 and 1. */ | 4437 | /* Get the size of the thumb, a value between 0 and 1. */ |
| 4441 | block_input (); | 4438 | block_input (); |
| @@ -4457,7 +4454,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4457 | 4454 | ||
| 4458 | window_being_scrolled = bar->window; | 4455 | window_being_scrolled = bar->window; |
| 4459 | bar->dragging = portion; | 4456 | bar->dragging = portion; |
| 4460 | last_scroll_bar_part = part; | 4457 | bar->last_seen_part = part; |
| 4461 | x_send_scroll_bar_event (bar->window, part, portion, whole); | 4458 | x_send_scroll_bar_event (bar->window, part, portion, whole); |
| 4462 | } | 4459 | } |
| 4463 | 4460 | ||
| @@ -4477,7 +4474,7 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4477 | /* The position really is stored cast to a pointer. */ | 4474 | /* The position really is stored cast to a pointer. */ |
| 4478 | int position = (intptr_t) call_data; | 4475 | int position = (intptr_t) call_data; |
| 4479 | Dimension height; | 4476 | Dimension height; |
| 4480 | int part; | 4477 | enum scroll_bar_part part; |
| 4481 | 4478 | ||
| 4482 | /* Get the height of the scroll bar. */ | 4479 | /* Get the height of the scroll bar. */ |
| 4483 | block_input (); | 4480 | block_input (); |
| @@ -4496,7 +4493,7 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4496 | 4493 | ||
| 4497 | window_being_scrolled = bar->window; | 4494 | window_being_scrolled = bar->window; |
| 4498 | bar->dragging = -1; | 4495 | bar->dragging = -1; |
| 4499 | last_scroll_bar_part = part; | 4496 | bar->last_seen_part = part; |
| 4500 | x_send_scroll_bar_event (bar->window, part, position, height); | 4497 | x_send_scroll_bar_event (bar->window, part, position, height); |
| 4501 | } | 4498 | } |
| 4502 | 4499 | ||
| @@ -4806,7 +4803,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio | |||
| 4806 | NULL); | 4803 | NULL); |
| 4807 | 4804 | ||
| 4808 | /* Massage the top+shown values. */ | 4805 | /* Massage the top+shown values. */ |
| 4809 | if (bar->dragging == -1 || last_scroll_bar_part == scroll_bar_down_arrow) | 4806 | if (bar->dragging == -1 || bar->last_seen_part == scroll_bar_down_arrow) |
| 4810 | top = max (0, min (1, top)); | 4807 | top = max (0, min (1, top)); |
| 4811 | else | 4808 | else |
| 4812 | top = old_top; | 4809 | top = old_top; |
| @@ -4911,6 +4908,9 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 4911 | bar->end = 0; | 4908 | bar->end = 0; |
| 4912 | bar->dragging = -1; | 4909 | bar->dragging = -1; |
| 4913 | bar->fringe_extended_p = 0; | 4910 | bar->fringe_extended_p = 0; |
| 4911 | #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID) | ||
| 4912 | bar->last_seen_part = scroll_bar_nowhere; | ||
| 4913 | #endif | ||
| 4914 | 4914 | ||
| 4915 | /* Add bar to its frame's list of scroll bars. */ | 4915 | /* Add bar to its frame's list of scroll bars. */ |
| 4916 | bar->next = FRAME_SCROLL_BARS (f); | 4916 | 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; |