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 363103 - roll Gail's ATK support for gnomecanvas (gailcanvas*) into libgnomecanvas
roll Gail's ATK support for gnomecanvas (gailcanvas*) into libgnomecanvas
Status: RESOLVED FIXED
Product: libgnomecanvas
Classification: Deprecated
Component: core
CVS HEAD
Other All
: Normal enhancement
: ---
Assigned To: Sven Herzberg
Federico Mena Quintero
Depends on: 363128 450093
Blocks: 169488
 
 
Reported: 2006-10-18 10:15 UTC by bill.haneman
Modified: 2007-12-10 18:40 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
patch which adds the gnome-canvas a11y code formerly in gail to libgnomecanvas (87.89 KB, patch)
2006-10-18 12:47 UTC, bill.haneman
none Details | Review
patch incorporating suggestions (88.47 KB, patch)
2006-11-14 10:22 UTC, bill.haneman
needs-work Details | Review
patch that incorporates all suggestions (87.03 KB, patch)
2007-01-15 19:32 UTC, bill.haneman
none Details | Review
fixed patch incorporating all suggestions plus ChangeLog (85.94 KB, patch)
2007-01-17 12:49 UTC, bill.haneman
none Details | Review
patch to fix focused_item problem (419 bytes, patch)
2007-05-30 10:39 UTC, Li Yuan
committed Details | Review
patch to add a new property (1.58 KB, patch)
2007-07-25 04:31 UTC, Li Yuan
reviewed Details | Review

Description bill.haneman 2006-10-18 10:15:16 UTC
This is required in order to move gail into gtk+ core, an RFE which the accessibility and gtk+ teams have slated for the next gtk+ release.

Since gail currently depends on libgnomecanvas, we need to move gail's gnomecanvas code into libgnomecanvas itself before moving gail into gtk+.  This is appropriate and sensible since all other gnome libraries which contain custom widgets already have their ATK support provided internally, rather than relying on gail to provide it.
Comment 1 bill.haneman 2006-10-18 12:47:37 UTC
Created attachment 74943 [details] [review]
patch which adds the gnome-canvas a11y code formerly in gail to libgnomecanvas
Comment 2 Sven Herzberg 2006-11-11 10:14:33 UTC
Thanks for providing this patch. I'm going to take a detailed look at it on the plane tomorrow.
Comment 3 Sven Herzberg 2006-11-12 18:43:43 UTC
Hey Bill,

  these files look like they have been just moved from gail (which isn't a problem as I would have started the same way). But I think you agree that the code in Gnome should always be in a shape as good as possible. Especially this code (which is likely to be copied by me into my cairo based canvas) should be reusable as easy as possible and to achieve this (along with some more consistency with the rest of the stack) I'd like to address some glitches with the current code:

1. Please use G_DEFINE_TYPE() or G_DEFINE_TYPE_WITH_CODE() to define GObject types. This makes the current code easier, will give you »parent_class« features for free and is less likely to contain errors (such a macro might also be updated by the glib maintainers and GNOME canvas would get these updates for free then).

2. Please use G_BEGIN_DECLS and G_END_DECLS in the header files (might require additional including of <glib/gmacros.h>) to be more consistent with the rest of the platform.

3. Please don't use statements like this:
> typedef struct _GailCanvas GailCanvas;
...
> struct _GailCanvas
> {
>   GailWidget parent;
> };
A simpler solution would be this:
> typedef GailWidget GailCanvas;
(which would also apply to ...Class as well)

4. Can you please add documentation to the functions that are accessible (like gail_canvas_item_new()), this would make both the review and the quality of the code better.

5. As this code doesn't seem to be public API, can you please add a file that explains both the purpose of the code (which is quite obvious) and how this code is supposed to be used by applications?

(I'm not yet finished reading your patch, so maybe skip 5. - if already done - but at least be prepared for more to come - even though I doubt it)
Comment 4 Sven Herzberg 2006-11-12 18:54:23 UTC
There was just one more:

6. Please don't export instance members in the header files (like in the following snippet):
> struct _GailCanvasText
> {
>   GailCanvasItem parent;
>   GailTextUtil *textutil;
> };

Please use a private structure in the C-File. If textutil needs to be accessed from other pieces than gailcanvastext.c, please provide an API for working with this member.

Thanks.
Comment 5 bill.haneman 2006-11-13 11:29:22 UTC
Hi Sven;

A couple of comments:

1) the use of internal struct members was common in gtk+ when these Gail classes were originally written.  Changing that now may do considerable violence to the gail code, though we could peck away at it class-by-class.

2) gailwidget.h needs to be exported for this patch to work, and gailwidget's struct definitely requires internal members that are directly accessed.  Fixing that is too big a diff for gail to be practical.

We have never been asked to document internal-only methods, in particular constructors like gail_canvas_item_new() which are NEVER called outside of the library.  I don't think it's really appropriate since the docs would just say "do not call this method, it is an implementation detail required by GailCanvas".

I disagree about using typedef instead of ...
> struct _GailCanvas
> {
>   GailWidget parent;
> };
since the above is a pattern which is consistently repeated throughout Gail (sometimes with added structs, sometimes not).  Since we don't guarantee ABI stability of GailCanvas, new internal structs could be added at any time, which would invalidate the typedef.

best regards

Bill
Comment 6 bill.haneman 2006-11-13 11:33:30 UTC
to follow up point-by-point:

#1 and #2 are OK by me (though personally I find the macros obfuscating); #3 is not; I don't see the value in #4; #5 and #6 are OK.
Comment 7 bill.haneman 2006-11-13 19:22:29 UTC
OK; revisiting;

#1: existing gnome-canvas code doesn't use these macros.  I think that 
    it makes more sense for you to add them if/when you move this code to the new   
    cairo canvas.
#2: sure, OK, though these macros didn't exist when gail was written either.
#3: patch is consistent with existing gnome-canvas code 
     (see GnomeCanvasLineClass in gnome-canvas-line.h)
#4: methods are used only by the factory instances.
#5: there's no public API here, I guess we need to say that?
#6: Not sure how to handle this one most elegantly. Making a new priv struct to hold this single member seems like overkill to me.
Comment 8 bill.haneman 2006-11-14 10:22:27 UTC
Created attachment 76554 [details] [review]
patch incorporating suggestions
Comment 9 Sven Herzberg 2006-11-14 14:10:37 UTC
> I disagree about using typedef instead of ...
> > struct _GailCanvas
> > {
> >   GailWidget parent;
> > };
> since the above is a pattern which is consistently repeated throughout Gail
> (sometimes with added structs, sometimes not).  Since we don't guarantee ABI
> stability of GailCanvas, new internal structs could be added at any time, which
> would invalidate the typedef.

Good point. Convinced.

And for point 4, can you at least tell me how this code is supposed to work? As no application is supposed to use that code, how is it used? (I'm just not familiar with gail and I just like to get some information about it.)
Comment 10 Sven Herzberg 2006-11-14 14:14:08 UTC
Now commenting on the new patch. It would be great if you could use G_DEFINE_TYPE() (former point #1), then it looks okay (except for a missing dependency on gail in the .pc.in file).
Comment 11 bill.haneman 2006-11-14 15:01:01 UTC
Hi Sven:

I'll add some docs to the exported methods (at least the key ones) to give at least a hint how the system works (with pointers to the atk docs if I can figure out how to include non-volatile references to other modules' api docs)

As for G_DEFINE_TYPE, I notice that none of the other classes in libgnomecanvas use these macros, so the existing patch is consistent with the rest of libgnomecanvas.  Since libgnomecanvas is expected to be supplanted by a new canvas Real Soon Now, perhaps it doesn't make sense to add these macros now.  Besides, for technical reasons we cannot use G_DEFINE_TYPE or G_DEFINE_TYPE_WITH_CODE in gailcanvas.c (though we could potentially use it for the other classes).

I believe the gail dependency is gone from the new patch; I will double-check.  
Comment 12 Sven Herzberg 2006-11-22 12:49:59 UTC
> Since libgnomecanvas is expected to be supplanted by a new canvas Real Soon
> Now, perhaps it doesn't make sense to add these macros now.

That was exactly the reason why I requested using these macros. Once the new canvas is there, we could easily copy the files from gnome canvas into the new canvas (but, I'm fine if you don't agree on this one).

Small wrap up:
1. Do you think it makes sense to use G_DEFINE_TYPE() where possible?
2. Can you please add a small piece of documentation on how this code is supposed
   to be used? (eg. gailcanvasfactory)
3. Please check for the dependecy on gail and either remove it or also add it to
   the .pc.in file (as it doesn't appear in public headers it should go into the
   private requirements field).
4. Please also add the gail* files to the doc/reference/Makefile.am to prevent
   gtk-doc from scanning these files.
Comment 13 bill.haneman 2006-11-23 10:34:24 UTC
Hi Sven: Thanks for feedback.  I'll make the suggested changes above and revise the patch - could take me about a week though as I'm travelling. - Bill
Comment 14 Sven Herzberg 2006-12-19 15:52:39 UTC
Bill, any news on this?
Comment 15 bill.haneman 2006-12-23 20:44:24 UTC
On holiday, virtually no internet access ATM.  however you're welcome to make the changes to my patch yourself if you prefer - otherwise I'll try to revise 2nd wk in Jan.
Comment 16 bill.haneman 2007-01-15 19:32:28 UTC
Created attachment 80329 [details] [review]
patch that incorporates all suggestions

Need assistance figuring out why gtk-doc scan recurses forever with the new patch.  It seemed to be working fine until the last 'make clean'; 'make' cycle.  ?
Comment 17 bill.haneman 2007-01-17 12:49:15 UTC
Created attachment 80501 [details] [review]
fixed patch incorporating all suggestions plus ChangeLog

I found the bug that was causing gtk-doc-scan issues.  Sven, does the attached patch look OK to you?
I did not document anything that was explicitly excluded in the gtk-doc-scan headers, since this is private API.  A few symbols are exported for purely technical reasons, as they always were in the previous gail implementation.

I think this patch should coexist reasonably with legacy gail, i.e. the factories for gnomecanvas as defined by gail should be replaced by the libgnomecanvas ones transparently.  If this doesn't work as expected, we can either change the namespace of the methods or remove the gnomecanvas code from gail and release the two new tarballs in sync (so libgnomecanvas HEAD would require gail HEAD).  If we don't have to do the latter, it's better IMO even though some loaders may complain about duplicate symbols.
Comment 18 bill.haneman 2007-01-22 11:02:45 UTC
Sven: ping?
(BTW my above notes about duplicate symbols are theoretical, I haven't observed any problems on my system).
Comment 19 Kjartan Maraas 2007-04-20 14:36:43 UTC
Herzi, ping?
Comment 20 Sven Herzberg 2007-04-20 14:54:20 UTC
Sorry, will look at the patch on the way to my parents.
Comment 21 Li Yuan 2007-05-16 02:43:57 UTC
Hi Sven, we are looking forward to move gail into gtk+ and libgnomecanvas as soon as possible. And the gtk+ is blocked by libgnomecanvas. Can you take a look at the patch when you get time?
Comment 22 Sven Herzberg 2007-05-23 12:17:18 UTC
Sorry, for waiting so long. I just forgot about this patch. It's committed to trunk now.
Comment 23 Sven Herzberg 2007-05-24 09:52:12 UTC
It looks like the dependency on gail was not so clever right now. Please remove the canvas stuff from gail-TRUNK and also the canvas dependency from gail so we don't get a circular dependency by having the canvas depend on gail and gail on the canvas.

I'm reverting the commit now and will commit it back after gail is fixed (and please also change the dependencies for gail in jhbuild).
Comment 24 Li Yuan 2007-05-25 12:27:09 UTC
OK, working on the patch. Maybe we need the make a little change. We usually use gail.c to handle the focus event. Since gail will not depend on gnomecanvas, we have to do this in gailcanvas.c. Working on the patch.
Comment 25 Li Yuan 2007-05-30 10:39:29 UTC
Created attachment 89047 [details] [review]
patch to fix focused_item problem

Gail need to get gnomecanvas->focused_item when focus changed. Since gail will not depand on libgnomecanvas, we can not use gnomecanvas->focused_item directly. This patch make gail can get the focused_item by g_object_get_data.
Comment 26 Li Yuan 2007-05-30 10:41:25 UTC
If the patch is OK, I will remove the libgnomecanvas dependency as soon as possible. (our patch is ready)
Comment 27 Li Yuan 2007-06-04 03:11:35 UTC
Hi Sven, is the patch OK? If it is OK I think we still can catch up with gnome 2.19.3, I will commit gail patch first.
Comment 28 Sven Herzberg 2007-06-04 10:04:06 UTC
2007-06-04  Sven Herzberg  <herzi@gnome-de.org>

        Patch from Li Yuan:

        * libgnomecanvas/gnome-canvas.c: (gnome_canvas_item_grab_focus):
        store the focused item in the "focused_item" object data of the canvas
        (required for gail to drop the dependency on libgnomecanvas)
Comment 29 Li Yuan 2007-06-04 13:54:00 UTC
Will you release libgnomecanvas tonight for gnome 2.19.3? If you will, I think I can apply the gail part of patch and you apply the gnomecanvas part. What do you think?
Comment 30 Li Yuan 2007-06-04 15:12:10 UTC
It's too late here... I'd like to release tarball first and will commit the patch tomorrow.
Comment 31 Li Yuan 2007-06-05 08:21:46 UTC
I have committed the gail part of patch. And filed a bug for jhbuild: http://bugzilla.gnome.org/show_bug.cgi?id=444257
Comment 32 Li Yuan 2007-06-05 09:21:06 UTC
OK, the patches has been committed. You can commit your patch now.
Comment 33 Li Yuan 2007-06-08 03:55:45 UTC
Hi Sven, I guess it is the time to commit libgnomecanvas part of patch?
Comment 34 Li Yuan 2007-06-13 06:57:06 UTC
Sven, ping...
Comment 35 Sven Herzberg 2007-06-14 13:52:48 UTC
I can't release tarballs (I have no ssh-account on master). Maybe kjartan can...
Comment 36 Li Yuan 2007-06-14 15:15:26 UTC
It's OK. Can you commit the patch first?
Comment 37 Li Yuan 2007-06-21 06:25:00 UTC
Hi Sven, it would be great if you commit the patch. Because I have commit the gail part of patch for several weeks. People who build gail from trunk may miss some functions.
Comment 38 christopher taylor 2007-07-10 19:50:51 UTC
Shouldn't the file

/libgnomecanvas/libgnomecanvas-2.0.pc.in

contain

Requires.private: pango pangoft2 gail

instead of:

Requires.private: pango pangoft2 gail-1.0

??
Gail-1.19.5 installs only gail.pc.
Comment 39 Sven Herzberg 2007-07-11 08:07:23 UTC
(In reply to comment #38)
> Shouldn't the file
> 
> /libgnomecanvas/libgnomecanvas-2.0.pc.in
> 
> contain
> 
> Requires.private: pango pangoft2 gail
> 
> instead of:
> 
> Requires.private: pango pangoft2 gail-1.0
> 
> ??
> Gail-1.19.5 installs only gail.pc.
> 

This was bug 455605.
Comment 40 Daniel Macks 2007-07-24 15:19:41 UTC
Not sure whether bug #456513 indicates a problem with the added gail support, or is a problem that this new gail stuff fixed, or whether 2.19.1 just caught the gail migration at a bad time.
Comment 41 Li Yuan 2007-07-25 04:31:39 UTC
Created attachment 92325 [details] [review]
patch to add a new property

Just realized that all applications can modify gnome_canvas->focused_item. So we can not get the right focused_item just by g_object_set_data/g_object_get_data. I think install a new property is a good idea. This is a change of API and the API freeze will be on July 30,. Herzi, can you help me to review the patch? It is really urgent because all object in gnome_canvas can not be accessible now.
Comment 42 Sven Herzberg 2007-07-25 08:16:19 UTC
I don't see how this patch solves any problem. Can you add some more explanations? (also it would be great if these things get reported as new bugs - as gailcanvas is merged into gnome canvas).
Comment 43 Li Yuan 2007-07-25 08:38:09 UTC
Applications like Evolution use gnome_canvas and set gnome_canvas->focused_item (e-canvas.c:e_canvas_item_grab_focus).
We can not add g_object_set_data to every application which set focused_item. So sometime gail can not get the right focused_item by calling g_object_get_data(because we only set data in gnomecanvas now). A good solution is property. So gail can get focused_item by calling g_object_get_property which fetches focused_item directly from gnomecanvas.

I will file a new bug next time. Do you want a new bug for this patch?
Comment 44 Li Yuan 2007-07-26 10:41:24 UTC
Herzi, any comments on the patch?
Comment 45 Sven Herzberg 2007-07-26 11:20:55 UTC
2007-07-26  Sven Herzberg  <herzi@gnome-de.org>

        * libgnomecanvas/gnome-canvas.c: don't store the focused item in the
        data section of the canvas widget, but in a GObject property of it
        (Patch by Li Yuan, fixes 363103)
Comment 46 Kjartan Maraas 2007-07-26 18:48:58 UTC
I can make a tarball if that's wanted at this time?
Comment 47 Sven Herzberg 2007-07-26 22:06:04 UTC
(In reply to comment #46)
> I can make a tarball if that's wanted at this time?

Go ahead if you feel like it :-)
Comment 48 Li Yuan 2007-07-27 04:32:04 UTC
Thank you very much Herzi and Kjartan :)