我正在尝试使用pixbuf,我使用了gdk3方法和gdk2方法,两者都失败了。在这里使用ctypes,但问题不是ctypes,我确信它,所以标记这将混淆ctypes民谣。所以我只放了gtk标签。
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 src_x = 0;
var src_y = 0;
var pixbuf = ostypes.API('gdk_pixbuf_get_from_window')(cRootWin, src_x, src_y, cWidth, cHeight);
然后抛出这个:
(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
有谁知道最新消息?我现在很难解决这个问题:(
代替gdk 3方法,我尝试了gdk2方法,它崩溃了:
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);
这会在终端中使用此消息导致浏览器崩溃:
[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.
我几天都无法解决这个问题,请你指教。