Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1typedef struct
- 2 {
- 3 int screen_number;
- 4 xcb_connection_t * ptr;
- 5 } Connection;
- 6 //extend classes
- 7 %feature("autodoc", "1");
- 8
- 9 %extend Connection {
- 10 Connection(const char *displayname)
- 11 {
- 12 Connection * c ;
- 13 c = (Connection * ) malloc(sizeof(Connection));
- 14 c->ptr = xcb_connect(displayname, &c->screen_number);
- 15 return c;
- 16 }
- 17 ~Connection()
- 18 {
- 19 free($self);
- 20 }
- ---anothers methods for this class
- 2509 typedef struct{
- 2510 xcb_screen_t * ptr;
- 2511 } Screen;
- ------
- %extend Screen {
- 3421 Screen(xcb_screen_t * ptr)
- 3422 {
- 3423 Screen *p;
- 3424 p = (Screen *) malloc(sizeof(Screen));
- 3425 p->ptr = ptr;
- 3426 return p;
- 3427 }
- 3428 ~Screen()
- 3429 {
- 3430 free($self->ptr);
- 3431 free($self);
- 3432 }
- ---another methods for this class
- xcb_screen_t *xcb_aux_get_screen (xcb_connection_t *c, int screen);
- #a Connection class already created:
- conn
- screen_ptr = Xcb_util.xcb_aux_get_screen( conn->ptr , 1)
- my_screen = Screen.new(screen_ptr)
- Screen * aux_get_screen( Connection * c, in screen)
- {
- Screen * s;
- s = malloc(sizeof(Screen);
- s->ptr = xcb_aux_get_screen( c->ptr , 1);
- return s;
- }
- conn
- my_screen = Xcb_util.xcb_aux_get_screen( conn , 1)
- #my_screen is Xcb_core::Screen class or at least a Screen class with same methods of Xcb_core::Screen class
- my_screen = Conn.xcb_aux_get_screen(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement