[Vala] xcb vapi
- From: Stefan Risberg <steffenomak gmail com>
- To: vala-list gnome org
- Subject: [Vala] xcb vapi
- Date: Sat, 4 Feb 2012 21:44:18 +0100
is it broken in the newest vala? Or am I doing something wrong?
I "know" how to fix it but I don't have a clue if I'm actually just
doing something bad.
Here is some badly written code that prohibits compilation.
class Main : GLib.Object
{
Main()
{
int screen_num;
Xcb.Connection conn = new Xcb.Connection(null, out screen_num);
Xcb.Screen screen = get_screen(conn, screen_num);
stdout.printf ("\n");
stdout.printf (" width.........: %d\n", screen.width_in_pixels);
stdout.printf (" height........: %d\n", screen.height_in_pixels);
stdout.printf (" white pixel...: %ld\n", screen.white_pixel);
stdout.printf (" black pixel...: %ld\n", screen.black_pixel);
stdout.printf ("\n");
Xcb.Window win = conn.generate_id();
conn.create_window(Xcb.COPY_FROM_PARENT,
win,
screen.root,
0, 0,
600, 400,
0,
Xcb.WindowClass.INPUT_OUTPUT,
screen.root_visual,
0, null);
conn.map_window(win);
conn.flush();
SDL.Timer.delay(3000);
}
Xcb.Screen get_screen(Xcb.Connection conn, int screen_num)
{
Xcb.Setup setup = conn.get_setup();
Xcb.ScreenIterator iter = setup.roots_iterator();
for(int i = 0; i < screen_num; i++)
Xcb.ScreenIterator.next(ref iter);
return iter.data;
}
public static int main(string[] args)
{
new Main();
return 0;
}
}
It will complain that XcbVisualID doesn't exist but in the vapi it
looks like this
public struct VisualID : uint32
{}
but I changed it to
[CCode (cname = "unsigned int")]
and it worked. There are other places that complain about the same
stuff, but this was the easiest to describe.
So am I doing something wrong, if not how should the correct way to
fix the problem above?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]