Enlightenment CVS committal Author : doursse Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/bin Modified Files: evas_software_xcb_main.c evas_software_xcb_perf_load.c evas_software_xcb_perf_test.c evas_xrender_xcb_main.c Log Message: update to the new api of xcb 1.0. et rid of xcb_aux dependancy =================================================================== RCS file: /cvs/e/e17/libs/evas/src/bin/evas_software_xcb_main.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- evas_software_xcb_main.c 12 Sep 2006 07:48:44 -0000 1.11 +++ evas_software_xcb_main.c 1 Oct 2006 18:27:12 -0000 1.12 @@ -2,59 +2,81 @@ #define X_H /* make sure we aren't using symbols from X.h */ -#include <X11/XCB/xcb.h> -#include <X11/XCB/shm.h> -#include <X11/XCB/xcb_icccm.h> -#include <X11/XCB/xcb_aux.h> +#include <xcb/xcb.h> +#include <xcb/shm.h> +#include <xcb/xcb_icccm.h> #include "Evas.h" #include "Evas_Engine_Software_Xcb.h" +static xcb_visualtype_t * +visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen) +{ + xcb_depth_iterator_t iter_depth; + + if (!conn || !screen) return NULL; + + iter_depth = xcb_screen_allowed_depths_iterator(screen); + for (; iter_depth.rem; xcb_depth_next (&iter_depth)) + { + xcb_visualtype_iterator_t iter_vis; + + iter_vis = xcb_depth_visuals_iterator(iter_depth.data); + for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis)) + { + if (screen->root_visual.id == iter_vis.data->visual_id.id) + return iter_vis.data; + } + } + + return NULL; +} + static void -title_set (XCBConnection *c, XCBWINDOW win, const char *title) +title_set (xcb_connection_t *c, xcb_window_t win, const char *title) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_encoding = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); atom_name = "_NET_WM_NAME"; - cookie_property = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_property = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, - win, - rep->atom, encoding, 8, strlen (title), title); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, + win, + rep->atom, encoding, 8, strlen (title), title); free (rep); } static void -class_set (XCBConnection *c, XCBWINDOW win, const char *name, const char *class) +class_set (xcb_connection_t *c, xcb_window_t win, const char *name, const char *class) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; - char *class_str; - char *s; - int length_name; - int length_class; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; + char *class_str; + char *s; + int length_name; + int length_class; length_name = strlen (name); length_class = strlen (class); @@ -70,23 +92,23 @@ *s = '\0'; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, + cookie_encoding = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); atom_name = "_WM_CLASS"; - cookie_property = XCBInternAtom (c, + cookie_property = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, + xcb_change_property(c, XCB_PROP_MODE_REPLACE, win, rep->atom, encoding, 8, strlen (class_str), class_str); free (rep); @@ -96,18 +118,19 @@ int main(int argc, char **argv) { - int pause_me = 0; - XCBConnection *conn; - const XCBQueryExtensionRep *rep_shm; - XCBGetInputFocusRep *reply; - XCBSCREEN *screen; - XCBDRAWABLE win; - XCBGenericEvent *e; - CARD32 mask; - CARD32 value[6]; - int screen_nbr; + int pause_me = 0; + xcb_connection_t *conn; + const xcb_query_extension_reply_t *rep_shm; + xcb_get_input_focus_reply_t *reply; + xcb_screen_t *screen = NULL; + xcb_screen_iterator_t iter_screen; + xcb_drawable_t win; + xcb_generic_event_t *e; + uint32_t mask; + uint32_t value[6]; + int screen_nbr; - conn = XCBConnect (NULL, &screen_nbr); + conn = xcb_connect (NULL, &screen_nbr); if (!conn) { printf("Error: cannot open a connection.\n"); @@ -115,32 +138,43 @@ } /* shm extension */ - rep_shm = XCBGetExtensionData(conn, &XCBShmId); + rep_shm = xcb_get_extension_data(conn, &xcb_shm_id); - screen = XCBAuxGetScreen (conn, screen_nbr); + iter_screen = xcb_setup_roots_iterator (xcb_get_setup (conn)); + for (; iter_screen.rem; --screen_nbr, xcb_screen_next (&iter_screen)) + if (screen == 0) + { + screen = iter_screen.data; + break; + } + if (!screen) + { + printf("Error: cannot get the screen.\n"); + exit(-1); + } mask = - XCBCWBackPixmap | XCBCWBorderPixel | - XCBCWBitGravity | XCBCWBackingStore | - XCBCWEventMask | XCBCWColormap; + XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | + XCB_CW_BIT_GRAVITY | XCB_CW_BACKING_STORE | + XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; - value[0] = XCBBackPixmapNone; + value[0] = XCB_BACK_PIXMAP_NONE; value[1] = 0; - value[2] = XCBGravityBitForget; - value[3] = XCBBackingStoreNotUseful; - value[4] = XCBEventMaskExposure | XCBEventMaskButtonPress | XCBEventMaskButtonRelease | XCBEventMaskPointerMotion | XCBEventMaskStructureNotify; + value[2] = XCB_GRAVITY_BIT_FORGET; + 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[5] = screen->default_colormap.xid; - win.window = XCBWINDOWNew(conn); - XCBCreateWindow (conn, - XCBAuxGetDepth(conn, screen), - win.window, screen->root, - 0, 0, - win_w, win_h, - 0, - XCBWindowClassInputOutput, - screen->root_visual, - mask, value); + win.window = xcb_window_new(conn); + xcb_create_window (conn, + screen->root_depth, + win.window, screen->root, + 0, 0, + win_w, win_h, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + screen->root_visual, + mask, value); title_set (conn, win.window, "Evas Software XCB Test"); class_set (conn, win.window, "Evas_Software_XCB_Test", "Main"); @@ -152,11 +186,11 @@ SetWMNormalHints(conn, win.window, szhints); FreeSizeHints(szhints); #endif - XCBMapWindow (conn, win.window); + xcb_map_window (conn, win.window); /* we sync */ - reply = XCBGetInputFocusReply(conn, - XCBGetInputFocusUnchecked(conn), - NULL); + reply = xcb_get_input_focus_reply(conn, + xcb_get_input_focus_unchecked(conn), + NULL); free(reply); /* test evas_free.... :) */ @@ -172,10 +206,10 @@ /* the following is specific to the engine */ einfo->info.conn = conn; - einfo->info.visual = XCBAuxGetVisualtype(conn, screen_nbr, screen->root_visual); + einfo->info.visual = visualtype_get(conn, screen); einfo->info.colormap = screen->default_colormap; einfo->info.drawable = win; - einfo->info.depth = XCBAuxGetDepth(conn, screen); + einfo->info.depth = screen->root_depth; einfo->info.rotation = 0; einfo->info.debug = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); @@ -197,10 +231,10 @@ /* the following is specific to the engine */ einfo->info.conn = conn; - einfo->info.visual = XCBAuxGetVisualtype(conn, screen_nbr, screen->root_visual); + einfo->info.visual = visualtype_get(conn, screen); einfo->info.colormap = screen->default_colormap; einfo->info.drawable = win; - einfo->info.depth = XCBAuxGetDepth(conn, screen); + einfo->info.depth = screen->root_depth; einfo->info.rotation = 0; einfo->info.debug = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); @@ -222,10 +256,10 @@ /* the following is specific to the engine */ einfo->info.conn = conn; - einfo->info.visual = XCBAuxGetVisualtype(conn, screen_nbr, screen->root_visual); + einfo->info.visual = visualtype_get(conn, screen); einfo->info.colormap = screen->default_colormap; einfo->info.drawable = win; - einfo->info.depth = XCBAuxGetDepth(conn, screen); + einfo->info.depth = screen->root_depth; einfo->info.rotation = 0; einfo->info.debug = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); @@ -247,10 +281,10 @@ /* the following is specific to the engine */ einfo->info.conn = conn; - einfo->info.visual = XCBAuxGetVisualtype(conn, screen_nbr, screen->root_visual); + einfo->info.visual = visualtype_get(conn, screen); einfo->info.colormap = screen->default_colormap; einfo->info.drawable = win; - einfo->info.depth = XCBAuxGetDepth(conn, screen); + einfo->info.depth = screen->root_depth; einfo->info.rotation = 0; einfo->info.debug = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); @@ -272,10 +306,10 @@ /* the following is specific to the engine */ einfo->info.conn = conn; - einfo->info.visual = XCBAuxGetVisualtype(conn, screen_nbr, screen->root_visual); + einfo->info.visual = visualtype_get(conn, screen); einfo->info.colormap = screen->default_colormap; einfo->info.drawable = win; - einfo->info.depth = XCBAuxGetDepth(conn, screen); + einfo->info.depth = screen->root_depth; einfo->info.rotation = 0; einfo->info.debug = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); @@ -285,13 +319,13 @@ while (1) { - e = XCBPollForEvent(conn, NULL); + e = xcb_poll_for_event(conn, NULL); if (e) { switch (e->response_type) { - case XCBButtonPress: { - XCBButtonPressEvent *ev = (XCBButtonPressEvent *)e; + case XCB_BUTTON_PRESS: { + xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e; if (ev->detail.id == 3) { @@ -310,21 +344,21 @@ evas_event_feed_mouse_down(evas, ev->state, EVAS_BUTTON_NONE, 0, NULL); break; } - case XCBButtonRelease: { - XCBButtonReleaseEvent *ev = (XCBButtonReleaseEvent *)e; + case XCB_BUTTON_RELEASE: { + xcb_button_release_event_t *ev = (xcb_button_release_event_t *)e; evas_event_feed_mouse_move(evas, ev->event_x, ev->event_y, 0, NULL); evas_event_feed_mouse_up(evas, ev->state, EVAS_BUTTON_NONE, 0, NULL); break; } - case XCBMotionNotify: { - XCBMotionNotifyEvent *ev = (XCBMotionNotifyEvent *)e; + case XCB_MOTION_NOTIFY: { + xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)e; evas_event_feed_mouse_move(evas, ev->event_x, ev->event_y, 0, NULL); break; } - case XCBExpose: { - XCBExposeEvent *ev = (XCBExposeEvent *)e; + case XCB_EXPOSE: { + xcb_expose_event_t *ev = (xcb_expose_event_t *)e; evas_damage_rectangle_add(evas, ev->x, @@ -333,8 +367,8 @@ ev->height); break; } - case XCBConfigureNotify: { - XCBConfigureNotifyEvent *ev = (XCBConfigureNotifyEvent *)e; + case XCB_CONFIGURE_NOTIFY: { + xcb_configure_notify_event_t *ev = (xcb_configure_notify_event_t *)e; evas_output_size_set(evas, ev->width, @@ -350,7 +384,7 @@ { loop(); evas_render(evas); - XCBFlush(conn); + xcb_flush(conn); } if (pause_me == 2) usleep(100000); @@ -359,7 +393,7 @@ exit: setdown(); evas_free(evas); - XCBDisconnect(conn); + xcb_disconnect(conn); evas_shutdown(); return 0; =================================================================== RCS file: /cvs/e/e17/libs/evas/src/bin/evas_software_xcb_perf_load.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- evas_software_xcb_perf_load.c 6 May 2006 06:23:53 -0000 1.5 +++ evas_software_xcb_perf_load.c 1 Oct 2006 18:27:12 -0000 1.6 @@ -9,66 +9,88 @@ #define X_H /* make sure we aren't using symbols from X.h */ -#include <X11/XCB/xcb.h> -#include <X11/XCB/xcb_icccm.h> -#include <X11/XCB/xcb_aux.h> +#include <xcb/xcb.h> +#include <xcb/xcb_icccm.h> #include "Evas.h" #include "Evas_Engine_Software_Xcb.h" -XCBConnection *c = NULL; -XCBDRAWABLE win; +xcb_connection_t *c = NULL; +xcb_drawable_t win; -Evas *evas = NULL; +Evas *evas = NULL; -int win_w = 240; -int win_h = 240; +int win_w = 240; +int win_h = 240; +static xcb_visualtype_t * +visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen) +{ + xcb_depth_iterator_t iter_depth; + + if (!conn || !screen) return NULL; + + iter_depth = xcb_screen_allowed_depths_iterator(screen); + for (; iter_depth.rem; xcb_depth_next (&iter_depth)) + { + xcb_visualtype_iterator_t iter_vis; + + iter_vis = xcb_depth_visuals_iterator(iter_depth.data); + for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis)) + { + if (screen->root_visual.id == iter_vis.data->visual_id.id) + return iter_vis.data; + } + } + + return NULL; +} + static void -title_set (XCBConnection *c, XCBWINDOW win, const char *title) +title_set (xcb_connection_t *c, xcb_window_t win, const char *title) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_encoding = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); atom_name = "_NET_WM_NAME"; - cookie_property = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_property = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, - win, - rep->atom, encoding, 8, strlen (title), title); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, + win, + rep->atom, encoding, 8, strlen (title), title); free (rep); } static void -class_set (XCBConnection *c, XCBWINDOW win, const char *name, const char *class) +class_set (xcb_connection_t *c, xcb_window_t win, const char *name, const char *class) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; - char *class_str; - char *s; - int length_name; - int length_class; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; + char *class_str; + char *s; + int length_name; + int length_class; length_name = strlen (name); length_class = strlen (class); @@ -84,71 +106,82 @@ *s = '\0'; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_encoding = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); atom_name = "_WM_CLASS"; - cookie_property = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_property = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, - win, - rep->atom, encoding, 8, strlen (class_str), class_str); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, + win, + rep->atom, encoding, 8, strlen (class_str), class_str); free (rep); } int main(int argc, char **argv) { - int exposed = 0; - - XCBSCREEN *screen; - XCBGenericEvent *e; - CARD32 mask = 0; - CARD32 value[6]; - SizeHints *szhints; - int screen_nbr; + int exposed = 0; + xcb_screen_t *screen = NULL; + xcb_screen_iterator_t iter_screen; + xcb_generic_event_t *e; + uint32_t mask = 0; + uint32_t value[6]; + SizeHints *szhints; + int screen_nbr; - c = XCBConnect (NULL, &screen_nbr); + c = xcb_connect (NULL, &screen_nbr); if (!c) { printf("Error: cannot open a connection.\n"); exit(-1); } - screen = XCBAuxGetScreen (c, screen_nbr); + iter_screen = xcb_setup_roots_iterator (xcb_get_setup (c)); + for (; iter_screen.rem; --screen_nbr, xcb_screen_next (&iter_screen)) + if (screen == 0) + { + screen = iter_screen.data; + break; + } + if (!screen) + { + printf("Error: cannot get the screen.\n"); + exit(-1); + } mask = - XCBCWBackPixmap | XCBCWBorderPixel | - XCBCWBitGravity | XCBCWBackingStore | - XCBCWEventMask | XCBCWColormap; + XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | + XCB_CW_BIT_GRAVITY | XCB_CW_BACKING_STORE | + XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; - value[0] = XCBBackPixmapNone; + value[0] = XCB_BACK_PIXMAP_NONE; value[1] = 0; - value[2] = XCBGravityBitForget; - value[3] = XCBBackingStoreNotUseful; - value[4] = XCBEventMaskExposure | XCBEventMaskButtonPress | XCBEventMaskButtonRelease | XCBEventMaskPointerMotion; + value[2] = XCB_GRAVITY_BIT_FORGET; + 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[5] = screen->default_colormap.xid; - win.window = XCBWINDOWNew(c); - XCBCreateWindow (c, - XCBAuxGetDepth(c, screen), - win.window, screen->root, - 0, 0, - win_w, win_h, - 0, - XCBWindowClassInputOutput, - screen->root_visual, - mask, value); + win.window = xcb_window_new(c); + xcb_create_window (c, + screen->root_depth, + win.window, screen->root, + 0, 0, + win_w, win_h, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + screen->root_visual, + mask, value); title_set (c, win.window, "Evas XCB Performance Test"); class_set (c, win.window, "Evas_XCB_Perf_Test", "Main"); @@ -160,7 +193,7 @@ SetWMNormalHints(c, win.window, szhints); FreeSizeHints(szhints); - XCBMapWindow (c, win.window); + xcb_map_window (c, win.window); evas_init(); evas = evas_new(); @@ -174,10 +207,10 @@ /* the following is specific to the engine */ einfo->info.conn = c; - einfo->info.visual = XCBAuxGetVisualtype(c, screen_nbr, screen->root_visual); + einfo->info.visual = visualtype_get(c, screen); einfo->info.colormap = screen->default_colormap; einfo->info.drawable = win; - einfo->info.depth = XCBAuxGetDepth(c, screen); + einfo->info.depth = screen->root_depth; einfo->info.rotation = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); @@ -185,32 +218,32 @@ while (1) { - e = XCBPollForEvent(c, NULL); + e = xcb_poll_for_event(c, NULL); if (e) { switch (e->response_type) { - case XCBButtonPress: { - XCBButtonPressEvent *ev = (XCBButtonPressEvent *)e; + case XCB_BUTTON_PRESS: { + xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e; /* evas_event_button_down(evas, ev->event_x, ev->event_y, ev->detail.id);*/ break; } - case XCBButtonRelease: { - XCBButtonReleaseEvent *ev = (XCBButtonReleaseEvent *)e; + case XCB_BUTTON_RELEASE: { + xcb_button_release_event_t *ev = (xcb_button_release_event_t *)e; /* evas_event_button_up(evas, ev->event_x, ev->event_y, ev->detail.id);*/ break; } - case XCBMotionNotify: { - XCBMotionNotifyEvent *ev = (XCBMotionNotifyEvent *)e; + case XCB_MOTION_NOTIFY: { + xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)e; /* evas_event_move(evas, ev->event_x, ev->event_y);*/ break; } - case XCBExpose: { - XCBExposeEvent *ev = (XCBExposeEvent *)e; + case XCB_EXPOSE: { + xcb_expose_event_t *ev = (xcb_expose_event_t *)e; exposed = 1; evas_damage_rectangle_add(evas, @@ -225,36 +258,36 @@ } } evas_render(evas); - XCBFlush(c); + xcb_flush(c); if (exposed) { + char buf[4096]; Evas_Engine_Info_Software_Xcb *einfo; - Evas_Performance *perf; - char buf[4096]; - char *data, *key; - static mode_t default_mode = + Evas_Performance *perf; + char *data, *key; + static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; - FILE *f; + FILE *f; data = NULL; einfo = (Evas_Engine_Info_Software_Xcb *) evas_engine_info_get(evas); perf = einfo->func.performance_new(evas, c, - XCBAuxGetVisualtype(c, screen_nbr, screen->root_visual), + visualtype_get(c, screen), screen->default_colormap, win, - XCBAuxGetDepth(c, screen)); + screen->root_depth); key = einfo->func.performance_key_get(perf); snprintf(buf, sizeof(buf), "%s/.evas/%s", getenv("HOME"), key); free(key); f = fopen(buf, "r"); if (f) { - char buf[4096]; - size_t sz; + char buf[4096]; + size_t sz; sz = fread(buf, 1, 4000, f); if (sz > 0) =================================================================== RCS file: /cvs/e/e17/libs/evas/src/bin/evas_software_xcb_perf_test.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- evas_software_xcb_perf_test.c 9 Sep 2006 08:10:23 -0000 1.6 +++ evas_software_xcb_perf_test.c 1 Oct 2006 18:27:12 -0000 1.7 @@ -9,66 +9,89 @@ #define X_H /* make sure we aren't using symbols from X.h */ -#include <X11/XCB/xcb.h> -#include <X11/XCB/xcb_icccm.h> -#include <X11/XCB/xcb_aux.h> +#include <xcb/xcb.h> +#include <xcb/xcb_icccm.h> #include "Evas.h" #include "Evas_Engine_Software_Xcb.h" -XCBConnection *c = NULL; -XCBDRAWABLE win; +xcb_connection_t *c = NULL; +xcb_drawable_t win; -Evas *evas = NULL; +Evas *evas = NULL; -int win_w = 240; -int win_h = 240; +int win_w = 240; +int win_h = 240; + + +static xcb_visualtype_t * +visualtype_get(xcb_connection_t *conn, xcb_screen_t *screen) +{ + xcb_depth_iterator_t iter_depth; + + if (!conn || !screen) return NULL; + + iter_depth = xcb_screen_allowed_depths_iterator(screen); + for (; iter_depth.rem; xcb_depth_next (&iter_depth)) + { + xcb_visualtype_iterator_t iter_vis; + + iter_vis = xcb_depth_visuals_iterator(iter_depth.data); + for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis)) + { + if (screen->root_visual.id == iter_vis.data->visual_id.id) + return iter_vis.data; + } + } + + return NULL; +} static void -title_set (XCBConnection *c, XCBWINDOW win, const char *title) +title_set (xcb_connection_t *c, xcb_window_t win, const char *title) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, + cookie_encoding = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); atom_name = "_NET_WM_NAME"; - cookie_property = XCBInternAtom (c, + cookie_property = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, - win, - rep->atom, encoding, 8, strlen (title), title); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, + win, + rep->atom, encoding, 8, strlen (title), title); free (rep); } static void -class_set (XCBConnection *c, XCBWINDOW win, const char *name, const char *class) +class_set (xcb_connection_t *c, xcb_window_t win, const char *name, const char *class) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; - char *class_str; - char *s; - int length_name; - int length_class; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; + char *class_str; + char *s; + int length_name; + int length_class; length_name = strlen (name); length_class = strlen (class); @@ -84,71 +107,83 @@ *s = '\0'; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_encoding = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); atom_name = "_WM_CLASS"; - cookie_property = XCBInternAtom (c, - 0, - strlen (atom_name), - atom_name); + cookie_property = xcb_intern_atom (c, + 0, + strlen (atom_name), + atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, - win, - rep->atom, encoding, 8, strlen (class_str), class_str); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, + win, + rep->atom, encoding, 8, strlen (class_str), class_str); free (rep); } int main(int argc, char **argv) { - int exposed = 0; - XCBSCREEN *screen; - XCBGetInputFocusRep *reply; - XCBGenericEvent *e; - SizeHints *szhints; - CARD32 mask = 0; - CARD32 value[6]; - int screen_nbr; + int exposed = 0; + xcb_screen_t *screen = NULL; + xcb_screen_iterator_t iter_screen; + xcb_get_input_focus_reply_t *reply; + xcb_generic_event_t *e; + SizeHints *szhints; + uint32_t mask = 0; + uint32_t value[6]; + int screen_nbr; - c = XCBConnect (NULL, &screen_nbr); + c = xcb_connect (NULL, &screen_nbr); if (!c) { printf("Error: cannot open a connection.\n"); exit(-1); } - screen = XCBAuxGetScreen (c, screen_nbr); + iter_screen = xcb_setup_roots_iterator (xcb_get_setup (c)); + for (; iter_screen.rem; --screen_nbr, xcb_screen_next (&iter_screen)) + if (screen == 0) + { + screen = iter_screen.data; + break; + } + if (!screen) + { + printf("Error: cannot get the screen.\n"); + exit(-1); + } mask = - XCBCWBackPixmap | XCBCWBorderPixel | - XCBCWBitGravity | XCBCWBackingStore | - XCBCWEventMask | XCBCWColormap; + XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | + XCB_CW_BIT_GRAVITY | XCB_CW_BACKING_STORE | + XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; - value[0] = XCBBackPixmapNone; + value[0] = XCB_BACK_PIXMAP_NONE; value[1] = 0; - value[2] = XCBGravityBitForget; - value[3] = XCBBackingStoreNotUseful; - value[4] = XCBEventMaskExposure | XCBEventMaskButtonPress | XCBEventMaskButtonRelease | XCBEventMaskPointerMotion; + value[2] = XCB_GRAVITY_BIT_FORGET; + 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[5] = screen->default_colormap.xid; - win.window = XCBWINDOWNew(c); - XCBCreateWindow (c, - XCBAuxGetDepth(c, screen), - win.window, screen->root, - 0, 0, - win_w, win_h, - 0, - XCBWindowClassInputOutput, - screen->root_visual, - mask, value); + win.window = xcb_window_new(c); + xcb_create_window (c, + screen->root_depth, + win.window, screen->root, + 0, 0, + win_w, win_h, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + screen->root_visual, + mask, value); title_set (c, win.window, "Evas XCB Performance Test"); class_set (c, win.window, "Evas_XCB_Perf_Test", "Main"); @@ -159,11 +194,11 @@ SetWMNormalHints(c, win.window, szhints); FreeSizeHints(szhints); - XCBMapWindow (c, win.window); + xcb_map_window (c, win.window); /* we sync */ - reply = XCBGetInputFocusReply(c, - XCBGetInputFocusUnchecked(c), - NULL); + reply = xcb_get_input_focus_reply(c, + xcb_get_input_focus_unchecked(c), + NULL); free(reply); sleep(1); @@ -179,10 +214,10 @@ /* the following is specific to the engine */ einfo->info.conn = c; - einfo->info.visual = XCBAuxGetVisualtype(c, screen_nbr, screen->root_visual); + einfo->info.visual = visualtype_get(c, screen); einfo->info.colormap = screen->default_colormap; einfo->info.drawable = win; - einfo->info.depth = XCBAuxGetDepth(c, screen); + einfo->info.depth = screen->root_depth; einfo->info.rotation = 0; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); @@ -190,26 +225,26 @@ while (1) { - e = XCBPollForEvent(c, NULL); + e = xcb_poll_for_event(c, NULL); if (e) { switch (e->response_type) { - case XCBButtonPress: { - XCBButtonPressEvent *ev = (XCBButtonPressEvent *)e; + case XCB_BUTTON_PRESS: { + xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e; /* evas_event_button_down(evas, ev->event_x, ev->event_y, ev->detail.id);*/ break; } - case XCBButtonRelease: { - XCBButtonReleaseEvent *ev = (XCBButtonReleaseEvent *)e; + case XCB_BUTTON_RELEASE: { + xcb_button_release_event_t *ev = (xcb_button_release_event_t *)e; /* evas_event_button_up(evas, ev->event_x, ev->event_y, ev->detail.id);*/ break; } - case XCBExpose: { - XCBExposeEvent *ev = (XCBExposeEvent *)e; + case XCB_EXPOSE: { + xcb_expose_event_t *ev = (xcb_expose_event_t *)e; exposed = 1; evas_damage_rectangle_add(evas, @@ -224,13 +259,13 @@ } evas_render(evas); - XCBFlush(c); + xcb_flush(c); if (exposed) { + char buf[4096]; Evas_Engine_Info_Software_Xcb *einfo; Evas_Performance *perf; - char buf[4096]; char *data, *key; static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | @@ -241,10 +276,10 @@ (Evas_Engine_Info_Software_Xcb *) evas_engine_info_get(evas); perf = einfo->func.performance_test(evas, c, - XCBAuxGetVisualtype(c, screen_nbr, screen->root_visual), + visualtype_get(c, screen), screen->default_colormap, win, - XCBAuxGetDepth(c, screen)); + screen->root_depth); einfo->func.performance_device_store(perf); data = einfo->func.performance_data_get(perf); key = einfo->func.performance_key_get(perf); =================================================================== RCS file: /cvs/e/e17/libs/evas/src/bin/evas_xrender_xcb_main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- evas_xrender_xcb_main.c 12 Sep 2006 07:48:44 -0000 1.4 +++ evas_xrender_xcb_main.c 1 Oct 2006 18:27:12 -0000 1.5 @@ -4,59 +4,58 @@ #define X_H /* make sure we aren't using symbols from X.h */ -#include <X11/XCB/xcb.h> -#include <X11/XCB/shm.h> -#include <X11/XCB/render.h> -#include <X11/XCB/xcb_aux.h> +#include <xcb/xcb.h> +#include <xcb/shm.h> +#include <xcb/render.h> #include "Evas.h" #include "Evas_Engine_XRender_Xcb.h" static void -title_set (XCBConnection *c, XCBWINDOW win, const char *title) +title_set (xcb_connection_t *c, xcb_window_t win, const char *title) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, + cookie_encoding = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); atom_name = "_NET_WM_NAME"; - cookie_property = XCBInternAtom (c, + cookie_property = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, + xcb_change_property(c, XCB_PROP_MODE_REPLACE, win, rep->atom, encoding, 8, strlen (title), title); free (rep); } static void -class_set (XCBConnection *c, XCBWINDOW win, const char *name, const char *class) +class_set (xcb_connection_t *c, xcb_window_t win, const char *name, const char *class) { - XCBInternAtomCookie cookie_encoding; - XCBInternAtomCookie cookie_property; - XCBInternAtomRep *rep; - XCBATOM encoding; - char *atom_name; - char *class_str; - char *s; - int length_name; - int length_class; + xcb_intern_atom_cookie_t cookie_encoding; + xcb_intern_atom_cookie_t cookie_property; + xcb_intern_atom_reply_t *rep; + xcb_atom_t encoding; + char *atom_name; + char *class_str; + char *s; + int length_name; + int length_class; length_name = strlen (name); length_class = strlen (class); @@ -72,23 +71,23 @@ *s = '\0'; atom_name = "UTF8_STRING"; - cookie_encoding = XCBInternAtom (c, + cookie_encoding = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); atom_name = "_WM_CLASS"; - cookie_property = XCBInternAtom (c, + cookie_property = xcb_intern_atom (c, 0, strlen (atom_name), atom_name); - rep = XCBInternAtomReply (c, cookie_encoding, NULL); + rep = xcb_intern_atom_reply (c, cookie_encoding, NULL); encoding = rep->atom; free (rep); - rep = XCBInternAtomReply (c, cookie_property, NULL); + rep = xcb_intern_atom_reply (c, cookie_property, NULL); - XCBChangeProperty(c, XCBPropModeReplace, + xcb_change_property(c, XCB_PROP_MODE_REPLACE, win, rep->atom, encoding, 8, strlen (class_str), class_str); free (rep); @@ -98,52 +97,64 @@ int main(int argc, char **argv) { - int pause_me = 0; - XCBConnection *conn; - const XCBQueryExtensionRep *rep_shm; - const XCBQueryExtensionRep *rep_xrender; - XCBGetInputFocusRep *reply; - XCBSCREEN *screen; - XCBDRAWABLE win; - XCBGenericEvent *e; - CARD32 mask; - CARD32 value[6]; - int screen_nbr; + int pause_me = 0; + xcb_connection_t *conn; + const xcb_query_extension_reply_t *rep_shm; + const xcb_query_extension_reply_t *rep_xrender; + xcb_get_input_focus_reply_t *reply; + xcb_screen_t *screen = NULL; + xcb_screen_iterator_t iter_screen; + xcb_drawable_t win; + xcb_generic_event_t *e; + uint32_t mask; + uint32_t value[6]; + int screen_nbr; - conn = XCBConnect (NULL, &screen_nbr); + conn = xcb_connect (NULL, &screen_nbr); if (!conn) { printf("Error: cannot open a connection.\n"); exit(-1); } - XCBPrefetchExtensionData (conn, &XCBShmId); - XCBPrefetchExtensionData (conn, &XCBRenderId); - rep_shm = XCBGetExtensionData(conn, &XCBShmId); - rep_xrender = XCBGetExtensionData(conn, &XCBRenderId); - - screen = XCBAuxGetScreen (conn, screen_nbr); + xcb_prefetch_extension_data (conn, &xcb_shm_id); + xcb_prefetch_extension_data (conn, &xcb_render_id); + rep_shm = xcb_get_extension_data(conn, &xcb_shm_id); + rep_xrender = xcb_get_extension_data(conn, &xcb_render_id); + + iter_screen = xcb_setup_roots_iterator (xcb_get_setup (conn)); + for (; iter_screen.rem; --screen_nbr, xcb_screen_next (&iter_screen)) + if (screen == 0) + { + screen = iter_screen.data; + break; + } + if (!screen) + { + printf("Error: cannot get the screen.\n"); + exit(-1); + } mask = - XCBCWBackPixmap | XCBCWBorderPixel | - XCBCWBitGravity | XCBCWBackingStore | - XCBCWEventMask | XCBCWColormap; + XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | + XCB_CW_BIT_GRAVITY | XCB_CW_BACKING_STORE | + XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; - value[0] = XCBBackPixmapNone; + value[0] = XCB_BACK_PIXMAP_NONE; value[1] = 0; - value[2] = XCBGravityBitForget; - value[3] = XCBBackingStoreNotUseful; - value[4] = XCBEventMaskExposure | XCBEventMaskButtonPress | XCBEventMaskButtonRelease | XCBEventMaskPointerMotion | XCBEventMaskStructureNotify; + value[2] = XCB_GRAVITY_BIT_FORGET; + 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[5] = screen->default_colormap.xid; - win.window = XCBWINDOWNew(conn); - XCBCreateWindow (conn, - XCBAuxGetDepth(conn, screen), + win.window = xcb_window_new(conn); + xcb_create_window (conn, + screen->root_depth, win.window, screen->root, 0, 0, win_w, win_h, 0, - XCBWindowClassInputOutput, + XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual, mask, value); title_set (conn, win.window, "Evas XRender Xcb Test"); @@ -154,10 +165,10 @@ szhints.min_height = szhints.max_height = win_h; XSetWMNormalHints(disp, win, &szhints); #endif - XCBMapWindow (conn, win.window); + xcb_map_window (conn, win.window); /* we sync */ - reply = XCBGetInputFocusReply(conn, - XCBGetInputFocusUnchecked(conn), + reply = xcb_get_input_focus_reply(conn, + xcb_get_input_focus_unchecked(conn), NULL); free(reply); @@ -183,13 +194,13 @@ orig_start_time = start_time = get_time(); while (1) { - e = XCBPollForEvent(conn, NULL); + e = xcb_poll_for_event(conn, NULL); if (e) { switch (e->response_type) { - case XCBButtonPress: { - XCBButtonPressEvent *ev = (XCBButtonPressEvent *)e; + case XCB_BUTTON_PRESS: { + xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e; if (ev->detail.id == 3) { @@ -208,21 +219,21 @@ evas_event_feed_mouse_down(evas, ev->state, EVAS_BUTTON_NONE, 0, NULL); break; } - case XCBButtonRelease: { - XCBButtonReleaseEvent *ev = (XCBButtonReleaseEvent *)e; + case XCB_BUTTON_RELEASE: { + xcb_button_release_event_t *ev = (xcb_button_release_event_t *)e; evas_event_feed_mouse_move(evas, ev->event_x, ev->event_y, 0, NULL); evas_event_feed_mouse_up(evas, ev->state, EVAS_BUTTON_NONE, 0, NULL); break; } - case XCBMotionNotify: { - XCBMotionNotifyEvent *ev = (XCBMotionNotifyEvent *)e; + case XCB_MOTION_NOTIFY: { + xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)e; evas_event_feed_mouse_move(evas, ev->event_x, ev->event_y, 0, NULL); break; } - case XCBExpose: { - XCBExposeEvent *ev = (XCBExposeEvent *)e; + case XCB_EXPOSE: { + xcb_expose_event_t *ev = (xcb_expose_event_t *)e; evas_damage_rectangle_add(evas, ev->x, @@ -231,8 +242,8 @@ ev->height); break; } - case XCBConfigureNotify: { - XCBConfigureNotifyEvent *ev = (XCBConfigureNotifyEvent *)e; + case XCB_CONFIGURE_NOTIFY: { + xcb_configure_notify_event_t *ev = (xcb_configure_notify_event_t *)e; evas_output_size_set(evas, ev->width, @@ -248,7 +259,7 @@ { loop(); evas_render(evas); - XCBFlush(conn); + xcb_flush(conn); } if (pause_me == 2) usleep(100000); @@ -257,7 +268,7 @@ exit: setdown(); evas_free(evas); - XCBDisconnect(conn); + xcb_disconnect(conn); evas_shutdown(); return 0; ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs