update to the new new api of XCB

SVN revision: 26496
This commit is contained in:
doursse 2006-10-10 19:16:16 +00:00 committed by doursse
parent 70a562b239
commit cacc00f14a
9 changed files with 109 additions and 108 deletions

View File

@ -25,7 +25,7 @@ visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen)
iter_vis = xcb_depth_visuals_iterator(iter_depth.data); iter_vis = xcb_depth_visuals_iterator(iter_depth.data);
for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis)) for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis))
{ {
if (screen->root_visual.id == iter_vis.data->visual_id.id) if (screen->root_visual == iter_vis.data->visual_id)
return iter_vis.data; return iter_vis.data;
} }
} }
@ -121,14 +121,14 @@ main(int argc, char **argv)
int pause_me = 0; int pause_me = 0;
xcb_connection_t *conn; xcb_connection_t *conn;
const xcb_query_extension_reply_t *rep_shm; const xcb_query_extension_reply_t *rep_shm;
xcb_get_input_focus_reply_t *reply; xcb_get_input_focus_reply_t *reply;
xcb_screen_t *screen = NULL; xcb_screen_t *screen = NULL;
xcb_screen_iterator_t iter_screen; xcb_screen_iterator_t iter_screen;
xcb_drawable_t win; xcb_window_t win;
xcb_generic_event_t *e; xcb_generic_event_t *e;
uint32_t mask; uint32_t mask;
uint32_t value[6]; uint32_t value[6];
int screen_nbr; int screen_nbr;
conn = xcb_connect (NULL, &screen_nbr); conn = xcb_connect (NULL, &screen_nbr);
if (!conn) if (!conn)
@ -163,12 +163,12 @@ main(int argc, char **argv)
value[2] = XCB_GRAVITY_BIT_FORGET; value[2] = XCB_GRAVITY_BIT_FORGET;
value[3] = XCB_BACKING_STORE_NOT_USEFUL; value[3] = XCB_BACKING_STORE_NOT_USEFUL;
value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_STRUCTURE_NOTIFY; value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
value[5] = screen->default_colormap.xid; value[5] = screen->default_colormap;
win.window = xcb_window_new(conn); win = xcb_generate_id (conn);
xcb_create_window (conn, xcb_create_window (conn,
screen->root_depth, screen->root_depth,
win.window, screen->root, win, screen->root,
0, 0, 0, 0,
win_w, win_h, win_w, win_h,
0, 0,
@ -176,8 +176,8 @@ main(int argc, char **argv)
screen->root_visual, screen->root_visual,
mask, value); mask, value);
title_set (conn, win.window, "Evas Software XCB Test"); title_set (conn, win, "Evas Software XCB Test");
class_set (conn, win.window, "Evas_Software_XCB_Test", "Main"); class_set (conn, win, "Evas_Software_XCB_Test", "Main");
#if 0 #if 0
szhints = AllocSizeHints(); szhints = AllocSizeHints();
SizeHintsSetMinSize(szhints, win_w, win_h); SizeHintsSetMinSize(szhints, win_w, win_h);
@ -186,7 +186,7 @@ main(int argc, char **argv)
SetWMNormalHints(conn, win.window, szhints); SetWMNormalHints(conn, win.window, szhints);
FreeSizeHints(szhints); FreeSizeHints(szhints);
#endif #endif
xcb_map_window (conn, win.window); xcb_map_window (conn, win);
/* we sync */ /* we sync */
reply = xcb_get_input_focus_reply(conn, reply = xcb_get_input_focus_reply(conn,
xcb_get_input_focus_unchecked(conn), xcb_get_input_focus_unchecked(conn),
@ -319,7 +319,7 @@ main(int argc, char **argv)
while (1) while (1)
{ {
e = xcb_poll_for_event(conn, NULL); e = xcb_poll_for_event(conn);
if (e) { if (e) {
switch (e->response_type) switch (e->response_type)
@ -327,7 +327,7 @@ main(int argc, char **argv)
case XCB_BUTTON_PRESS: { case XCB_BUTTON_PRESS: {
xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e; xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e;
if (ev->detail.id == 3) if (ev->detail == 3)
{ {
free(e); free(e);
goto exit; goto exit;

View File

@ -16,7 +16,7 @@
#include "Evas_Engine_Software_Xcb.h" #include "Evas_Engine_Software_Xcb.h"
xcb_connection_t *c = NULL; xcb_connection_t *c = NULL;
xcb_drawable_t win; xcb_window_t win;
Evas *evas = NULL; Evas *evas = NULL;
@ -39,7 +39,7 @@ visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen)
iter_vis = xcb_depth_visuals_iterator(iter_depth.data); iter_vis = xcb_depth_visuals_iterator(iter_depth.data);
for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis)) for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis))
{ {
if (screen->root_visual.id == iter_vis.data->visual_id.id) if (screen->root_visual == iter_vis.data->visual_id)
return iter_vis.data; return iter_vis.data;
} }
} }
@ -170,12 +170,12 @@ main(int argc, char **argv)
value[2] = XCB_GRAVITY_BIT_FORGET; value[2] = XCB_GRAVITY_BIT_FORGET;
value[3] = XCB_BACKING_STORE_NOT_USEFUL; value[3] = XCB_BACKING_STORE_NOT_USEFUL;
value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION; value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION;
value[5] = screen->default_colormap.xid; value[5] = screen->default_colormap;
win.window = xcb_window_new(c); win = xcb_generate_id (c);
xcb_create_window (c, xcb_create_window (c,
screen->root_depth, screen->root_depth,
win.window, screen->root, win, screen->root,
0, 0, 0, 0,
win_w, win_h, win_w, win_h,
0, 0,
@ -183,17 +183,17 @@ main(int argc, char **argv)
screen->root_visual, screen->root_visual,
mask, value); mask, value);
title_set (c, win.window, "Evas XCB Performance Test"); title_set (c, win, "Evas XCB Performance Test");
class_set (c, win.window, "Evas_XCB_Perf_Test", "Main"); class_set (c, win, "Evas_XCB_Perf_Test", "Main");
szhints = AllocSizeHints(); szhints = AllocSizeHints();
SizeHintsSetMinSize(szhints, win_w, win_h); SizeHintsSetMinSize(szhints, win_w, win_h);
SizeHintsSetMaxSize(szhints, win_w, win_h); SizeHintsSetMaxSize(szhints, win_w, win_h);
SizeHintsSetSize(szhints, 0, win_w, win_h); SizeHintsSetSize(szhints, 0, win_w, win_h);
SetWMNormalHints(c, win.window, szhints); SetWMNormalHints(c, win, szhints);
FreeSizeHints(szhints); FreeSizeHints(szhints);
xcb_map_window (c, win.window); xcb_map_window (c, win);
evas_init(); evas_init();
evas = evas_new(); evas = evas_new();
@ -218,7 +218,7 @@ main(int argc, char **argv)
while (1) while (1)
{ {
e = xcb_poll_for_event(c, NULL); e = xcb_poll_for_event(c);
if (e) if (e)
{ {

View File

@ -16,7 +16,7 @@
#include "Evas_Engine_Software_Xcb.h" #include "Evas_Engine_Software_Xcb.h"
xcb_connection_t *c = NULL; xcb_connection_t *c = NULL;
xcb_drawable_t win; xcb_window_t win;
Evas *evas = NULL; Evas *evas = NULL;
@ -39,7 +39,7 @@ visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen)
iter_vis = xcb_depth_visuals_iterator(iter_depth.data); iter_vis = xcb_depth_visuals_iterator(iter_depth.data);
for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis)) for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis))
{ {
if (screen->root_visual.id == iter_vis.data->visual_id.id) if (screen->root_visual == iter_vis.data->visual_id)
return iter_vis.data; return iter_vis.data;
} }
} }
@ -172,29 +172,29 @@ main(int argc, char **argv)
value[2] = XCB_GRAVITY_BIT_FORGET; value[2] = XCB_GRAVITY_BIT_FORGET;
value[3] = XCB_BACKING_STORE_NOT_USEFUL; value[3] = XCB_BACKING_STORE_NOT_USEFUL;
value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION; value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION;
value[5] = screen->default_colormap.xid; value[5] = screen->default_colormap;
win.window = xcb_window_new(c); win = xcb_generate_id (c);
xcb_create_window (c, xcb_create_window (c,
screen->root_depth, screen->root_depth,
win.window, screen->root, win, screen->root,
0, 0, 0, 0,
win_w, win_h, win_w, win_h,
0, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_INPUT_OUTPUT,
screen->root_visual, screen->root_visual,
mask, value); mask, value);
title_set (c, win.window, "Evas XCB Performance Test"); title_set (c, win, "Evas XCB Performance Test");
class_set (c, win.window, "Evas_XCB_Perf_Test", "Main"); class_set (c, win, "Evas_XCB_Perf_Test", "Main");
szhints = AllocSizeHints(); szhints = AllocSizeHints();
SizeHintsSetMinSize(szhints, win_w, win_h); SizeHintsSetMinSize(szhints, win_w, win_h);
SizeHintsSetMaxSize(szhints, win_w, win_h); SizeHintsSetMaxSize(szhints, win_w, win_h);
SizeHintsSetSize(szhints, 0, win_w, win_h); SizeHintsSetSize(szhints, 0, win_w, win_h);
SetWMNormalHints(c, win.window, szhints); SetWMNormalHints(c, win, szhints);
FreeSizeHints(szhints); FreeSizeHints(szhints);
xcb_map_window (c, win.window); xcb_map_window (c, win);
/* we sync */ /* we sync */
reply = xcb_get_input_focus_reply(c, reply = xcb_get_input_focus_reply(c,
xcb_get_input_focus_unchecked(c), xcb_get_input_focus_unchecked(c),
@ -225,7 +225,7 @@ main(int argc, char **argv)
while (1) while (1)
{ {
e = xcb_poll_for_event(c, NULL); e = xcb_poll_for_event(c);
if (e) if (e)
{ {

View File

@ -104,7 +104,7 @@ main(int argc, char **argv)
xcb_get_input_focus_reply_t *reply; xcb_get_input_focus_reply_t *reply;
xcb_screen_t *screen = NULL; xcb_screen_t *screen = NULL;
xcb_screen_iterator_t iter_screen; xcb_screen_iterator_t iter_screen;
xcb_drawable_t win; xcb_window_t win;
xcb_generic_event_t *e; xcb_generic_event_t *e;
uint32_t mask; uint32_t mask;
uint32_t value[6]; uint32_t value[6];
@ -145,31 +145,31 @@ main(int argc, char **argv)
value[2] = XCB_GRAVITY_BIT_FORGET; value[2] = XCB_GRAVITY_BIT_FORGET;
value[3] = XCB_BACKING_STORE_NOT_USEFUL; value[3] = XCB_BACKING_STORE_NOT_USEFUL;
value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_STRUCTURE_NOTIFY; value[4] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
value[5] = screen->default_colormap.xid; value[5] = screen->default_colormap;
win.window = xcb_window_new(conn); win = xcb_generate_id (conn);
xcb_create_window (conn, xcb_create_window (conn,
screen->root_depth, screen->root_depth,
win.window, screen->root, win, screen->root,
0, 0, 0, 0,
win_w, win_h, win_w, win_h,
0, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_INPUT_OUTPUT,
screen->root_visual, screen->root_visual,
mask, value); mask, value);
title_set (conn, win.window, "Evas XRender Xcb Test"); title_set (conn, win, "Evas XRender Xcb Test");
class_set (conn, win.window, "Evas_XRender_XCB_Test", "Main"); class_set (conn, win, "Evas_XRender_XCB_Test", "Main");
#if 0 #if 0
szhints.flags = PMinSize | PMaxSize | PSize | USSize; szhints.flags = PMinSize | PMaxSize | PSize | USSize;
szhints.min_width = szhints.max_width = win_w; szhints.min_width = szhints.max_width = win_w;
szhints.min_height = szhints.max_height = win_h; szhints.min_height = szhints.max_height = win_h;
XSetWMNormalHints(disp, win, &szhints); XSetWMNormalHints(disp, win, &szhints);
#endif #endif
xcb_map_window (conn, win.window); xcb_map_window (conn, win);
/* we sync */ /* we sync */
reply = xcb_get_input_focus_reply(conn, reply = xcb_get_input_focus_reply(conn,
xcb_get_input_focus_unchecked(conn), xcb_get_input_focus_unchecked(conn),
NULL); NULL);
free(reply); free(reply);
/* test evas_free.... :) */ /* test evas_free.... :) */
@ -194,7 +194,7 @@ main(int argc, char **argv)
orig_start_time = start_time = get_time(); orig_start_time = start_time = get_time();
while (1) while (1)
{ {
e = xcb_poll_for_event(conn, NULL); e = xcb_poll_for_event(conn);
if (e) { if (e) {
switch (e->response_type) switch (e->response_type)
@ -202,7 +202,7 @@ main(int argc, char **argv)
case XCB_BUTTON_PRESS: { case XCB_BUTTON_PRESS: {
xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e; xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e;
if (ev->detail.id == 3) if (ev->detail == 3)
{ {
free(e); free(e);
goto exit; goto exit;

View File

@ -144,7 +144,7 @@ _best_visual_get(xcb_connection_t *conn, int screen)
iter_vis = xcb_depth_visuals_iterator(iter_depth.data); iter_vis = xcb_depth_visuals_iterator(iter_depth.data);
for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis)) for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis))
{ {
if (scr->root_visual.id == iter_vis.data->visual_id.id) if (scr->root_visual == iter_vis.data->visual_id)
return iter_vis.data; return iter_vis.data;
} }
} }
@ -186,7 +186,7 @@ _best_depth_get(xcb_connection_t *conn, int screen)
static Evas_Performance * static Evas_Performance *
_output_perf_new(Evas *e, xcb_connection_t *conn, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth) _output_perf_new(Evas *e, xcb_connection_t *conn, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth)
{ {
return evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, depth); return evas_software_xcb_generate_id_x(conn, draw, vis, cmap, depth);
e = NULL; e = NULL;
} }
@ -414,7 +414,7 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
re->end = 1; re->end = 1;
} }
surface = evas_software_xcb_outbuf_new_region_for_update(re->ob, surface = evas_software_xcb_generate_id_region_for_update(re->ob,
ux, uy, uw, uh, ux, uy, uw, uh,
cx, cy, cw, ch); cx, cy, cw, ch);
*x = ux; *y = uy; *w = uw; *h = uh; *x = ux; *y = uy; *w = uw; *h = uh;

View File

@ -118,7 +118,7 @@ void evas_software_xcb_x_write_mask_line (Outbuf
int w, int w,
int y); int y);
int evas_software_xcb_x_can_do_shm (xcb_connection_t *c); int evas_software_xcb_x_can_do_shm (xcb_connection_t *c);
Xcb_Output_Buffer *evas_software_xcb_x_output_buffer_new (xcb_connection_t *c, Xcb_Output_Buffer *evas_software_xcb_generate_id (xcb_connection_t *c,
int depth, int depth,
int w, int w,
int h, int h,
@ -172,7 +172,7 @@ Outbuf *evas_software_xcb_outbuf_setup_x (int
char *evas_software_xcb_outbuf_perf_serialize_x (Outbuf_Perf *perf); char *evas_software_xcb_outbuf_perf_serialize_x (Outbuf_Perf *perf);
void evas_software_xcb_outbuf_perf_deserialize_x (Outbuf_Perf *perf, void evas_software_xcb_outbuf_perf_deserialize_x (Outbuf_Perf *perf,
const char *data); const char *data);
Outbuf_Perf *evas_software_xcb_outbuf_perf_new_x (xcb_connection_t *conn, Outbuf_Perf *evas_software_xcb_generate_id_x (xcb_connection_t *conn,
xcb_drawable_t draw, xcb_drawable_t draw,
xcb_visualtype_t *vis, xcb_visualtype_t *vis,
xcb_colormap_t cmap, xcb_colormap_t cmap,
@ -204,7 +204,7 @@ void evas_software_xcb_outbuf_update (Outbuf *buf,
int y, int y,
int w, int w,
int h); int h);
RGBA_Image *evas_software_xcb_outbuf_new_region_for_update (Outbuf *buf, RGBA_Image *evas_software_xcb_generate_id_region_for_update (Outbuf *buf,
int x, int x,
int y, int y,
int w, int w,

View File

@ -17,7 +17,7 @@ evas_software_xcb_outbuf_free(Outbuf * buf)
{ {
evas_software_xcb_outbuf_flush(buf); evas_software_xcb_outbuf_flush(buf);
xcb_free_gc(buf->priv.x.conn, buf->priv.x.gc); xcb_free_gc(buf->priv.x.conn, buf->priv.x.gc);
if (buf->priv.x.gcm.xid) if (buf->priv.x.gcm)
xcb_free_gc(buf->priv.x.conn, buf->priv.x.gcm); xcb_free_gc(buf->priv.x.conn, buf->priv.x.gcm);
if (buf->priv.pal) if (buf->priv.pal)
evas_software_xcb_x_color_deallocate(buf->priv.x.conn, evas_software_xcb_x_color_deallocate(buf->priv.x.conn,
@ -75,7 +75,7 @@ evas_software_xcb_outbuf_setup_x(int w,
Xcb_Output_Buffer *xcbob; Xcb_Output_Buffer *xcbob;
buf->priv.x.shm = evas_software_xcb_x_can_do_shm(buf->priv.x.conn); buf->priv.x.shm = evas_software_xcb_x_can_do_shm(buf->priv.x.conn);
xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, xcbob = evas_software_xcb_generate_id(buf->priv.x.conn,
buf->priv.x.depth, buf->priv.x.depth,
1, 1, 1, 1,
buf->priv.x.shm, NULL); buf->priv.x.shm, NULL);
@ -258,7 +258,7 @@ evas_software_xcb_outbuf_setup_x(int w,
} }
RGBA_Image * RGBA_Image *
evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, evas_software_xcb_generate_id_region_for_update(Outbuf *buf,
int x, int x,
int y, int y,
int w, int w,
@ -305,15 +305,15 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
im->image->data = NULL; im->image->data = NULL;
im->image->no_free = 1; im->image->no_free = 1;
im->extended_info = obr; im->extended_info = obr;
obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, obr->xcbob = evas_software_xcb_generate_id(buf->priv.x.conn,
buf->priv.x.depth, buf->priv.x.depth,
w, w,
h, h,
use_shm, use_shm,
NULL); NULL);
im->image->data = (DATA32 *)evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl); im->image->data = (DATA32 *)evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl);
if (buf->priv.x.mask.pixmap.xid) if (buf->priv.x.mask)
obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, obr->mxcbob = evas_software_xcb_generate_id(buf->priv.x.conn,
1, 1,
w, w,
h, h,
@ -325,28 +325,28 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
im = evas_common_image_create(w, h); im = evas_common_image_create(w, h);
im->extended_info = obr; im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180)) if ((buf->rot == 0) || (buf->rot == 180))
obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, obr->xcbob = evas_software_xcb_generate_id(buf->priv.x.conn,
buf->priv.x.depth, buf->priv.x.depth,
w, w,
h, h,
use_shm, use_shm,
NULL); NULL);
else if ((buf->rot == 90) || (buf->rot == 270)) else if ((buf->rot == 90) || (buf->rot == 270))
obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, obr->xcbob = evas_software_xcb_generate_id(buf->priv.x.conn,
buf->priv.x.depth, buf->priv.x.depth,
h, h,
w, w,
use_shm, use_shm,
NULL); NULL);
if (buf->priv.x.mask.pixmap.xid) if (buf->priv.x.mask)
obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, obr->mxcbob = evas_software_xcb_generate_id(buf->priv.x.conn,
1, 1,
w, w,
h, h,
use_shm, use_shm,
NULL); NULL);
} }
if ((buf->priv.x.mask.pixmap.xid) || (buf->priv.destination_alpha)) if ((buf->priv.x.mask) || (buf->priv.destination_alpha))
{ {
im->flags |= RGBA_IMAGE_HAS_ALPHA; im->flags |= RGBA_IMAGE_HAS_ALPHA;
/* FIXME: faster memset! */ /* FIXME: faster memset! */
@ -596,14 +596,14 @@ void
evas_software_xcb_outbuf_drawable_set(Outbuf *buf, evas_software_xcb_outbuf_drawable_set(Outbuf *buf,
xcb_drawable_t draw) xcb_drawable_t draw)
{ {
if (buf->priv.x.win.window.xid == draw.window.xid) return; if (buf->priv.x.win == draw) return;
if (buf->priv.x.gc.xid) if (buf->priv.x.gc)
{ {
xcb_free_gc(buf->priv.x.conn, buf->priv.x.gc); xcb_free_gc(buf->priv.x.conn, buf->priv.x.gc);
buf->priv.x.gc.xid = 0; buf->priv.x.gc = 0;
} }
buf->priv.x.win = draw; buf->priv.x.win = draw;
buf->priv.x.gc = xcb_gcontext_new(buf->priv.x.conn); buf->priv.x.gc = xcb_generate_id(buf->priv.x.conn);
xcb_create_gc(buf->priv.x.conn, buf->priv.x.gc, buf->priv.x.win, 0, NULL); xcb_create_gc(buf->priv.x.conn, buf->priv.x.gc, buf->priv.x.win, 0, NULL);
} }
@ -611,16 +611,16 @@ void
evas_software_xcb_outbuf_mask_set(Outbuf *buf, evas_software_xcb_outbuf_mask_set(Outbuf *buf,
xcb_drawable_t mask) xcb_drawable_t mask)
{ {
if (buf->priv.x.mask.pixmap.xid == mask.pixmap.xid) return; if (buf->priv.x.mask == mask) return;
if (buf->priv.x.gcm.xid) if (buf->priv.x.gcm)
{ {
xcb_free_gc(buf->priv.x.conn, buf->priv.x.gcm); xcb_free_gc(buf->priv.x.conn, buf->priv.x.gcm);
buf->priv.x.gcm.xid = 0; buf->priv.x.gcm = 0;
} }
buf->priv.x.mask = mask; buf->priv.x.mask = mask;
if (buf->priv.x.mask.pixmap.xid) if (buf->priv.x.mask)
{ {
buf->priv.x.gcm = xcb_gcontext_new(buf->priv.x.conn); buf->priv.x.gcm = xcb_generate_id(buf->priv.x.conn);
xcb_create_gc(buf->priv.x.conn, buf->priv.x.gcm, buf->priv.x.win, 0, NULL); xcb_create_gc(buf->priv.x.conn, buf->priv.x.gcm, buf->priv.x.win, 0, NULL);
} }
} }
@ -649,13 +649,13 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
xcb_screen_iterator_t i; xcb_screen_iterator_t i;
geom = xcb_get_geometry_reply (buf->priv.x.conn, xcb_get_geometry_unchecked(buf->priv.x.conn, draw), 0); geom = xcb_get_geometry_reply (buf->priv.x.conn, xcb_get_geometry_unchecked(buf->priv.x.conn, draw), 0);
root.window = geom->root; root = geom->root;
free (geom); free (geom);
geom = xcb_get_geometry_reply (buf->priv.x.conn, xcb_get_geometry_unchecked(buf->priv.x.conn, root), 0); geom = xcb_get_geometry_reply (buf->priv.x.conn, xcb_get_geometry_unchecked(buf->priv.x.conn, root), 0);
i = xcb_setup_roots_iterator((xcb_setup_t *)xcb_get_setup(buf->priv.x.conn)); i = xcb_setup_roots_iterator((xcb_setup_t *)xcb_get_setup(buf->priv.x.conn));
for (; i.rem; xcb_screen_next(&i)) for (; i.rem; xcb_screen_next(&i))
if (i.data->root.xid == geom->root.xid) if (i.data->root == geom->root)
{ {
screen = i.data; screen = i.data;
break; break;
@ -763,7 +763,7 @@ evas_software_xcb_outbuf_perf_deserialize_x(Outbuf_Perf *perf,
} }
Outbuf_Perf * Outbuf_Perf *
evas_software_xcb_outbuf_perf_new_x(xcb_connection_t *conn, evas_software_xcb_generate_id_x(xcb_connection_t *conn,
xcb_drawable_t draw, xcb_drawable_t draw,
xcb_visualtype_t *vis, xcb_visualtype_t *vis,
xcb_colormap_t cmap, xcb_colormap_t cmap,
@ -780,15 +780,15 @@ evas_software_xcb_outbuf_perf_new_x(xcb_connection_t *conn,
perf->x.conn = conn; perf->x.conn = conn;
/* FIXME: should use the default screen */ /* FIXME: should use the default screen */
root.window = xcb_setup_roots_iterator ((xcb_setup_t *)xcb_get_setup (conn)).data->root; root = xcb_setup_roots_iterator ((xcb_setup_t *)xcb_get_setup (conn)).data->root;
if (draw.window.xid) if (draw)
{ {
xcb_get_geometry_reply_t *geom; xcb_get_geometry_reply_t *geom;
xcb_screen_iterator_t i; xcb_screen_iterator_t i;
int cur; int cur;
geom = xcb_get_geometry_reply (conn, xcb_get_geometry_unchecked(conn, draw), NULL); geom = xcb_get_geometry_reply (conn, xcb_get_geometry_unchecked(conn, draw), NULL);
root.window = geom->root; root = geom->root;
free (geom); free (geom);
geom = xcb_get_geometry_reply (conn, xcb_get_geometry_unchecked(conn, root), 0); geom = xcb_get_geometry_reply (conn, xcb_get_geometry_unchecked(conn, root), 0);
perf->x.w = (int)geom->width; perf->x.w = (int)geom->width;
@ -797,7 +797,7 @@ evas_software_xcb_outbuf_perf_new_x(xcb_connection_t *conn,
perf->x.screen_num = 0; perf->x.screen_num = 0;
i = xcb_setup_roots_iterator((xcb_setup_t *)xcb_get_setup(conn)); i = xcb_setup_roots_iterator((xcb_setup_t *)xcb_get_setup(conn));
for (cur = 0; i.rem; xcb_screen_next(&i), ++cur) for (cur = 0; i.rem; xcb_screen_next(&i), ++cur)
if (i.data->root.xid == geom->root.xid) if (i.data->root == geom->root)
{ {
perf->x.screen_num = cur; perf->x.screen_num = cur;
break; break;
@ -881,7 +881,7 @@ evas_software_xcb_outbuf_perf_new_x(xcb_connection_t *conn,
perf->cpu.info = strdup(""); perf->cpu.info = strdup("");
return perf; return perf;
vis = NULL; vis = NULL;
cmap.xid = 0; cmap = 0;
} }
char * char *
@ -942,7 +942,7 @@ evas_software_xcb_outbuf_perf_store_x(Outbuf_Perf *perf)
format = STRING; format = STRING;
str = evas_software_xcb_outbuf_perf_serialize_x(perf); str = evas_software_xcb_outbuf_perf_serialize_x(perf);
xcb_change_property(perf->x.conn, XCB_PROP_MODE_REPLACE, perf->x.root.window, xcb_change_property(perf->x.conn, XCB_PROP_MODE_REPLACE, perf->x.root,
type, format, 8, type, format, 8,
strlen(str), str); strlen(str), str);
/* we sync */ /* we sync */
@ -967,7 +967,7 @@ evas_software_xcb_outbuf_perf_restore_x(xcb_connection_t *conn,
xcb_atom_t type, format; xcb_atom_t type, format;
Outbuf_Perf *perf; Outbuf_Perf *perf;
perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth); perf = evas_software_xcb_generate_id_x(conn, draw, vis, cmap, x_depth);
type_str = "__EVAS_PERF_ENGINE_SOFTWARE"; type_str = "__EVAS_PERF_ENGINE_SOFTWARE";
type_rep = xcb_intern_atom_reply(conn, type_rep = xcb_intern_atom_reply(conn,
@ -983,14 +983,14 @@ evas_software_xcb_outbuf_perf_restore_x(xcb_connection_t *conn,
format = STRING; format = STRING;
free(type_rep); free(type_rep);
cookie = xcb_get_property_unchecked(conn, 0, perf->x.root.window, cookie = xcb_get_property_unchecked(conn, 0, perf->x.root,
type, format, type, format,
0, 16384); 0, 16384);
prop_rep = xcb_get_property_reply(conn, cookie, NULL); prop_rep = xcb_get_property_reply(conn, cookie, NULL);
if ((prop_rep) && if ((prop_rep) &&
(prop_rep->format == 8) && (prop_rep->format == 8) &&
(prop_rep->type.xid == type.xid)) (prop_rep->type == type))
{ {
char *retval; char *retval;
int retnum; int retnum;
@ -1036,7 +1036,7 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
int w, h; int w, h;
int do_shm = 0; int do_shm = 0;
perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth); perf = evas_software_xcb_generate_id_x(conn, draw, vis, cmap, x_depth);
mask = XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | mask = XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL |
XCB_CW_BIT_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_BIT_GRAVITY | XCB_CW_BACKING_STORE |
@ -1047,12 +1047,12 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
value[3] = XCB_BACKING_STORE_ALWAYS; value[3] = XCB_BACKING_STORE_ALWAYS;
value[4] = 1; value[4] = 1;
value[5] = XCB_EVENT_MASK_NO_EVENT; value[5] = XCB_EVENT_MASK_NO_EVENT;
value[6] = cmap.xid; value[6] = cmap;
w = perf->x.w; w = perf->x.w;
h = perf->x.h; h = perf->x.h;
win.window = xcb_window_new (conn); win = xcb_generate_id (conn);
xcb_create_window (conn, x_depth, xcb_create_window (conn, x_depth,
win.window, perf->x.root.window, win, perf->x.root,
0, 0, 0, 0,
w, h, w, h,
0, 0,
@ -1066,8 +1066,8 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
free(reply); free(reply);
mask = XCB_CONFIG_WINDOW_STACK_MODE; mask = XCB_CONFIG_WINDOW_STACK_MODE;
value[0] = XCB_STACK_MODE_ABOVE; value[0] = XCB_STACK_MODE_ABOVE;
xcb_configure_window (conn, win.window, mask, value2); xcb_configure_window (conn, win, mask, value2);
xcb_map_window (conn, win.window); xcb_map_window (conn, win);
do_shm = evas_software_xcb_x_can_do_shm(conn); do_shm = evas_software_xcb_x_can_do_shm(conn);
@ -1088,7 +1088,7 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
max = w; max = w;
if (w > h) if (w > h)
max = h; max = h;
gc = xcb_gcontext_new (conn); gc = xcb_generate_id (conn);
xcb_create_gc (conn, gc, win, 0, NULL); xcb_create_gc (conn, gc, win, 0, NULL);
for (i = 16; i < max; i += 16) for (i = 16; i < max; i += 16)
{ {
@ -1100,7 +1100,7 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
t0 = _evas_get_time(); t0 = _evas_get_time();
for (l = 0; l < loops; l++) for (l = 0; l < loops; l++)
{ {
xcbob = evas_software_xcb_x_output_buffer_new(conn, xcbob = evas_software_xcb_generate_id(conn,
x_depth, x_depth,
i, i, i, i,
do_shm, do_shm,
@ -1126,7 +1126,7 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
t0 = _evas_get_time(); t0 = _evas_get_time();
for (l = 0; l < loops; l++) for (l = 0; l < loops; l++)
{ {
xcbob = evas_software_xcb_x_output_buffer_new(conn, xcbob = evas_software_xcb_generate_id(conn,
x_depth, x_depth,
i, i, i, i,
0, 0,
@ -1160,6 +1160,6 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
} }
xcb_free_gc(conn, gc); xcb_free_gc(conn, gc);
} }
xcb_destroy_window(conn, win.window); xcb_destroy_window(conn, win);
return perf; return perf;
} }

View File

@ -66,7 +66,8 @@ evas_software_xcb_x_can_do_shm(xcb_connection_t *c)
xcb_drawable_t drawable; xcb_drawable_t drawable;
int depth; int depth;
drawable.window = xcb_setup_roots_iterator (xcb_get_setup(c)).data->root; /* FIXME: get the corect screen */
drawable = xcb_setup_roots_iterator (xcb_get_setup(c)).data->root;
geom = xcb_get_geometry_reply (c, xcb_get_geometry_unchecked(c, drawable), 0); geom = xcb_get_geometry_reply (c, xcb_get_geometry_unchecked(c, drawable), 0);
if(!geom) if(!geom)
return 0; return 0;
@ -78,7 +79,7 @@ evas_software_xcb_x_can_do_shm(xcb_connection_t *c)
{ {
Xcb_Output_Buffer *xcbob; Xcb_Output_Buffer *xcbob;
xcbob = evas_software_xcb_x_output_buffer_new(c, xcbob = evas_software_xcb_generate_id(c,
depth, depth,
16, 16,
16, 16,
@ -103,7 +104,7 @@ evas_software_xcb_x_can_do_shm(xcb_connection_t *c)
/* } */ /* } */
Xcb_Output_Buffer * Xcb_Output_Buffer *
evas_software_xcb_x_output_buffer_new(xcb_connection_t *c, evas_software_xcb_generate_id(xcb_connection_t *c,
int depth, int depth,
int w, int w,
int h, int h,
@ -124,7 +125,7 @@ evas_software_xcb_x_output_buffer_new(xcb_connection_t *c,
xcbob->shm_info = malloc(sizeof(xcb_shm_segment_info_t)); xcbob->shm_info = malloc(sizeof(xcb_shm_segment_info_t));
if (xcbob->shm_info) if (xcbob->shm_info)
{ {
xcbob->shm_info->shmseg = xcb_shm_seg_new(c); xcbob->shm_info->shmseg = xcb_generate_id(c);
xcbob->image = xcb_image_shm_create(c, depth, XCB_IMAGE_FORMAT_Z_PIXMAP, NULL, w, h); xcbob->image = xcb_image_shm_create(c, depth, XCB_IMAGE_FORMAT_Z_PIXMAP, NULL, w, h);
if (xcbob->image) if (xcbob->image)
{ {

View File

@ -361,7 +361,7 @@ evas_software_xcb_x_color_allocate(xcb_connection_t *conn,
palpriv = pal->data; palpriv = pal->data;
if ((conn == palpriv->conn) && if ((conn == palpriv->conn) &&
(vis == palpriv->vis) && (vis == palpriv->vis) &&
(cmap.xid == palpriv->cmap.xid)) (cmap == palpriv->cmap))
{ {
pal->references++; pal->references++;
return pal; return pal;