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

Pointer now remains normal if autoscrolling will not occur

parent 37aa211c
...@@ -4297,20 +4297,20 @@ _kernel_oserror *hotlist_autoscroll(int window) ...@@ -4297,20 +4297,20 @@ _kernel_oserror *hotlist_autoscroll(int window)
ObjectId parent; ObjectId parent;
ComponentId component; ComponentId component;
int scroll_changed; int scroll_changed;
WimpGetWindowStateBlock state;
BBox extent;
int x, y;
int position;
int autoscroll_newtime;
_kernel_oserror *e; _kernel_oserror *e;
ObjectId over_window; 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; static unsigned int scrolling, autoscroll_oldtime, mouse_shape = Mouse_Shape_Normal;
/* Reset autoscroll handling if requested */
if (!window) if (!window)
{ {
#ifdef TRACE #ifdef TRACE
Printf("hotlist_autoscroll: resetting\n"); if (tl & (1<<25)) Printf("hotlist_autoscroll: resetting\n");
#endif #endif
scrolling = 0; scrolling = 0;
mouse_set_pointer_shape(Mouse_Shape_Normal); mouse_set_pointer_shape(Mouse_Shape_Normal);
...@@ -4326,8 +4326,8 @@ _kernel_oserror *hotlist_autoscroll(int window) ...@@ -4326,8 +4326,8 @@ _kernel_oserror *hotlist_autoscroll(int window)
RetError(wimp_get_window_state(&state)); RetError(wimp_get_window_state(&state));
RetError(window_get_extent(0, window, &extent)); RetError(window_get_extent(0, window, &extent));
scroll_changed = 0;
/* Find location of pointer */
if ((x < state.visible_area.xmin) || if ((x < state.visible_area.xmin) ||
(x > state.visible_area.xmax) || (x > state.visible_area.xmax) ||
(y < state.visible_area.ymin) || (y < state.visible_area.ymin) ||
...@@ -4348,63 +4348,60 @@ _kernel_oserror *hotlist_autoscroll(int window) ...@@ -4348,63 +4348,60 @@ _kernel_oserror *hotlist_autoscroll(int window)
position = 2; /* Inside scrolling region */ position = 2; /* Inside scrolling region */
} }
#ifdef TRACE scroll_changed = 0;
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
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 */ scroll_changed = 1;
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_newtime)); state.yscroll += (y - (state.visible_area.ymax - HOTLIST_SCROLL_BOUNDARY_SIZE));
if ((autoscroll_newtime - autoscroll_oldtime) > AUTOSCROLL_DELAY) }
{ }
if (mouse_shape != Mouse_Shape_Scrolling) else
{ {
mouse_set_pointer_shape(Mouse_Shape_Scrolling); if (y < state.visible_area.ymin + HOTLIST_SCROLL_BOUNDARY_SIZE)
mouse_shape = Mouse_Shape_Scrolling; {
} /* Bottom */
scrolling = 1;
} if (state.yscroll > extent.ymin + (state.visible_area.ymax - state.visible_area.ymin))
else
{ {
if (mouse_shape != Mouse_Shape_ToScroll) 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);
}
} }
} }
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 */ scroll_changed = 1;
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime)); state.xscroll += (x - (state.visible_area.xmax - HOTLIST_SCROLL_BOUNDARY_SIZE));
if (mouse_shape != Mouse_Shape_Normal) }
}
else
{
if (x < state.visible_area.xmin + HOTLIST_SCROLL_BOUNDARY_SIZE)
{
/* Left */
if (state.xscroll > extent.xmin)
{ {
mouse_set_pointer_shape(Mouse_Shape_Normal); scroll_changed = 1;
mouse_shape = Mouse_Shape_Normal; 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)); RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime));
if (mouse_shape != Mouse_Shape_Normal) if (mouse_shape != Mouse_Shape_Normal)
...@@ -4413,12 +4410,10 @@ _kernel_oserror *hotlist_autoscroll(int window) ...@@ -4413,12 +4410,10 @@ _kernel_oserror *hotlist_autoscroll(int window)
mouse_shape = Mouse_Shape_Normal; mouse_shape = Mouse_Shape_Normal;
} }
} }
} break;
else
{ case 1:
if (position == 1)
{ {
/* Stop scrolling */
scrolling = 0; scrolling = 0;
RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime)); RetError(_swix(OS_ReadMonotonicTime, _OUTR(0, 0), &autoscroll_oldtime));
if (mouse_shape != Mouse_Shape_Normal) if (mouse_shape != Mouse_Shape_Normal)
...@@ -4427,63 +4422,54 @@ _kernel_oserror *hotlist_autoscroll(int window) ...@@ -4427,63 +4422,54 @@ _kernel_oserror *hotlist_autoscroll(int window)
mouse_shape = Mouse_Shape_Normal; mouse_shape = Mouse_Shape_Normal;
} }
} }
else break;
{
/* Scroll a bit */
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 */ scrolling = 1;
if (state.yscroll < extent.ymax)
{
scroll_changed = 1;
state.yscroll += (y - (state.visible_area.ymax - HOTLIST_SCROLL_BOUNDARY_SIZE));
}
} }
else else
{ {
if (y < state.visible_area.ymin + HOTLIST_SCROLL_BOUNDARY_SIZE) if (mouse_shape != Mouse_Shape_ToScroll)
{ {
/* Bottom */ mouse_shape = Mouse_Shape_ToScroll;
mouse_set_pointer_shape(Mouse_Shape_ToScroll);
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);
}
} }
} }
}
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 */ mouse_shape = Mouse_Shape_Scrolling;
if (state.xscroll < extent.xmax - (state.visible_area.xmax - state.visible_area.xmin)) mouse_set_pointer_shape(Mouse_Shape_Scrolling);
{
scroll_changed = 1;
state.xscroll += (x - (state.visible_area.xmax - HOTLIST_SCROLL_BOUNDARY_SIZE));
}
} }
else }
else
{
if (mouse_shape != Mouse_Shape_Normal)
{ {
if (x < state.visible_area.xmin + HOTLIST_SCROLL_BOUNDARY_SIZE) mouse_shape = Mouse_Shape_Normal;
{ mouse_set_pointer_shape(Mouse_Shape_Normal);
/* Left */
if (state.xscroll > extent.xmin)
{
scroll_changed = 1;
state.xscroll -= ((state.visible_area.xmin + HOTLIST_SCROLL_BOUNDARY_SIZE) - x);
}
}
} }
} }
} }
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; 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