Commit d1fc6c21 authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

* xterm.h (struct scroll_bar): Prefer int to Lisp_Object

for 'dragging' member.
* gtkutil.c (xg_set_toolkit_scroll_bar_thumb):
* xterm.c (xt_action_hook, xm_scroll_callback, xg_scroll_callback)
(xg_end_scroll_callback, xaw_jump_callback, xaw_scroll_callback)
(x_set_toolkit_scroll_bar_thumb, x_scroll_bar_create)
(x_scroll_bar_set_handle, XTset_vertical_scroll_bar)
(x_scroll_bar_handle_click, x_scroll_bar_note_movement)
(x_scroll_bar_report_motion): Related users changed.
parent 0ce9f6de
2013-09-03 Dmitry Antipov <dmantipov@yandex.ru>
* xterm.h (struct scroll_bar): Prefer int to Lisp_Object
for 'dragging' member.
* gtkutil.c (xg_set_toolkit_scroll_bar_thumb):
* xterm.c (xt_action_hook, xm_scroll_callback, xg_scroll_callback)
(xg_end_scroll_callback, xaw_jump_callback, xaw_scroll_callback)
(x_set_toolkit_scroll_bar_thumb, x_scroll_bar_create)
(x_scroll_bar_set_handle, XTset_vertical_scroll_bar)
(x_scroll_bar_handle_click, x_scroll_bar_note_movement)
(x_scroll_bar_report_motion): Related users changed.
2013-09-03 Jan Djärv <jan.h.d@swipnet.se>
* nsfont.m (INVALID_GLYPH): New define.
......
......@@ -3783,7 +3783,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
if (wscroll && NILP (bar->dragging))
if (wscroll && bar->dragging == -1)
{
GtkAdjustment *adj;
gdouble shown;
......
......@@ -4141,9 +4141,9 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name,
scroll_bar_end_scroll, 0, 0);
w = XWINDOW (window_being_scrolled);
if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging))
if (XSCROLL_BAR (w->vertical_scroll_bar)->dragging != -1)
{
XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil;
XSCROLL_BAR (w->vertical_scroll_bar)->dragging = -1;
/* The thumb size is incorrect while dragging: fix it. */
set_vertical_scroll_bar (w);
}
......@@ -4281,32 +4281,32 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
switch (cs->reason)
{
case XmCR_DECREMENT:
bar->dragging = Qnil;
bar->dragging = -1;
part = scroll_bar_up_arrow;
break;
case XmCR_INCREMENT:
bar->dragging = Qnil;
bar->dragging = -1;
part = scroll_bar_down_arrow;
break;
case XmCR_PAGE_DECREMENT:
bar->dragging = Qnil;
bar->dragging = -1;
part = scroll_bar_above_handle;
break;
case XmCR_PAGE_INCREMENT:
bar->dragging = Qnil;
bar->dragging = -1;
part = scroll_bar_below_handle;
break;
case XmCR_TO_TOP:
bar->dragging = Qnil;
bar->dragging = -1;
part = scroll_bar_to_top;
break;
case XmCR_TO_BOTTOM:
bar->dragging = Qnil;
bar->dragging = -1;
part = scroll_bar_to_bottom;
break;
......@@ -4322,7 +4322,7 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
whole = XM_SB_MAX - slider_size;
portion = min (cs->value, whole);
part = scroll_bar_handle;
bar->dragging = make_number (cs->value);
bar->dragging = cs->value;
}
break;
......@@ -4370,24 +4370,24 @@ xg_scroll_callback (GtkRange *range,
whole = gtk_adjustment_get_upper (adj) -
gtk_adjustment_get_page_size (adj);
portion = min ((int)position, whole);
bar->dragging = make_number ((int)portion);
bar->dragging = portion;
}
break;
case GTK_SCROLL_STEP_BACKWARD:
part = scroll_bar_up_arrow;
bar->dragging = Qnil;
bar->dragging = -1;
break;
case GTK_SCROLL_STEP_FORWARD:
part = scroll_bar_down_arrow;
bar->dragging = Qnil;
bar->dragging = -1;
break;
case GTK_SCROLL_PAGE_BACKWARD:
part = scroll_bar_above_handle;
bar->dragging = Qnil;
bar->dragging = -1;
break;
case GTK_SCROLL_PAGE_FORWARD:
part = scroll_bar_below_handle;
bar->dragging = Qnil;
bar->dragging = -1;
break;
}
......@@ -4401,7 +4401,7 @@ xg_scroll_callback (GtkRange *range,
return FALSE;
}
/* Callback for button release. Sets dragging to Qnil when dragging is done. */
/* Callback for button release. Sets dragging to -1 when dragging is done. */
static gboolean
xg_end_scroll_callback (GtkWidget *widget,
......@@ -4409,7 +4409,7 @@ xg_end_scroll_callback (GtkWidget *widget,
gpointer user_data)
{
struct scroll_bar *bar = user_data;
bar->dragging = Qnil;
bar->dragging = -1;
if (WINDOWP (window_being_scrolled))
{
x_send_scroll_bar_event (window_being_scrolled,
......@@ -4457,7 +4457,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
part = scroll_bar_handle;
window_being_scrolled = bar->window;
bar->dragging = make_number (portion);
bar->dragging = portion;
last_scroll_bar_part = part;
x_send_scroll_bar_event (bar->window, part, portion, whole);
}
......@@ -4496,7 +4496,7 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
part = scroll_bar_move_ratio;
window_being_scrolled = bar->window;
bar->dragging = Qnil;
bar->dragging = -1;
last_scroll_bar_part = part;
x_send_scroll_bar_event (bar->window, part, position, height);
}
......@@ -4772,7 +4772,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
shown = (float) portion / whole;
}
if (NILP (bar->dragging))
if (bar->dragging == -1)
{
int size, value;
......@@ -4807,7 +4807,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
NULL);
/* Massage the top+shown values. */
if (NILP (bar->dragging) || last_scroll_bar_part == scroll_bar_down_arrow)
if (bar->dragging == -1 || last_scroll_bar_part == scroll_bar_down_arrow)
top = max (0, min (1, top));
else
top = old_top;
......@@ -4819,7 +4819,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
for `NARROWPROTO'. See s/freebsd.h for an example. */
if (top != old_top || shown != old_shown)
{
if (NILP (bar->dragging))
if (bar->dragging == -1)
XawScrollbarSetThumb (widget, top, shown);
else
{
......@@ -4910,7 +4910,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
bar->height = height;
bar->start = 0;
bar->end = 0;
bar->dragging = Qnil;
bar->dragging = -1;
bar->fringe_extended_p = 0;
/* Add bar to its frame's list of scroll bars. */
......@@ -4968,7 +4968,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
static void
x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild)
{
int dragging = ! NILP (bar->dragging);
bool dragging = bar->dragging != -1;
Window w = bar->x_window;
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
GC gc = f->output_data.x->normal_gc;
......@@ -5261,7 +5261,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
#else /* not USE_TOOLKIT_SCROLL_BARS */
/* Set the scroll bar's current state, unless we're currently being
dragged. */
if (NILP (bar->dragging))
if (bar->dragging == -1)
{
int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height);
......@@ -5471,14 +5471,13 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e
#ifndef USE_TOOLKIT_SCROLL_BARS
/* If the user has released the handle, set it to its final position. */
if (event->type == ButtonRelease
&& ! NILP (bar->dragging))
if (event->type == ButtonRelease && bar->dragging != -1)
{
int new_start = y - XINT (bar->dragging);
int new_end = new_start + bar->end - bar->start;
x_scroll_bar_set_handle (bar, new_start, new_end, 0);
bar->dragging = Qnil;
bar->dragging = -1;
}
#endif
......@@ -5505,10 +5504,10 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XMotionEvent *event)
XSETVECTOR (last_mouse_scroll_bar, bar);
/* If we're dragging the bar, display it. */
if (! NILP (bar->dragging))
if (bar->dragging != -1)
{
/* Where should the handle be now? */
int new_start = event->y - XINT (bar->dragging);
int new_start = event->y - bar->dragging;
if (new_start != bar->start)
{
......@@ -5560,8 +5559,8 @@ x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window,
win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER;
if (! NILP (bar->dragging))
win_y -= XINT (bar->dragging);
if (bar->dragging != -1)
win_y -= bar->dragging;
if (win_y < 0)
win_y = 0;
......@@ -5571,7 +5570,7 @@ x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window,
*fp = f;
*bar_window = bar->window;
if (! NILP (bar->dragging))
if (bar->dragging != -1)
*part = scroll_bar_handle;
else if (win_y < bar->start)
*part = scroll_bar_above_handle;
......
......@@ -806,8 +806,8 @@ struct scroll_bar
/* If the scroll bar handle is currently being dragged by the user,
this is the number of pixels from the top of the handle to the
place where the user grabbed it. If the handle isn't currently
being dragged, this is Qnil. */
Lisp_Object dragging;
being dragged, this is -1. */
int dragging;
/* 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. */
......
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