Commit 927eec55 authored by Dmitry Antipov's avatar Dmitry Antipov

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.
parent feeff482
2013-09-11 Dmitry Antipov <dmantipov@yandex.ru>
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.
2013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
* insdel.c (insert_from_buffer_1): Don't mark buffer as modified when
......
......@@ -31,6 +31,7 @@ INLINE_HEADER_BEGIN
#endif
enum scroll_bar_part {
scroll_bar_nowhere = -1,
scroll_bar_above_handle,
scroll_bar_handle,
scroll_bar_below_handle,
......
......@@ -4081,10 +4081,6 @@ static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *,
static Lisp_Object window_being_scrolled;
/* Last scroll bar part sent in xm_scroll_callback. */
static int last_scroll_bar_part;
/* Whether this is an Xaw with arrow-scrollbars. This should imply
that movements of 1/20 of the screen size are mapped to up/down. */
......@@ -4126,20 +4122,23 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name,
&& WINDOWP (window_being_scrolled))
{
struct window *w;
struct scroll_bar *bar;
x_send_scroll_bar_event (window_being_scrolled,
scroll_bar_end_scroll, 0, 0);
w = XWINDOW (window_being_scrolled);
bar = XSCROLL_BAR (w->vertical_scroll_bar);
if (XSCROLL_BAR (w->vertical_scroll_bar)->dragging != -1)
if (bar->dragging != -1)
{
XSCROLL_BAR (w->vertical_scroll_bar)->dragging = -1;
bar->dragging = -1;
/* The thumb size is incorrect while dragging: fix it. */
set_vertical_scroll_bar (w);
}
window_being_scrolled = Qnil;
last_scroll_bar_part = -1;
#if defined (USE_LUCID)
bar->last_seen_part = scroll_bar_nowhere;
#endif
/* Xt timeouts no longer needed. */
toolkit_scroll_bar_interaction = 0;
}
......@@ -4323,7 +4322,6 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
if (part >= 0)
{
window_being_scrolled = bar->window;
last_scroll_bar_part = part;
x_send_scroll_bar_event (bar->window, part, portion, whole);
}
}
......@@ -4384,7 +4382,6 @@ xg_scroll_callback (GtkRange *range,
if (part >= 0)
{
window_being_scrolled = bar->window;
last_scroll_bar_part = part;
x_send_scroll_bar_event (bar->window, part, portion, whole);
}
......@@ -4426,7 +4423,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
float top = *top_addr;
float shown;
int whole, portion, height;
int part;
enum scroll_bar_part part;
/* Get the size of the thumb, a value between 0 and 1. */
block_input ();
......@@ -4448,7 +4445,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
window_being_scrolled = bar->window;
bar->dragging = portion;
last_scroll_bar_part = part;
bar->last_seen_part = part;
x_send_scroll_bar_event (bar->window, part, portion, whole);
}
......@@ -4468,7 +4465,7 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
/* The position really is stored cast to a pointer. */
int position = (intptr_t) call_data;
Dimension height;
int part;
enum scroll_bar_part part;
/* Get the height of the scroll bar. */
block_input ();
......@@ -4487,7 +4484,7 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
window_being_scrolled = bar->window;
bar->dragging = -1;
last_scroll_bar_part = part;
bar->last_seen_part = part;
x_send_scroll_bar_event (bar->window, part, position, height);
}
......@@ -4797,7 +4794,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
NULL);
/* Massage the top+shown values. */
if (bar->dragging == -1 || last_scroll_bar_part == scroll_bar_down_arrow)
if (bar->dragging == -1 || bar->last_seen_part == scroll_bar_down_arrow)
top = max (0, min (1, top));
else
top = old_top;
......@@ -4902,6 +4899,9 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
bar->end = 0;
bar->dragging = -1;
bar->fringe_extended_p = 0;
#if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
bar->last_seen_part = scroll_bar_nowhere;
#endif
/* Add bar to its frame's list of scroll bars. */
bar->next = FRAME_SCROLL_BARS (f);
......
......@@ -801,6 +801,11 @@ struct scroll_bar
being dragged, this is -1. */
int dragging;
#if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
/* Last scroll bar part seen in xaw_jump_callback and xaw_scroll_callback. */
enum scroll_bar_part last_seen_part;
#endif
/* 1 if the background of the fringe that is adjacent to a scroll
bar is extended to the gap between the fringe and the bar. */
unsigned fringe_extended_p : 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment