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 667797 - Animate calibration clicks
Animate calibration clicks
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Wacom
git master
Other Linux
: Normal normal
: ---
Assigned To: Joaquim Rocha
Control-Center Maintainers
3.10
Depends on:
Blocks:
 
 
Reported: 2012-01-12 17:40 UTC by Bastien Nocera
Modified: 2013-05-17 14:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
calibration demo (398.90 KB, video/webm)
2012-01-12 17:40 UTC, Bastien Nocera
  Details
Patch with the animations (55.42 KB, patch)
2013-04-09 16:34 UTC, Joaquim Rocha
none Details | Review
New patch with an embedded Clutter stage (58.17 KB, patch)
2013-04-10 16:13 UTC, Joaquim Rocha
none Details | Review
Embedded clutter stage and clock actor (57.30 KB, patch)
2013-04-11 11:16 UTC, Joaquim Rocha
needs-work Details | Review
New patch with an embedded Clutter stage and forgotten files (64.88 KB, patch)
2013-04-11 17:02 UTC, Joaquim Rocha
needs-work Details | Review
New revision of the patch (71.32 KB, patch)
2013-04-16 12:02 UTC, Joaquim Rocha
none Details | Review
New patch which initializes Clutter (56.09 KB, patch)
2013-04-19 09:44 UTC, Joaquim Rocha
none Details | Review
Calibration written in Clutter (73.26 KB, patch)
2013-05-02 13:45 UTC, Joaquim Rocha
reviewed Details | Review
Updated patch (73.63 KB, patch)
2013-05-14 08:28 UTC, Joaquim Rocha
none Details | Review
Rebased patch (74.43 KB, patch)
2013-05-17 10:29 UTC, Joaquim Rocha
accepted-commit_now Details | Review

Description Bastien Nocera 2012-01-12 17:40:08 UTC
Created attachment 205120 [details]
calibration demo

As per video
Comment 1 Joaquim Rocha 2013-04-04 11:16:14 UTC
What is the status of this? I assume you have a patch for this which you used in the video. If so, it would be nice if we could integrate it.
Comment 2 Bastien Nocera 2013-04-04 12:33:10 UTC
It's a video mockup, there's no patch.
Comment 3 Bastien Nocera 2013-04-04 12:37:36 UTC
Maintainer change
Comment 4 Joaquim Rocha 2013-04-05 13:00:06 UTC
Looking into it.

AFAIU, the changes need to the current one are:

1) Window bg is transparent;
2) Text "animates in" under the timeout indicator;
3) Targets show up by zooming-in (with a bit of "elastic go back") and disappear by animating the outer circle towards the center.

Probably it'll be much easier to do with Clutter so I might use it instead of (just) cairo.
Comment 5 Joaquim Rocha 2013-04-09 16:34:50 UTC
Created attachment 241077 [details] [review]
Patch with the animations

Hi,

This patch re-writes the calibrator's GUI using Clutter and introduces the animations as faithful to the demo video as I could get. I will also upload a video tomorrow.

It needs to be checked with dual-screen and I wonder if it might be better to refactor the calib_area_new and put all the initialization and configuration of stuff in separate functions.
Comment 6 Joaquim Rocha 2013-04-10 16:13:25 UTC
Created attachment 241184 [details] [review]
New patch with an embedded Clutter stage

I am attaching a new patch which uses an embedded Clutter stage instead of a pure one.

This had to be done in order to make the calibrator UI appear on the correct screen and it also allows to keep more consistency between some of the previous behaviors (like quitting it when unfocusing the window).

This way we could have possibly maintained the old gui_gtk file name but let's just have the new one because it's better.
Comment 7 Joaquim Rocha 2013-04-11 11:16:08 UTC
Created attachment 241241 [details] [review]
Embedded clutter stage and clock actor

Hi,

This new revision makes the clock a separate Clutter actor after Bastien's suggestion on IRC.
Comment 8 Joaquim Rocha 2013-04-11 13:16:14 UTC
Oh, BTW, I didn't use a private struct member in the Clock actor because what's needed to keep internal is simply a float so I didn't think that was necessary. If it is, let me know and I'll add the private.
Comment 9 Bastien Nocera 2013-04-11 16:28:25 UTC
Review of attachment 241241 [details] [review]:

::: panels/wacom/calibrator/Makefile.am
@@ +30,3 @@
+	calibratorgui.c			\
+	calibratorgui.h			\
+	clock.c				\

Those files aren't in the patch.
Comment 10 Joaquim Rocha 2013-04-11 17:02:59 UTC
Created attachment 241281 [details] [review]
New patch with an embedded Clutter stage and forgotten files

Argh, sorry about it.
Comment 11 Bastien Nocera 2013-04-12 13:42:18 UTC
Review of attachment 241281 [details] [review]:

Jakub will have to review the animations when he comes back to check that they match the video, to me the animations seemed a little bit fast. It's already better though :)

::: panels/wacom/calibrator/calibratorgui.c
@@ +242,3 @@
+
+static void
+draw_target (ClutterCairoTexture *texture,

I think the targets could also do with being split in their own actor.

@@ +619,3 @@
+  calib_area->calibrator.geometry.height = clutter_actor_get_height (stage);
+
+  if (clutter_color_from_string (&color, "#000"))

I don't see any reasons why that should fail, use a g_assert_not_reached() in the failure case instead.
You can also use CLUTTER_COLOR_BLACK.

@@ +622,3 @@
+    {
+      color.alpha = WINDOW_OPACITY;
+      clutter_actor_set_background_color (stage, &color);

That doesn't seem to work, and the window isn't see-through.

@@ +820,3 @@
+  gtk_widget_realize (calib_area->window);
+  window = gtk_widget_get_window (calib_area->window);
+  gdk_window_set_background_rgba (window, &black);

I think you should set the alpha on the background color as well.

::: panels/wacom/calibrator/clock.h
@@ +19,3 @@
+ */
+
+#ifndef __CLOCK_H__

"clock" is too generic.

Please rename the object/files/etc. to CcClockActor, or CcCountdownActor. It makes it clear that the object is a ClutterActor, and avoid clashes with system functions.
Comment 12 Joaquim Rocha 2013-04-12 14:02:24 UTC
(In reply to comment #11)
> Review of attachment 241281 [details] [review]:
> 
> Jakub will have to review the animations when he comes back to check that they
> match the video, to me the animations seemed a little bit fast. It's already
> better though :)
> 
> ::: panels/wacom/calibrator/calibratorgui.c
> @@ +242,3 @@
> +
> +static void
> +draw_target (ClutterCairoTexture *texture,
> 
> I think the targets could also do with being split in their own actor.

Alright.

> 
> @@ +619,3 @@
> +  calib_area->calibrator.geometry.height = clutter_actor_get_height (stage);
> +
> +  if (clutter_color_from_string (&color, "#000"))
> 
> I don't see any reasons why that should fail, use a g_assert_not_reached() in
> the failure case instead.
> You can also use CLUTTER_COLOR_BLACK.

Okay.

> 
> @@ +622,3 @@
> +    {
> +      color.alpha = WINDOW_OPACITY;
> +      clutter_actor_set_background_color (stage, &color);
> 
> That doesn't seem to work, and the window isn't see-through.

I guess this might be related to something else because I couldn't also see the original one as transparent (even though the one from my own machine's g-c-c is). I just assumed this was a problem in my jhbuild...

Could you check if the original calibrator code inside jhbuild shows a semi-transparent window for you?

> 
> @@ +820,3 @@
> +  gtk_widget_realize (calib_area->window);
> +  window = gtk_widget_get_window (calib_area->window);
> +  gdk_window_set_background_rgba (window, &black);
> 
> I think you should set the alpha on the background color as well.

This is code from the original version, I didn't touch that but it's probably worth checking if setting the alpha does anything.

> 
> ::: panels/wacom/calibrator/clock.h
> @@ +19,3 @@
> + */
> +
> +#ifndef __CLOCK_H__
> 
> "clock" is too generic.
> 
> Please rename the object/files/etc. to CcClockActor, or CcCountdownActor. It
> makes it clear that the object is a ClutterActor, and avoid clashes with system
> functions.

Completely forgot to rename this in the end...

Thanks for the comments.
Comment 13 Joaquim Rocha 2013-04-16 12:02:51 UTC
Created attachment 241629 [details] [review]
New revision of the patch

Hi Bastien,

I am attaching a new version of this patch.

I tried a lot of solutions for the transparency problem but it seems there's not only a bug in gtk+ but also in clutter-gtk as the bg for the GtkClutterEmbed is always black (I couldn't override it).

I'll write the test file for this case and open a bug to the clutter-gtk folks.
Comment 14 Joaquim Rocha 2013-04-18 15:01:23 UTC
There's another issue I just found out. Calling the calibration from g-c-c crashes because Clutter hasn't been initialized. I had initialized it for test-wacom but I forgot about the whole application.

I'll provide a fix soon.
Comment 15 Joaquim Rocha 2013-04-19 09:44:13 UTC
Created attachment 241886 [details] [review]
New patch which initializes Clutter

Hi, as promised, here's a new version of the patch correctly initializing Clutter.
Comment 16 Joaquim Rocha 2013-05-02 13:45:45 UTC
Created attachment 243056 [details] [review]
Calibration written in Clutter

Hi,

I finally found a way to make the transparency work on the window: I had to apply the RGBA screen visual to the window...

I also added the deletion of the gui_gtk.c to the patch, which I had forgotten.
Comment 17 Bastien Nocera 2013-05-13 10:23:20 UTC
Review of attachment 243056 [details] [review]:

Nearly ready to go.

::: panels/wacom/calibrator/calibrator-gui.c
@@ +231,3 @@
+    {
+      set_success (area);
+      g_timeout_add(END_TIME, (GSourceFunc) draw_success_end_wait_callback, area);

space between function name and bracket.

@@ +369,3 @@
+        return FALSE;
+
+    /* If the calibrator window looses focus, simply bail out... */

"loses".

@@ +537,3 @@
+  clutter_text_set_line_alignment (CLUTTER_TEXT (calib_area->helper_text_title),
+                                   PANGO_ALIGN_CENTER);
+  color.red = 127;

Please, no magic numbers.

@@ +540,3 @@
+  color.green = 127;
+  color.blue = 127;
+  color.alpha = 255;

0xff?

::: panels/wacom/calibrator/cc-clock-actor.c
@@ +25,3 @@
+#define CLOCK_LINE_WIDTH               10
+#define CLOCK_LINE_PADDING             10
+#define ANGLE_PROP_NAME                "angle"

It's used in a single place, use "angle" directly.

@@ +134,3 @@
+                           gfloat       *natural_width_p)
+{
+  *min_width_p = CLOCK_RADIUS + 2;

No magic numbers.

@@ +140,3 @@
+static void
+cc_clock_actor_get_preferred_height (ClutterActor *actor,
+                            gfloat        for_width,

Indentation?

::: panels/wacom/calibrator/cc-target-actor.c
@@ +106,3 @@
+             gpointer             data)
+{
+  cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);

Space before brackets all around.
Comment 18 Joaquim Rocha 2013-05-14 08:28:04 UTC
Created attachment 244136 [details] [review]
Updated patch

Hi, hopefully this new version will address the remaining issues.

Cheers,
Comment 19 Joaquim Rocha 2013-05-17 10:29:02 UTC
Created attachment 244500 [details] [review]
Rebased patch

Same patch, rebased with the latest master.
Comment 20 Bastien Nocera 2013-05-17 14:17:22 UTC
Review of attachment 244500 [details] [review]:

Looks good.
Comment 21 Joaquim Rocha 2013-05-17 14:38:11 UTC
Pushed.