Hello everybody! It's me with my incomplete-xcb-binding again...
To create a window with XCB, I have to call the xcb_create_window()
function. It has the following prototype:
xcb_void_cookie_t
xcb_create_window (xcb_connection_t *c,
uint8_t depth,
xcb_window_t wid,
xcb_window_t parent,
int16_t x,
int16_t y,
uint16_t width,
uint16_t height,
uint16_t border_width,
uint16_t _class,
xcb_visualid_t visual,
uint32_t value_mask,
const uint32_t *value_list);
I wrote the following Smalltalk code to call this function:
Xcb class >> createWindow: aConnection depth: aDepth windowId: wID
parent: parentID x: posX y: poxY width: aWidth height: aHeight
borderWidth: bWidth class: aClass visual: aVisual valueMask: aMask
valueList: aList [
<cCall: 'xcb_create_window' returning: #void args:
#(#cObject #char #uInt #uInt #short #short #ushort #ushort
#ushort #ushort #uInt #uInt #cObject)>
]
(Yes, its ugly)
When I execute it, I get
`--> gst -f xcbroot.st
xcbroot.st:94: Aborted
xcbroot.st:94: Error occurred while not in byte code interpreter!!
/lib/i686/cmov/libc.so.6(abort+0x188)[0xb7cd3d68]
/usr/local/bin/../lib/libgst.so.7[0xb7e76d19]
zsh: abort gst -f xcbroot.st
If I will write simple wrapper in my library like...
void
gst_xcb_create_window
(...the same arguments as for xcb_create_window...)
{
xcb_create_window (...the arguments...);
}
...and if I will use it instead of "native" xcb functions, e.g.
<cCall: 'gst_xcb_create_window' ...>
everything will work fine. I've found that only two xcb functions need
such wrappers: xcb_create_window and xcb_map_window.
Is it a GNU Smalltalk bug? Why calls to my own library with the same
functions work? Or I have buggy xcb that is can not be bound... All I
want is just to make this world a bit better :)
With best regards,
Dmitry Matveev
P.S. Attachments:
* gst-crash-gdb.txt - the GDB output (run & bt) when GST crashes
(direct calls to xcb functions). I hope it will be useful
* xcbroot.st - the "binding"
* xcb-gst.c - the wrappers
P.P.S `--> uname -a
Linux debian 2.6.26-2-686 #1 SMP Sun Jun 21 04:57:38 UTC 2009 i686 GNU/Linux
`--> gdb gst GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... (gdb) run -f xcbroot.st Starting program: /usr/local/bin/gst -f xcbroot.st [Thread debugging using libthread_db enabled] [New Thread 0xb7bb38d0 (LWP 27965)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7bb38d0 (LWP 27965)] 0xb7e4a34b in _gst_dictionary_add (dictionaryOOP=0x40353818, associationOOP=0x403587e8) at dict.c:1861 1861 SET_ASSOCIATION_VALUE (associationOOP, value); (gdb) bt #0 0xb7e4a34b in _gst_dictionary_add (dictionaryOOP=0x40353818, associationOOP=0x403587e8) at dict.c:1861 #1 0xb7e4a3fb in add_smalltalk (globalName=<value optimized out>, globalValue=0x40354500) at dict.c:1053 #2 0xb7e4a622 in init_runtime_objects () at dict.c:1076 #3 0xb7e4c2f6 in _gst_init_dictionary_on_image_load (prim_table_matches=true) at dict.c:1319 #4 0xb7e62396 in _gst_load_from_file (fileName=0x95142c0 "/usr/local/var/lib/smalltalk/gst.im") at save.c:505 #5 0xb7e31cc8 in _gst_initialize (kernel_dir=0x0, image_file=0x0, flags=<value optimized out>) at files.c:495 #6 0x0804924c in main (argc=-1213696236, argv=0x3000900) at main.c:385 (gdb)
xcbroot.st
Description: Binary data
/*
* compile me:
* gcc xcb-gst.c -o xcb-gst.so -shared -lxcb
*
* Good luck!
*/
#include <xcb/xcb.h>
void
gst_xcb_setup_roots_iterator (const xcb_setup_t *setup,
xcb_screen_iterator_t *iter)
{ if (setup && iter)
*iter = xcb_setup_roots_iterator (setup);
}
void
gst_xcb_create_window (xcb_connection_t *c /**< */,
uint8_t depth /**< */,
xcb_window_t wid /**< */,
xcb_window_t parent /**< */,
int16_t x /**< */,
int16_t y /**< */,
uint16_t width /**< */,
uint16_t height /**< */,
uint16_t border_width /**< */,
uint16_t _class /**< */,
xcb_visualid_t visual /**< */,
uint32_t value_mask /**< */,
const uint32_t *value_list /**< */)
{
xcb_create_window (c, depth, wid, parent, x, y, width, height,
border_width, _class, visual, value_mask, value_list);
}
void
gst_xcb_map_window (xcb_connection_t *c, xcb_window_t wid)
{ xcb_map_window (c, wid);
}
_______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
