summaryrefslogtreecommitdiff
path: root/gtk/gtkhsv.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-03-24 06:41:28 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-03-24 06:41:28 +0000
commit891cd55ee30ee9a43401e75e0f30816982390a14 (patch)
tree417fc9954da773130083f55e5b1f3ed0c731a93e /gtk/gtkhsv.c
parent207e3bb9771b9e28c93cf2da5edebab543ed6a36 (diff)
downloadgtk+-891cd55ee30ee9a43401e75e0f30816982390a14.tar.gz
make motion around the ring much slower but finer-grained (gtk_hsv_focus):
2001-03-24 Havoc Pennington <hp@pobox.com> * gtk/gtkhsv.c (gtk_hsv_move): make motion around the ring much slower but finer-grained (gtk_hsv_focus): get initial focus on the ring or triangle according to tab direction * gtk/testgtk.c (main): get rid of weird sleep(1) on exit
Diffstat (limited to 'gtk/gtkhsv.c')
-rw-r--r--gtk/gtkhsv.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c
index 654c1c0aee..cc84b563bf 100644
--- a/gtk/gtkhsv.c
+++ b/gtk/gtkhsv.c
@@ -1363,6 +1363,11 @@ gtk_hsv_focus (GtkContainer *container,
if (!GTK_WIDGET_HAS_FOCUS (hsv))
{
+ if (dir == GTK_DIR_TAB_BACKWARD)
+ priv->focus_on_ring = FALSE;
+ else
+ priv->focus_on_ring = TRUE;
+
gtk_widget_grab_focus (GTK_WIDGET (hsv));
return TRUE;
}
@@ -1663,12 +1668,13 @@ gtk_hsv_move (GtkHSV *hsv,
x = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5);
y = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5);
-
+
+#define HUE_DELTA 0.002
switch (dir)
{
case GTK_DIR_UP:
if (priv->focus_on_ring)
- hue += 0.02;
+ hue += HUE_DELTA;
else
{
y -= 1;
@@ -1678,7 +1684,7 @@ gtk_hsv_move (GtkHSV *hsv,
case GTK_DIR_DOWN:
if (priv->focus_on_ring)
- hue -= 0.02;
+ hue -= HUE_DELTA;
else
{
y += 1;
@@ -1688,7 +1694,7 @@ gtk_hsv_move (GtkHSV *hsv,
case GTK_DIR_LEFT:
if (priv->focus_on_ring)
- hue += 0.02;
+ hue += HUE_DELTA;
else
{
x -= 1;
@@ -1698,7 +1704,8 @@ gtk_hsv_move (GtkHSV *hsv,
case GTK_DIR_RIGHT:
if (priv->focus_on_ring)
- hue -= 0.02;
+ hue -= HUE_DELTA
+ ;
else
{
x += 1;
@@ -1719,3 +1726,4 @@ gtk_hsv_move (GtkHSV *hsv,
gtk_hsv_set_color (hsv, hue, sat, val);
}
+