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);
}
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;
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;
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;
}
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,
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,
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);
}
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);
}
shown = (float) portion / whole;
}
- if (NILP (bar->dragging))
+ if (bar->dragging == -1)
{
int size, value;
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;
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
{
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. */
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;
#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);
#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
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)
{
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;
*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;