Bug 47141 - Xkl-1.0.gir causes a build error in vapigen
Summary: Xkl-1.0.gir causes a build error in vapigen
Status: RESOLVED FIXED
Alias: None
Product: libxklavier
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Sergey V. Udaltsov
QA Contact: Sergey V. Udaltsov
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-09 02:35 UTC by Takao Fujiwara
Modified: 2012-11-13 03:55 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Takao Fujiwara 2012-03-09 02:35:25 UTC
I'd like to use libgnomekbd with vala and currently Gkbd-3.0.gir uses Xkl-1.0.gir.

When I run vapigen, it causes a build error.

% vapigen /usr/share/gir-1.0/Gkbd-3.0.gir --library gkbd --pkg gtk+-3.0 --pkg glib-2.0 --pkg gmodule-2.0
Xkl-1.0.gir:877.51-877.51: error: The type name `X.XEvent' could not be found
            <type name="xlib.XEvent" c:type="XEvent*"/>
                                                  ^
Generation failed: 1 error(s), 0 warning(s)


Do you have any ideas to resolve this or a workaround?
Comment 1 Sergey V. Udaltsov 2012-03-09 11:42:35 UTC
vapigen is trying to introspect X11 API which is obviously not introspectable. And X11 API will not be introspectable ever. How can you explain that to vapigen?
Comment 2 Sergey V. Udaltsov 2012-03-09 11:45:58 UTC
I could hide xkl_engine_filter_events from introspection but I would not like to do it.
Comment 3 Sergey V. Udaltsov 2012-03-09 11:54:45 UTC
Tried to add the (skip) attribute to that parameter. Could you please check from git?
Comment 4 Takao Fujiwara 2012-03-09 18:11:26 UTC
I tried the skip but it seems that way does not resolve the problem.

% vapigen /usr/share/gir-1.0/Gkbd-3.0.gir --library gkbd \
  --pkg gtk+-3.0 --pkg glib-2.0 --pkg gmodule-2.0
Xkl-1.0.gir:877.54-877.54: error: The type name `X.XEvent' could not be found
            <type name="xlib.XEvent" c:type="XEvent*" skip="1"/>
                                                     ^

I don't know if Xkl-1.0.metadata can resolve this.
http://live.gnome.org/Vala/Bindings
Comment 5 Takao Fujiwara 2012-03-09 18:21:04 UTC
I mean the change does not resolve this problem.

--- Xkl-1.0.gir.orig
+++ Xkl-1.0.gir
@@ -871,7 +871,7 @@
           <type name="gint" c:type="gint"/>
         </return-value>
         <parameters>
-          <parameter name="evt" transfer-ownership="none">
+          <parameter name="evt" transfer-ownership="none" skip="1">
             <doc xml:whitespace="preserve">delivered X event</doc>
             <type name="xlib.XEvent" c:type="XEvent*"/>
           </parameter>
Comment 6 Sergey V. Udaltsov 2012-03-10 00:46:38 UTC
I guess it is a bug in vapigen then - it should ignore the parameters marked as "skip", according to the introspection docs:

http://live.gnome.org/GObjectIntrospection/Annotations

(skip) used to indicate that the parameter or return value is only useful in C and should be skipped (bug)

What do you think?
Comment 7 Takao Fujiwara 2012-03-11 23:04:03 UTC
OK, it seems this problem can be fixed by Xkl-1.0.metadata

# cat Xkl-1.0.metadata 
Xkl cheader_filename="libxklavier/xklavier.h"
Engine.filter_events.evt ref type="X.Event"


# vapigen /usr/share/gir-1.0/Gkbd-3.0.gir --library gkbd --metadatadir=. \
  --pkg gtk+-3.0 --pkg glib-2.0 --pkg gmodule-2.0

It might be good if libgnomekbd could provide gkbd.vapi. Currently I generate gkbd.vapi during the ibus build.
Comment 8 Sergey V. Udaltsov 2012-03-12 04:06:53 UTC
> It might be good if libgnomekbd could provide gkbd.vapi. Currently I generate
> gkbd.vapi during the ibus build.
I do not mind, if that is the standard practice for gnome libraries. What do other libraries do in relation to vapi?
Comment 9 Takao Fujiwara 2012-03-12 19:03:24 UTC
(In reply to comment #8)
> > It might be good if libgnomekbd could provide gkbd.vapi. Currently I generate
> > gkbd.vapi during the ibus build.
> I do not mind, if that is the standard practice for gnome libraries. What do
> other libraries do in relation to vapi?

The vala files are maintained as source codes only. 'valac --ccode' can convert the vala files to C files.

e.g.

% cat Xkl-1.0.metadata 
Xkl cheader_filename="libxklavier/xklavier.h"
Engine.filter_events.evt ref type="X.Event"

% cat Gkbd-3.0.metadata
Configuration cheader_filename="libgnomekbd/gkbd-configuration.h"

% vapigen /usr/share/gir-1.0/Gkbd-3.0.gir --library gkbd --metadatadir=. \
  --pkg gtk+-3.0 --pkg glib-2.0 --pkg gmodule-2.0

% ls
a.vala gkbd.vapi Xkl-1.0.metadata Gkbd-3.0.metadata

% cat a.vala
using Gkbd;

private Gkbd.Configuration m_config = null;

public static int main (string[] argv) {
    m_config = Gkbd.Configuration.get();
    return 0;
}

% valac --vapidir . \
  --pkg gkbd --pkg gtk+-3.0 --pkg gmodule-2.0 --pkg Xkl-1.0 \
  --metadatadir . --ccode \
  a.vala

% ls
a.c a.vala gkbd.vapi Xkl-1.0.metadata Gkbd-3.0.metadata
Comment 10 Sergey V. Udaltsov 2012-03-13 02:43:04 UTC
Ok, feel free to submit the patch
Comment 11 Daiki Ueno 2012-11-13 03:39:57 UTC
(In reply to comment #10)
> Ok, feel free to submit the patch

The patch has ever been submitted?  If nobody minds I can file a slightly modified version (for Caribou) to vala itself, which might make more sense because libxklavier wouldn't need extra dependency to vapigen.
Comment 12 Takao Fujiwara 2012-11-13 03:55:53 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > Ok, feel free to submit the patch
> 
> The patch has ever been submitted?  If nobody minds I can file a slightly
> modified version (for Caribou) to vala itself, which might make more sense
> because libxklavier wouldn't need extra dependency to vapigen.

Great. I'm a bit busy to work on it.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.