Commit bd216181 authored by David Brown's avatar David Brown
Browse files

Pointer now remains normal if autoscrolling will not occur

......@@ -4297,20 +4297,20 @@ _kernel_oserror *hotlist_autoscroll(int window)
ObjectId parent;
ComponentId component;
int scroll_changed;
WimpGetWindowStateBlock state;
BBox extent;
int x, y;
int position;
int autoscroll_newtime;
_kernel_oserror *e;
ObjectId over_window;
BBox extent;
int x, y, position;
int autoscroll_newtime;
WimpGetWindowStateBlock state;
static unsigned int scrolling, autoscroll_oldtime, mouse_shape = Mouse_Shape_Normal;
/* Reset autoscroll handling if requested */
if (!window)
{
#ifdef TRACE
Printf("hotlist_autoscroll: resetting\n");
if (tl & (1<<25)) Printf("hotlist_autoscroll: resetting\n");
#endif
scrolling = 0;
mouse_set_pointer_shape(Mouse_Shape_Normal);
......@@ -4326,8 +4326,8 @@ _kernel_oserror *hotlist_autoscroll(int window)
RetError(wimp_get_window_state(&state));
RetError(window_get_extent(0, window, &extent));
scroll_changed = 0;
/* Find location of pointer */
if ((x < state.visible_area.xmin) ||
(x > state.visible_area.xmax) ||
(y < state.visible_area.ymin) ||
......@@ -4348,63 +4348,60 @@ _kernel_oserror *hotlist_autoscroll(int window)
position = 2; /* Inside scrolling region */
}
#ifdef TRACE
Printf("Pointer is ");
switch(position)
{
case 0:
Printf("Outside visible area");
break;
case 1:
Printf("inside non scrolling region");
break;
case 2:
Printf("Inside scrolling region");
break;
}
Printf(" of scrolling window\n");
Printf("scrolling = %d\n", scrolling);
#endif
scroll_changed = 0;
if (!scrolling)
if (position == 0 || position == 2)
{
if (window == over_window)
if (y > state.visible_area.ymax - HOTLIST_SCROLL_BOUNDARY_SIZE)
{
if (position == 2)
/* Top */
if (state.yscroll < extent.ymax)
{
/* Check timer, see if it's time to start scrolling */
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_newtime));
if ((autoscroll_newtime - autoscroll_oldtime) > AUTOSCROLL_DELAY)
{
if (mouse_shape != Mouse_Shape_Scrolling)
{
mouse_set_pointer_shape(Mouse_Shape_Scrolling);
mouse_shape = Mouse_Shape_Scrolling;
}
scrolling = 1;
}
else
scroll_changed = 1;
state.yscroll += (y - (state.visible_area.ymax - HOTLIST_SCROLL_BOUNDARY_SIZE));
}
}
else
{
if (y < state.visible_area.ymin + HOTLIST_SCROLL_BOUNDARY_SIZE)
{
/* Bottom */
if (state.yscroll > extent.ymin + (state.visible_area.ymax - state.visible_area.ymin))
{
if (mouse_shape != Mouse_Shape_ToScroll)
{
mouse_shape = Mouse_Shape_ToScroll;
mouse_set_pointer_shape(Mouse_Shape_ToScroll);
}
scroll_changed = 1;
state.yscroll -= ((state.visible_area.ymin + HOTLIST_SCROLL_BOUNDARY_SIZE) - y);
}
}
else
}
if (x > state.visible_area.xmax - HOTLIST_SCROLL_BOUNDARY_SIZE)
{
/* Right */
if (state.xscroll < extent.xmax - (state.visible_area.xmax - state.visible_area.xmin))
{
/* Set scroll timer to zero */
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime));
if (mouse_shape != Mouse_Shape_Normal)
scroll_changed = 1;
state.xscroll += (x - (state.visible_area.xmax - HOTLIST_SCROLL_BOUNDARY_SIZE));
}
}
else
{
if (x < state.visible_area.xmin + HOTLIST_SCROLL_BOUNDARY_SIZE)
{
/* Left */
if (state.xscroll > extent.xmin)
{
mouse_set_pointer_shape(Mouse_Shape_Normal);
mouse_shape = Mouse_Shape_Normal;
scroll_changed = 1;
state.xscroll -= ((state.visible_area.xmin + HOTLIST_SCROLL_BOUNDARY_SIZE) - x);
}
}
}
else
}
switch(position)
{
case 0:
if (!scrolling)
{
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime));
if (mouse_shape != Mouse_Shape_Normal)
......@@ -4413,12 +4410,10 @@ _kernel_oserror *hotlist_autoscroll(int window)
mouse_shape = Mouse_Shape_Normal;
}
}
}
else
{
if (position == 1)
break;
case 1:
{
/* Stop scrolling */
scrolling = 0;
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime));
if (mouse_shape != Mouse_Shape_Normal)
......@@ -4427,63 +4422,54 @@ _kernel_oserror *hotlist_autoscroll(int window)
mouse_shape = Mouse_Shape_Normal;
}
}
else
{
/* Scroll a bit */
break;
if (y > state.visible_area.ymax - HOTLIST_SCROLL_BOUNDARY_SIZE)
case 2:
if ((!scrolling) && scroll_changed)
{
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_newtime));
if ((autoscroll_newtime - autoscroll_oldtime) > AUTOSCROLL_DELAY)
{
/* Top */
if (state.yscroll < extent.ymax)
{
scroll_changed = 1;
state.yscroll += (y - (state.visible_area.ymax - HOTLIST_SCROLL_BOUNDARY_SIZE));
}
scrolling = 1;
}
else
{
if (y < state.visible_area.ymin + HOTLIST_SCROLL_BOUNDARY_SIZE)
if (mouse_shape != Mouse_Shape_ToScroll)
{
/* Bottom */
if (state.yscroll > extent.ymin + (state.visible_area.ymax - state.visible_area.ymin))
{
scroll_changed = 1;
state.yscroll -= ((state.visible_area.ymin + HOTLIST_SCROLL_BOUNDARY_SIZE) - y);
}
mouse_shape = Mouse_Shape_ToScroll;
mouse_set_pointer_shape(Mouse_Shape_ToScroll);
}
}
}
if (!scroll_changed)
{
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime));
}
break;
}
if (x > state.visible_area.xmax - HOTLIST_SCROLL_BOUNDARY_SIZE)
if (scrolling)
{
if (scroll_changed)
{
RetError(toolbox_get_parent(0, window, &parent, &component));
RetError(toolbox_show_object(0, window, Toolbox_ShowObject_FullSpec, &(state.visible_area), parent, component));
if (mouse_shape != Mouse_Shape_Scrolling)
{
/* Right */
if (state.xscroll < extent.xmax - (state.visible_area.xmax - state.visible_area.xmin))
{
scroll_changed = 1;
state.xscroll += (x - (state.visible_area.xmax - HOTLIST_SCROLL_BOUNDARY_SIZE));
}
mouse_shape = Mouse_Shape_Scrolling;
mouse_set_pointer_shape(Mouse_Shape_Scrolling);
}
else
}
else
{
if (mouse_shape != Mouse_Shape_Normal)
{
if (x < state.visible_area.xmin + HOTLIST_SCROLL_BOUNDARY_SIZE)
{
/* Left */
if (state.xscroll > extent.xmin)
{
scroll_changed = 1;
state.xscroll -= ((state.visible_area.xmin + HOTLIST_SCROLL_BOUNDARY_SIZE) - x);
}
}
mouse_shape = Mouse_Shape_Normal;
mouse_set_pointer_shape(Mouse_Shape_Normal);
}
}
}
if (scroll_changed)
{
RetError(toolbox_get_parent(0, window, &parent, &component));
RetError(toolbox_show_object(0, window, Toolbox_ShowObject_FullSpec, &(state.visible_area), parent, component));
}
return NULL;
}
......
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