Patch for UI issues with range widgets
- From: Thomas Leonard <tal00r ecs soton ac uk>
- To: gtk-devel-list gnome org
- Subject: Patch for UI issues with range widgets
- Date: Thu, 27 Dec 2001 17:23:54 +0000
Hi, I've made a few changes to the range widget. Here are the problems I have
with the current system and my changes (there are no API changes):
1. The current button-bindings are confusing.
In the trough, clicking the middle button jumps the bar to the clicked
position. The closer you click to the end of the scrollbar, the closer to the
start of end of the document it snaps to. However, clicking the middle button
on the stepper (which you would logically expect to snap right to the end)
steps in pages instead.
Therefore, this patch puts snap-to-end on button-2 on the steppers, to be
consistant with the trough behaviour.
2. Scrolling is unresponsive.
When I hold down a mouse button on a stepper or in the trough I obviously want
to scroll immediately. Instead, the range widget waits an extra long time
before doing anything at all (SCROLL_INITIAL_DELAY + SCROLL_LATER_DELAY).
Second, when I get to the right position and release the mouse button, the
range widget scrolls an extra step so that I overshoot.
This patch causes the range to scroll on the initial button press event, then
to wait SCROLL_INITIAL_DELAY+SCROLL_LATER_DELAY, then to step every
SCROLL_LATER_DELAY. When the button is released, scrolling stops immediately.
3. Common actions are too slow.
In the current system, for the steppers, we have:
- Step forward: fast (button-1)
- Step backward: very slow (move to other end of widget)
- Page forward: fast (button-2)
- Page backward: very slow (move to other side of thumb/slider)
- Snap to end: fast (button-3)
- Snap to other end: very slow (move to other end of widget)
This patch uses button-3 to reverse the scroll direction in the steppers and
in the trough. With this, we have:
- Step forward: fast (button-1)
- Step backward: fast (button-3)
- Page forward: fast (move up a few pixels to the trough)
- Page backward: fast (move up a few pixels to the trough)
- Snap to end: fast (button-2)
- Snap to other end: very slow (move to other end of widget)
As you can see, three operations are the same speed, step and page backward are
both much faster, and only page forward is slower (and then only slightly).
Since stepping backwards and forwards though a document finding the right
position is a very common operation, being able to change direction by simply
using a different mouse button is very useful.
Here is the patch; I hope this discussion has been convincing! Also, the patch
removes more lines than it adds ;-)
--- oldrange.c Thu Dec 27 16:27:48 2001
+++ gtkrange.c Thu Dec 27 16:55:51 2001
@@ -1023,10 +1023,10 @@
return GTK_SCROLL_STEP_BACKWARD;
break;
case 2:
- return GTK_SCROLL_PAGE_BACKWARD;
+ return GTK_SCROLL_START;
break;
case 3:
- return GTK_SCROLL_START;
+ return GTK_SCROLL_STEP_FORWARD;
break;
}
break;
@@ -1040,10 +1040,10 @@
return GTK_SCROLL_STEP_FORWARD;
break;
case 2:
- return GTK_SCROLL_PAGE_FORWARD;
+ return GTK_SCROLL_END;
break;
case 3:
- return GTK_SCROLL_END;
+ return GTK_SCROLL_STEP_BACKWARD;
break;
}
break;
@@ -1054,12 +1054,12 @@
if (range->trough_click_forward)
{
return range->layout->grab_button == 3
- ? GTK_SCROLL_STEP_FORWARD : GTK_SCROLL_PAGE_FORWARD;
+ ? GTK_SCROLL_PAGE_BACKWARD : GTK_SCROLL_PAGE_FORWARD;
}
else
{
return range->layout->grab_button == 3
- ? GTK_SCROLL_STEP_BACKWARD : GTK_SCROLL_PAGE_BACKWARD;
+ ? GTK_SCROLL_PAGE_FORWARD : GTK_SCROLL_PAGE_BACKWARD;
}
}
break;
@@ -1271,25 +1271,13 @@
if (range->layout->grab_button == event->button)
{
- GtkScrollType scroll;
MouseLocation grab_location;
grab_location = range->layout->grab_location;
- scroll = range_get_scroll_for_grab (range);
-
range_grab_remove (range);
gtk_range_remove_step_timer (range);
- /* We only do the move if we're still on top of the button at
- * release
- */
- if (grab_location == range->layout->mouse_location &&
- scroll != GTK_SCROLL_NONE)
- {
- gtk_range_scroll (range, scroll);
- }
-
if (grab_location == MOUSE_SLIDER)
update_slider_position (range, event->x, event->y);
@@ -2309,6 +2297,8 @@
initial_timeout,
range);
range->timer->step = step;
+
+ gtk_range_scroll (range, range->timer->step);
}
static void
--
Thomas Leonard http://rox.sourceforge.net
tal00r ecs soton ac uk tal197 users sourceforge net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]