After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690550 - Make a longer timeout and fade-in/out effect for buttons in OSD
Make a longer timeout and fade-in/out effect for buttons in OSD
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: wacom
3.7.x
Other Linux
: Normal normal
: ---
Assigned To: Joaquim Rocha
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2012-12-20 10:33 UTC by Bastien Nocera
Modified: 2013-07-17 16:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch to increase timeout to 300ms (786 bytes, patch)
2012-12-21 09:35 UTC, Olivier Fourdan
reviewed Details | Review
Proposed patch to use the same timeout on regular buttons (2.00 KB, patch)
2012-12-21 09:36 UTC, Olivier Fourdan
reviewed Details | Review
wacom: Make the highlight duration of buttons in the OSD longer (10.66 KB, patch)
2013-06-14 10:24 UTC, Joaquim Rocha
reviewed Details | Review
wacom: Remove the auto_now property from the OSD's buttons (5.71 KB, patch)
2013-06-14 10:24 UTC, Joaquim Rocha
needs-work Details | Review
wacom: Remove the auto_off property from the OSD's buttons (5.71 KB, patch)
2013-06-21 15:54 UTC, Joaquim Rocha
accepted-commit_now Details | Review
wacom: Make the highlight duration of buttons in the OSD longer (11.14 KB, patch)
2013-06-28 14:01 UTC, Joaquim Rocha
needs-work Details | Review
wacom: Make the highlight duration of buttons in the OSD longer (11.47 KB, patch)
2013-07-16 15:12 UTC, Joaquim Rocha
none Details | Review
wacom: Make the highlight duration of buttons in the OSD longer (11.13 KB, patch)
2013-07-16 15:24 UTC, Joaquim Rocha
accepted-commit_now Details | Review

Description Bastien Nocera 2012-12-20 10:33:15 UTC
And possibly for other buttons as well. I'd say a total "on" state of 300ms would be appreciable, though I'll leave the exact behaviour to the designers.
Comment 1 Olivier Fourdan 2012-12-21 08:03:43 UTC
We can easily increase the timeout for touchring/touchstrip but other /regular/ buttons don't use any timeout atm.

Actually, the main use of the timeout is to /hide/ the fast press/release events that the ring/strips generate, so that the user has a chance to visualize the event.

We could extend this to other regular buttons as well, although those are meant to reflect the actual button state, ie remain depressed as long as the user keeps the real button depressed, and return to a normal state as soon as the real button is released.

I did play and tried to use timeouts for other buttons as well when I initially added the timeout and found it would make the OSD look weird, sluggish, it feels slow as if the UI would not react fast enough, imho.

Anyway, adding the timeout to regular buttons is a 1 line patch so no big issue technically (I can even post a patch for ppl to try)
Comment 2 Olivier Fourdan 2012-12-21 09:35:48 UTC
Created attachment 232032 [details] [review]
Proposed patch to increase timeout to 300ms
Comment 3 Olivier Fourdan 2012-12-21 09:36:45 UTC
Created attachment 232033 [details] [review]
Proposed patch to use the same timeout on regular buttons

That's the second variant, if we want to use a timeout for regular buttons as well.
Comment 4 Bastien Nocera 2013-04-04 12:36:38 UTC
Maintainer change
Comment 5 Joaquim Rocha 2013-04-26 09:24:37 UTC
Bastien, Olivier's patches work but they're only for visualization purposes in the OSD window; the buttons are still being pressed/released with their original timeouts.

Since I don't know the original purpose of this report, could you confirm if this is only about the OSD and, in which case, if we should commit these?
Comment 6 Bastien Nocera 2013-04-26 09:25:59 UTC
(In reply to comment #5)
> Bastien, Olivier's patches work but they're only for visualization purposes in
> the OSD window; the buttons are still being pressed/released with their
> original timeouts.

It was only for the visualisation.

> Since I don't know the original purpose of this report, could you confirm if
> this is only about the OSD and, in which case, if we should commit these?

See keywords.
Comment 7 Bastien Nocera 2013-06-05 09:42:55 UTC
Jakub, could you please check which of the options you prefer?
Comment 8 Bastien Nocera 2013-06-05 09:43:20 UTC
Review of attachment 232032 [details] [review]:

Code-wise, it's fine.
Comment 9 Bastien Nocera 2013-06-05 09:44:22 UTC
Review of attachment 232033 [details] [review]:

Code looks fine.
Comment 10 Jakub Steiner 2013-06-05 11:34:59 UTC
I'm only guessing what the timeout is for. You want to avoid accidental triggers, but how could these happen? The touchstrip being close to the rest position of a hand? The touchstrip possibly registering opposing direction movements? 300ms seems like quite a long threshold to register a tap, seems ok for the strip. I'd love to try it out :/

My model only has regular click buttons, which I hope would not be treated this way.
Comment 11 Bastien Nocera 2013-06-05 11:59:59 UTC
From IRC:
<hadess> jimmac, the touchstrip timeout if for display in the OSD
<hadess> jimmac, otherwise the button only flickers on
<jimmac> hadess, OH!
<jimmac> hadess, disregard my completely confused comment and go for it for everything. having a fade would be extra awesome
<hadess> jimmac, and in terms of the duration?
<jimmac> 300-500 range

Let's make it 300 for now, and we'll tweak it before committing.
Comment 12 Joaquim Rocha 2013-06-14 10:24:40 UTC
Created attachment 246789 [details] [review]
wacom: Make the highlight duration of buttons in the OSD longer

It also adds a fade-in/fade-out effect to the buttons.
Comment 13 Joaquim Rocha 2013-06-14 10:24:55 UTC
Created attachment 246790 [details] [review]
wacom: Remove the auto_now property from the OSD's buttons

And everything related to it as it is no longer necessary.
Comment 14 Bastien Nocera 2013-06-21 09:20:09 UTC
Review of attachment 246789 [details] [review]:

The code looks fine, but I'm not really sure that the animation matches what Jakub was expecting.
Comment 15 Bastien Nocera 2013-06-21 09:22:07 UTC
Review of attachment 246790 [details] [review]:

auto_now?
Comment 16 Joaquim Rocha 2013-06-21 09:25:07 UTC
(In reply to comment #15)
> Review of attachment 246790 [details] [review]:
> 
> auto_now?

Huh, yeah, auto_off :)
I'll change it.
Comment 17 Joaquim Rocha 2013-06-21 15:54:20 UTC
Created attachment 247463 [details] [review]
wacom: Remove the auto_off property from the OSD's buttons

And everything related to it as it is no longer necessary.
Comment 18 Joaquim Rocha 2013-06-21 16:54:16 UTC
Hi,

I recorded a video with the transition, should it be easier for Jakub to check it out:
https://docs.google.com/file/d/0B9mCgEAuiw_IWmYwZXhkZFZhQnM/edit?usp=sharing
Comment 19 Joaquim Rocha 2013-06-28 14:01:36 UTC
Created attachment 247987 [details] [review]
wacom: Make the highlight duration of buttons in the OSD longer

It also adds a fade-in/fade-out effect to the buttons.

This new version makes the buttons stay on if they're pressed again before the on state starts transitioning to off which makes e.g. strip/ring buttons stay on if they're constantly pressed. Jakub was the one to suggest this enhancement and said that the transition is okay for him so, if the code looks good, we should commit this ;)
Comment 20 Joaquim Rocha 2013-07-12 10:39:38 UTC
Jakub has tried this so I am removing the ui-review keyword.
Comment 21 Bastien Nocera 2013-07-16 13:25:27 UTC
Review of attachment 247463 [details] [review]:

Looks good.
Comment 22 Bastien Nocera 2013-07-16 13:36:22 UTC
Review of attachment 247987 [details] [review]:

Getting there!

::: plugins/wacom/gsd-wacom-osd-window.c
@@ +247,3 @@
 	GsdWacomTabletButtonPos   position;
 	gboolean                  active;
+	gboolean                  next_state; /* what the next state should be "active" or not */

Missing a comma in the sentence:
/* what the next state should be, "active" or not */

@@ +251,3 @@
 	guint                     auto_off;
 	guint                     timeout;
+	gint                      timer;

Could you separate and group all the animation variables and add a comment what they're used for?

/* Animations */
guint...;
etc.

Also, what's "timer"? I would have expected a "GTimer" object instead. Time left? Time to next animation frame?

@@ +355,3 @@
+	gint     total_timeout;
+	gdouble  transition_step;
+	gboolean remove_source = G_SOURCE_CONTINUE;

remove_source isn't very well named. How about simply "ret"?

@@ +413,2 @@
 		osd_button->priv->active = active;
+		osd_button->priv->timeout = g_timeout_add (BUTTON_TIMER_STEP,

timeout_id = ...

@@ +415,3 @@
+							   (GSourceFunc) gsd_wacom_osd_button_timer,
+							   osd_button);
+

No need for the empty line here.

@@ +664,3 @@
+	green = rgb_value_to_hex(color->green * 255);
+	blue = rgb_value_to_hex(color->blue * 255);
+	hex_color = g_strdup_printf ("#%s%s%s", red, green, blue);

Wouldn't something like:
g_strdup_printf ("#%02X%02X%02X", color->red * 255, color->green * 255...);
work?

Saves you the intermediate steps as well.

@@ +688,3 @@
+
+static gchar *
+gsd_wacom_osd_button_get_color_str (GsdWacomOSDButton *osd_button)

The code in here is overly complicated.

from_color = ...
to_color = ...
if (timeout_id > 0)
  percentage = priv->transition_percentage;
else
  percentage = 1.0;

And optimise transition_rgba_colors() for 0.0 and 1.0 values.

@@ +743,3 @@
 	pango_layout_set_markup (layout, markup, -1);
 	g_free (markup);
+	g_free (color_str);

free the color_str as soon as it's not needed anymore, so after the g_strdup_printf() above.
Comment 23 Joaquim Rocha 2013-07-16 15:12:07 UTC
Created attachment 249276 [details] [review]
wacom: Make the highlight duration of buttons in the OSD longer

Latest changes addressing Bastien's comments.
Comment 24 Joaquim Rocha 2013-07-16 15:24:11 UTC
Created attachment 249277 [details] [review]
wacom: Make the highlight duration of buttons in the OSD longer

New version addressing Bastien's comments.
Comment 25 Bastien Nocera 2013-07-16 15:41:42 UTC
Review of attachment 249277 [details] [review]:

Rest looks good.

::: plugins/wacom/gsd-wacom-osd-window.c
@@ +48,3 @@
+#define BUTTON_HIGHLIGHT_DURATION     250 /* ms */
+#define BUTTON_TRANSITION_DURATION    150 /* ms */
+#define BUTTON_TIMER_STEP             25 /* ms */

align the comment to the others.

@@ +251,3 @@
+	GdkRGBA                   active_color;
+	GdkRGBA                   inactive_color;
+	/* Animations */

A linefeed just before this section.

@@ +254,3 @@
+	gboolean                  next_state; /* what the next state should be, "active" or not */
+	guint                     timeout_id;
+	gint                      elapsed_time;

mention the unit (ms).
Comment 26 Joaquim Rocha 2013-07-17 16:03:01 UTC
Pushed with the requested changes.

commit 11a3dbdb1e4723bd3c87e8f7f2df3b8ff38b6059
commit af4cea132d6c22931900f348db7f28635102f418