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 761847 - Update cluttermm build from cluttermm-1-24 branch
Update cluttermm build from cluttermm-1-24 branch
Status: RESOLVED FIXED
Product: cluttermm
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: cluttermm-maint
cluttermm-maint
Depends on:
Blocks:
 
 
Reported: 2016-02-11 03:19 UTC by Ian Martin
Modified: 2016-08-21 08:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure.ac requires a version bump (768 bytes, patch)
2016-02-11 03:19 UTC, Ian Martin
none Details | Review
insert_child_at_index has a {?} parameter for the index which blocked the build. (1.69 KB, patch)
2016-02-11 03:22 UTC, Ian Martin
committed Details | Review
separates the cluttermm definitions of Image::set() and Image::set_data() (1.14 KB, patch)
2016-02-11 03:28 UTC, Ian Martin
committed Details | Review
make Content::invalidate() public (881 bytes, patch)
2016-02-11 03:30 UTC, Ian Martin
needs-work Details | Review
transition.hg corrections: added Activatable as interface, and corrected template code (1.31 KB, patch)
2016-02-14 23:23 UTC, Ian Martin
committed Details | Review
Changes Clutter::Timeline parameters from guint to unsigned int. (2.74 KB, patch)
2016-02-14 23:24 UTC, Ian Martin
rejected Details | Review
Adds a class comment to Clutter::Actor, loosely following the Clutter comment. (12.45 KB, patch)
2016-02-14 23:25 UTC, Ian Martin
none Details | Review
Version bump to 1.23.1 (767 bytes, patch)
2016-03-04 00:21 UTC, Ian Martin
committed Details | Review
Content implementation (6.13 KB, text/x-c++src)
2016-03-04 00:32 UTC, Ian Martin
  Details
Updated Actor class comment with code blocks correctly labelled (12.47 KB, patch)
2016-03-04 00:48 UTC, Ian Martin
committed Details | Review

Description Ian Martin 2016-02-11 03:19:27 UTC
Created attachment 320844 [details] [review]
configure.ac requires a version bump

see bug 760309; this series of patches starts from the 1.24 branch rather than master.
Comment 1 Ian Martin 2016-02-11 03:22:25 UTC
Created attachment 320845 [details] [review]
insert_child_at_index has a {?} parameter for the index which blocked the build.

the {?} parameter defaults to a null pointer, which causes a build failure.  Changed to normal parameter with index number required.
Comment 2 Ian Martin 2016-02-11 03:28:21 UTC
Created attachment 320846 [details] [review]
separates the cluttermm definitions of Image::set() and Image::set_data()

Image::set_data was wrapped to set() on the basis that the compiler would detect the difference between a guint8* and a Glib::Bytes& parameter, which is the only difference between clutter_image_set() and clutter_image_set_data().  However, this causes a runtime segfault when loading a Gdk::Pixbuf, so the wrapped methods are now separated into set() and set_data() methods in C++ as well.
Comment 3 Ian Martin 2016-02-11 03:30:53 UTC
Created attachment 320847 [details] [review]
make Content::invalidate() public

Content::invalidate() was wrapped as a private method, but needs to be called manually at times to force a redraw.  Moved from protected to public.
Comment 4 Ian Martin 2016-02-14 23:23:49 UTC
Created attachment 321165 [details] [review]
transition.hg corrections: added Activatable as interface, and corrected template code

Clutter::Transition inherits from Activatable, but also needs to recognise it as an interface.

set_to and set_from initialised the Glib::Value as the appropriate type, but failed to set the value; now fixed.
Comment 5 Ian Martin 2016-02-14 23:24:36 UTC
Created attachment 321166 [details] [review]
Changes Clutter::Timeline parameters from guint to unsigned int.
Comment 6 Ian Martin 2016-02-14 23:25:24 UTC
Created attachment 321167 [details] [review]
Adds a class comment to Clutter::Actor, loosely following the Clutter comment.
Comment 7 Murray Cumming 2016-02-24 13:22:27 UTC
Review of attachment 320844 [details] [review]:

1.23 would be better. An even number indicates API and ABI stability.
Comment 8 Murray Cumming 2016-02-24 13:31:04 UTC
Comment on attachment 320845 [details] [review]
insert_child_at_index has a {?} parameter for the index which blocked the build.

It's nice that C++11 and nullptr caught a real error.
Comment 9 Murray Cumming 2016-02-24 13:34:40 UTC
Comment on attachment 320846 [details] [review]
separates the cluttermm definitions of Image::set() and Image::set_data()

Thanks. I have pushed this, though I had to edit your commit message to not have a huge first line.

I'm trusting you that this is useful, though it doesn't make sense. It shouldn't be hard for the compiler to tell a pointer from a reference. A small test case, maybe even in the tests, would have shown if there is a real problem.
Comment 10 Murray Cumming 2016-02-24 13:36:35 UTC
Review of attachment 320847 [details] [review]:

Please give an example, in a comment in the code, of when this might need to be called from outside the implementation. The C documentation doesn't rule that our, but also doesn't suggest it:
https://developer.gnome.org/clutter/stable/ClutterContent.html#clutter-content-invalidate
Comment 11 Murray Cumming 2016-02-24 13:39:29 UTC
Comment on attachment 321165 [details] [review]
transition.hg corrections: added Activatable as interface, and corrected template code

Pushed, though I would really have preferred this to be 2 separate commits, because they are unrelated. Thanks.
Comment 12 Murray Cumming 2016-02-24 13:41:03 UTC
Review of attachment 321166 [details] [review]:

Why? guint is just a short way of saying unsigned int. We use guint in gtkmm and friends.
There doesn't seem to be any corresponding change in the C API: https://developer.gnome.org/clutter/stable/ClutterTimeline.html#clutter-timeline-set-duration
Comment 13 Murray Cumming 2016-02-24 13:44:43 UTC
(In reply to Murray Cumming from comment #9)
> I'm trusting you that this is useful, though it doesn't make sense.

This also broken "make check", though I've fixed that now. It would have made sense to change the example/test in the same commit as the API change.
Comment 14 Murray Cumming 2016-02-24 13:48:54 UTC
Review of attachment 321167 [details] [review]:

Thanks. Surprisingly, the markdown (?) syntax seems to work in Doxygen. But I still see some stray "|[" in the generated HTML.
Comment 15 Ian Martin 2016-03-02 23:42:11 UTC
(In reply to Murray Cumming from comment #9)
> Comment on attachment 320846 [details] [review] [review]
> separates the cluttermm definitions of Image::set() and Image::set_data()
> 
> Thanks. I have pushed this, though I had to edit your commit message to not
> have a huge first line.
> 
> I'm trusting you that this is useful, though it doesn't make sense. It
> shouldn't be hard for the compiler to tell a pointer from a reference. A
> small test case, maybe even in the tests, would have shown if there is a
> real problem.

I've got a content example working using both an image and a Cairo::Context; without invalidating the surface during construction the context wouldn't get drawn on.  I was planning on putting examples into the manual rather than the build; for one, it stops cluttermm from depending on too much, but happy to take advice on that.  Does it make sense to put a minimalist example that checks for the problem in tests?  And is there any FAQ on the Gtk GUI test environment?  I haven't been able to find anything useful.

The reason I've not posted the example to the manual is I'm trying to work my way through it, and have been stuck on containers for a week or two.  I've got a solution, but I'm not happy with it yet; I think it's better posted as a separate bug and will do that shortly.
Comment 16 Ian Martin 2016-03-02 23:52:19 UTC
> (In reply to Murray Cumming from comment #14)


> > Thanks. Surprisingly, the markdown (?) syntax seems to work in Doxygen. But > > I still see some stray "|[" in the generated HTML.

I had a number of attempts at getting the code in comments to read as code, and this is as good as it got.  Doxygen doesn't seem to recognise "language=C++" the same as it does "language=C", which may be part of the problem.  The "|[" are an unwanted anomaly, but when I take them out the generated text is formatted as normal text, which I find much harder to read.
Comment 17 Murray Cumming 2016-03-03 08:37:59 UTC
(In reply to Ian Martin from comment #15)
> (In reply to Murray Cumming from comment #9)
[snip]
> > A small test case, maybe even in the tests, would have shown if there is a
> > real problem.
> 
[snip]
> Does it make sense to put a minimalist
> example that checks for the problem in tests?

Yes, but a (unit) test is not an example.

>  And is there any FAQ on the
> Gtk GUI test environment?  I haven't been able to find anything useful.
[snip]

There are already a couple of tests in tests/. You can just do what is don so far. We can have useful tests, particularly for whether stuff even compiles, without testing actual UI behaviour.

However, in this case, you can't put a test in the project itself for API that you want to change anyway. But it would be nice to see a small test case her in this bug report to show that your API change is really necessary.
Comment 18 Murray Cumming 2016-03-03 08:42:21 UTC
(In reply to Ian Martin from comment #16)
> > (In reply to Murray Cumming from comment #14)
[snip]
> The "|[" are an unwanted anomaly, but when I take them out the
> generated text is formatted as normal text, which I find much harder to read.

In gtkmm we just use @code and @endcode and that seems to work fine:
https://git.gnome.org/browse/gtkmm/tree/gtk/src/dialog.hg#n145
Could you try that, please.
Comment 19 Ian Martin 2016-03-04 00:21:30 UTC
Created attachment 323041 [details] [review]
Version bump to 1.23.1

As requested
Comment 20 Ian Martin 2016-03-04 00:32:05 UTC
Created attachment 323042 [details]
Content implementation

(In reply to Murray Cumming from comment #9)
> Comment on attachment 320846 [details] [review] [review]
[snip]
> I'm trusting you that this is useful, though it doesn't make sense. It
> shouldn't be hard for the compiler to tell a pointer from a reference. A
> small test case, maybe even in the tests, would have shown if there is a
> real problem.

File attached that uses the two Content classes to fill Actors.  The problems with creating a test case:
1) Image::set() was failing silently, so it all compiled fine; it was just no image was being displayed.
2) Without Context::invalidate(), the code is all fine, but draw() was never called, so again the only way to tell if it was working was to see if the image displayed or not. Currently I don't understand how to use the Gtk test harness to create GUI tests (if it can).
Comment 21 Ian Martin 2016-03-04 00:48:20 UTC
Created attachment 323043 [details] [review]
Updated Actor class comment with code blocks correctly labelled

original patch, plus changed code blocks to use @code and @endcode
Comment 22 Ian Martin 2016-03-04 01:29:28 UTC
I've created bug 763073 for a challenging (for me at least) Actor::allocate problem.  Should I continue pushing other patches to this bug or start another?
Comment 23 Murray Cumming 2016-03-21 08:59:39 UTC
(In reply to Ian Martin from comment #20)
> File attached that uses the two Content classes to fill Actors.  The
> problems with creating a test case:
> 1) Image::set() was failing silently, so it all compiled fine; it was just
> no image was being displayed.

It works fine for me when I change set_data() back to set() and use that instead. I can see no reason why the set(const Glib::Bytes& data, ...) override would be used instead when calling set() with guint* from Gdk::Pixbuf::get_pixels(). I plan to change this back.

> 2) Without Context::invalidate(), the code is all fine, but draw() was never
> called, so again the only way to tell if it was working was to see if the
> image displayed or not. 

Yes, that invalidate call does seem to be necessary, though I've used it like so until make the chang in cluttermm:
  clutter_content_invalidate(CLUTTER_CONTENT(canvas->gobj()));
However, the clutter_content_invalidate() documentation clearly says that this should not be necessary outside of the ClutterCanvas class:
  https://developer.gnome.org/clutter/stable/ClutterContent.html#clutter-content-invalidate
So please try to create a small C test case/example that shows that this is necessary, and then file a clutter bug. In that way, we might discover that it's a cluttermm bug.
Comment 24 Murray Cumming 2016-03-21 09:01:34 UTC
(In reply to Murray Cumming from comment #12)
> Review of attachment 321166 [details] [review] [review]:
> 
> Why? guint is just a short way of saying unsigned int. We use guint in gtkmm
> and friends.
> There doesn't seem to be any corresponding change in the C API:
> https://developer.gnome.org/clutter/stable/ClutterTimeline.html#clutter-
> timeline-set-duration

You didn't reply to this. I assume that you agree so I've rejected that particular parth.
Comment 25 Ian Martin 2016-03-21 12:54:42 UTC
(In reply to Murray Cumming from comment #24)
> (In reply to Murray Cumming from comment #12)
> > Review of attachment 321166 [details] [review] [review] [review]:
> > 
> > Why? guint is just a short way of saying unsigned int. We use guint in gtkmm
> > and friends.
> > There doesn't seem to be any corresponding change in the C API:
> > https://developer.gnome.org/clutter/stable/ClutterTimeline.html#clutter-
> > timeline-set-duration
> 
> You didn't reply to this. I assume that you agree so I've rejected that
> particular patch.
Sorry.
Yes, correct; if guint is appropriate in gtkmm then leave it in.
Comment 26 Ian Martin 2016-03-21 13:04:58 UTC
(In reply to Murray Cumming from comment #23)
> (In reply to Ian Martin from comment #20)
> > File attached that uses the two Content classes to fill Actors.  The
> > problems with creating a test case:
> > 1) Image::set() was failing silently, so it all compiled fine; it was just
> > no image was being displayed.
> 
> It works fine for me when I change set_data() back to set() and use that
> instead. I can see no reason why the set(const Glib::Bytes& data, ...)
> override would be used instead when calling set() with guint* from
> Gdk::Pixbuf::get_pixels(). I plan to change this back.
> 
> > 2) Without Context::invalidate(), the code is all fine, but draw() was never
> > called, so again the only way to tell if it was working was to see if the
> > image displayed or not. 
> 
> Yes, that invalidate call does seem to be necessary, though I've used it
> like so until make the change in cluttermm:
>   clutter_content_invalidate(CLUTTER_CONTENT(canvas->gobj()));
> However, the clutter_content_invalidate() documentation clearly says that
> this should not be necessary outside of the ClutterCanvas class:
>  
> https://developer.gnome.org/clutter/stable/ClutterContent.html#clutter-
> content-invalidate
> So please try to create a small C test case/example that shows that this is
> necessary, and then file a clutter bug. In that way, we might discover that
> it's a cluttermm bug.

OK, if Image::set() works for you, it's not needed.  It appeared to be a required change when I was working on it.

Looking again, the approved alternative to making Content::invalidate() public is to call Canvas::set_size() passing the current width and height as parameters.   I'd argue that's not very intuitive (that's one reason why it took me a while to find it), but if that's the best way of keeping invalidate() private I guess it should be done.  When I get time I'll add a class comment to make sure it's documented.
Comment 27 Murray Cumming 2016-03-21 13:13:22 UTC
(In reply to Ian Martin from comment #26)
> Looking again, the approved alternative to making Content::invalidate()
> public is to call Canvas::set_size() passing the current width and height as
> parameters.

Based on what documentation or conversation?
Comment 28 Ian Martin 2016-03-24 03:04:47 UTC
Based on some code I can no longer find.  The documentation you mention appears to have changed for clutter_content_invalidate()- there's no longer any reference to limiting its use.

The clutter examples - https://git.gnome.org/browse/clutter/tree/examples/canvas.c?h=clutter-1.18
https://git.gnome.org/browse/clutter/tree/examples/rounded-rectangle.c?h=clutter-1.18
 use clutter_content_invalidate().  So it looks like invalidate() should be public API.
Comment 29 Murray Cumming 2016-03-28 18:55:17 UTC
It still says "This function should be called by ClutterContent implementations" though it explicitly doesn't forbid other use.
https://developer.gnome.org/clutter/stable/ClutterContent.html#clutter-content-invalidate

I would be very surprised if the ClutterCanvas API demanded its use. Please see my comment #23 about creating a test case and a bug.
Comment 30 Murray Cumming 2016-08-21 08:45:26 UTC
So, I think I've dealt with all these patches, though comment #23 and #29 might still be interesting. If they are, someone might create a new bug about them.