I am trying to get a pixbuf, i used gdk3 method and gdk2 method and both are failing. Using ctypes here but issue is not ctypes, I'm sure of it, so tagging with that would confuse the ctypes folk. So I only put gtk tags.
GDK3 method
var cRootWin = ostypes.API('gdk_screen_get_root_window')(cScreen);
var cWidth = ostypes.API('gdk_screen_get_width')(cScreen);
var cHeight = ostypes.API('gdk_screen_get_height')(cScreen);
no errors happen. I then run this code:
var src_x = 0;
var src_y = 0;
var pixbuf = ostypes.API('gdk_pixbuf_get_from_window')(cRootWin, src_x, src_y, cWidth, cHeight);
and it then throws this:
(firefox:2624): GLib-GObject-WARNING **: cannot register existing type 'GdkWindow'
(firefox:2624): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(firefox:2624): Gdk-CRITICAL **: gdk_pixbuf_get_from_window: assertion 'GDK_IS_WINDOW (src)' failed
Does anyone know whats up? I can't figure this out for a long time now :(
GDK2 method
In place of the gdk 3 method I tried the gdk2 method and it crashes:
var cRootWin = ostypes.API('gdk_screen_get_root_window')(cScreen);
var cWidth = ostypes.API('gdk_screen_get_width')(cScreen);
var cHeight = ostypes.API('gdk_screen_get_height')(cScreen);
var dest_x = 0;
var dest_y = 0;
var src_x = 0;
var src_y = 0;
var pixbuf = ostypes.API('gdk_pixbuf_get_from_drawable')(null, cRootWin, null, src_x, src_y, dest_x, dest_y, cWidth, cHeight);
This crashes the browser with this message in terminal:
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
firefox: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
firefox: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
I can't figure this out for a couple days, can you please advise.