Re: gjs and Gdk.cairo_create()



2010/8/12 Youry Harchenko <youry ukr net>:
> Hello!
>
> There is gjs-script:
>
> const Gtk = imports.gi.Gtk;
> const Gdk = imports.gi.Gdk;
>
> function draw(obj, event) {
>     let cr = Gdk.cairo_create(obj.window);
> }
>
> Gtk.init(null, null);
>
> let win = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL, title: "Test"});
> win.connect("destroy", Gtk.main_quit);
>
> let da = new Gtk.DrawingArea();
> da.connect("expose_event", draw);
>
> win.add(da);
>
> win.show_all();
>
> Gtk.main();
>
> Here is the result of the script :
>
>     JS ERROR: !!!   Exception was: Error: No exception was set, but object
> construction failed somehow
>     JS ERROR: !!!     lineNumber = '0'
>     JS ERROR: !!!     fileName = 'gjs_throw'
>     JS ERROR: !!!     message = 'No exception was set, but object
> construction failed somehow'
>     JS ERROR: !!!     stack = 'Error("No exception was set, but object
> construction failed somehow")@:0
> ("No exception was set, but object construction failed somehow")@gjs_throw:0
> @:0
> draw([object _private_Gtk_DrawingArea],[object
> _private_Gdk_Event])@test.js:5
> Error("Chained exception")@:0
> ("Chained exception")@gjs_throw:0
> '
>
> What is the reason?
>
> I used:
>
> Linux Mandriva 2010.1 x86-64
> gjs  0.6

I just checked the git history, 0.6 is too old for gtk<->cairo
integration to work, you need 0.7 or later.

-- 
Johan Dahlin


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]