[PATCH kdrive/ephyr v3 1/3] ephyr: drop a lot of deprecated code
Laércio de Sousa
laerciosousa at sme-mogidascruzes.sp.gov.br
Wed May 25 13:26:53 UTC 2016
After commit 623ff251, a lot of functions and data structures
in ephyr/hostx.{c,h} became uneeded. We are removing them now.
Signed-off-by: Laércio de Sousa <laerciosousa at sme-mogidascruzes.sp.gov.br>
---
hw/kdrive/ephyr/hostx.c | 227 ------------------------------------------------
hw/kdrive/ephyr/hostx.h | 46 ----------
2 files changed, 273 deletions(-)
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index cdb12b0..ca3e43f 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1231,233 +1231,6 @@ hostx_get_fd(void)
return xcb_get_file_descriptor(HostX.conn);
}
-int
-hostx_get_window(int a_screen_number)
-{
- EphyrScrPriv *scrpriv;
- if (a_screen_number < 0 || a_screen_number >= HostX.n_screens) {
- EPHYR_LOG_ERROR("bad screen number:%d\n", a_screen_number);
- return 0;
- }
- scrpriv = HostX.screens[a_screen_number]->driver;
- return scrpriv->win;
-}
-
-int
-hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attrs)
-{
- xcb_get_geometry_cookie_t geom_cookie;
- xcb_get_window_attributes_cookie_t attr_cookie;
- xcb_get_geometry_reply_t *geom_reply;
- xcb_get_window_attributes_reply_t *attr_reply;
-
- geom_cookie = xcb_get_geometry(HostX.conn, a_window);
- attr_cookie = xcb_get_window_attributes(HostX.conn, a_window);
- geom_reply = xcb_get_geometry_reply(HostX.conn, geom_cookie, NULL);
- attr_reply = xcb_get_window_attributes_reply(HostX.conn, attr_cookie, NULL);
-
- a_attrs->x = geom_reply->x;
- a_attrs->y = geom_reply->y;
- a_attrs->width = geom_reply->width;
- a_attrs->height = geom_reply->height;
- a_attrs->visualid = attr_reply->visual;
-
- free(geom_reply);
- free(attr_reply);
- return TRUE;
-}
-
-int
-hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries)
-{
- Bool is_ok = FALSE;
- EphyrHostVisualInfo *host_visuals = NULL;
- int nb_items = 0, i = 0, screen_num;
- xcb_screen_iterator_t screens;
- xcb_depth_iterator_t depths;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_visuals && a_num_entries, FALSE);
- EPHYR_LOG("enter\n");
-
- screens = xcb_setup_roots_iterator(xcb_get_setup(HostX.conn));
- for (screen_num = 0; screens.rem; screen_num++, xcb_screen_next(&screens)) {
- depths = xcb_screen_allowed_depths_iterator(screens.data);
- for (; depths.rem; xcb_depth_next(&depths)) {
- xcb_visualtype_t *visuals = xcb_depth_visuals(depths.data);
- EphyrHostVisualInfo *tmp_visuals =
- reallocarray(host_visuals,
- nb_items + depths.data->visuals_len,
- sizeof(EphyrHostVisualInfo));
- if (!tmp_visuals) {
- goto out;
- }
- host_visuals = tmp_visuals;
- for (i = 0; i < depths.data->visuals_len; i++) {
- host_visuals[nb_items + i].visualid = visuals[i].visual_id;
- host_visuals[nb_items + i].screen = screen_num;
- host_visuals[nb_items + i].depth = depths.data->depth;
- host_visuals[nb_items + i].class = visuals[i]._class;
- host_visuals[nb_items + i].red_mask = visuals[i].red_mask;
- host_visuals[nb_items + i].green_mask = visuals[i].green_mask;
- host_visuals[nb_items + i].blue_mask = visuals[i].blue_mask;
- host_visuals[nb_items + i].colormap_size = visuals[i].colormap_entries;
- host_visuals[nb_items + i].bits_per_rgb = visuals[i].bits_per_rgb_value;
- }
- nb_items += depths.data->visuals_len;
- }
- }
-
- EPHYR_LOG("host advertises %d visuals\n", nb_items);
- *a_visuals = host_visuals;
- *a_num_entries = nb_items;
- host_visuals = NULL;
-
- is_ok = TRUE;
-out:
- free(host_visuals);
- host_visuals = NULL;
- EPHYR_LOG("leave\n");
- return is_ok;
-
-}
-
-int
-hostx_create_window(int a_screen_number,
- EphyrBox * a_geometry,
- int a_visual_id, int *a_host_peer /*out parameter */ )
-{
- Bool is_ok = FALSE;
- xcb_window_t win;
- int winmask = 0;
- uint32_t attrs[2];
- xcb_screen_t *screen = xcb_aux_get_screen(HostX.conn, hostx_get_screen());
- xcb_visualtype_t *visual;
- int depth = 0;
- EphyrScrPriv *scrpriv = HostX.screens[a_screen_number]->driver;
-
- EPHYR_RETURN_VAL_IF_FAIL(screen && a_geometry, FALSE);
-
- EPHYR_LOG("enter\n");
-
- visual = xcb_aux_find_visual_by_id(screen, a_visual_id);
- if (!visual) {
- EPHYR_LOG_ERROR ("argh, could not find a remote visual with id:%d\n",
- a_visual_id);
- goto out;
- }
- depth = xcb_aux_get_depth_of_visual(screen, a_visual_id);
-
- winmask = XCB_CW_EVENT_MASK | XCB_CW_COLORMAP;
- attrs[0] = XCB_EVENT_MASK_BUTTON_PRESS
- |XCB_EVENT_MASK_BUTTON_RELEASE
- |XCB_EVENT_MASK_POINTER_MOTION
- |XCB_EVENT_MASK_KEY_PRESS
- |XCB_EVENT_MASK_KEY_RELEASE
- |XCB_EVENT_MASK_EXPOSURE;
- attrs[1] = xcb_generate_id(HostX.conn);
- xcb_create_colormap(HostX.conn,
- XCB_COLORMAP_ALLOC_NONE,
- attrs[1],
- hostx_get_window(a_screen_number),
- a_visual_id);
-
- win = xcb_generate_id(HostX.conn);
- xcb_create_window(HostX.conn,
- depth,
- win,
- hostx_get_window (a_screen_number),
- a_geometry->x, a_geometry->y,
- a_geometry->width, a_geometry->height, 0,
- XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- a_visual_id, winmask, attrs);
-
- if (scrpriv->peer_win == XCB_NONE) {
- scrpriv->peer_win = win;
- }
- else {
- EPHYR_LOG_ERROR("multiple peer windows created for same screen\n");
- }
- xcb_flush(HostX.conn);
- xcb_map_window(HostX.conn, win);
- *a_host_peer = win;
- is_ok = TRUE;
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-int
-hostx_destroy_window(int a_win)
-{
- xcb_destroy_window(HostX.conn, a_win);
- xcb_flush(HostX.conn);
- return TRUE;
-}
-
-int
-hostx_set_window_geometry(int a_win, EphyrBox * a_geo)
-{
- uint32_t mask = XCB_CONFIG_WINDOW_X
- | XCB_CONFIG_WINDOW_Y
- | XCB_CONFIG_WINDOW_WIDTH
- | XCB_CONFIG_WINDOW_HEIGHT;
- uint32_t values[4];
-
- EPHYR_RETURN_VAL_IF_FAIL(a_geo, FALSE);
-
- EPHYR_LOG("enter. x,y,w,h:(%d,%d,%d,%d)\n",
- a_geo->x, a_geo->y, a_geo->width, a_geo->height);
-
- values[0] = a_geo->x;
- values[1] = a_geo->y;
- values[2] = a_geo->width;
- values[3] = a_geo->height;
- xcb_configure_window(HostX.conn, a_win, mask, values);
-
- EPHYR_LOG("leave\n");
- return TRUE;
-}
-
-int
-hostx_set_window_bounding_rectangles(int a_window,
- EphyrRect * a_rects, int a_num_rects)
-{
- Bool is_ok = FALSE;
- int i = 0;
- xcb_rectangle_t *rects = NULL;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_rects, FALSE);
-
- EPHYR_LOG("enter. num rects:%d\n", a_num_rects);
-
- rects = calloc(a_num_rects, sizeof (xcb_rectangle_t));
- if (!rects)
- goto out;
- for (i = 0; i < a_num_rects; i++) {
- rects[i].x = a_rects[i].x1;
- rects[i].y = a_rects[i].y1;
- rects[i].width = abs(a_rects[i].x2 - a_rects[i].x1);
- rects[i].height = abs(a_rects[i].y2 - a_rects[i].y1);
- EPHYR_LOG("borders clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
- rects[i].x, rects[i].y, rects[i].width, rects[i].height);
- }
- xcb_shape_rectangles(HostX.conn,
- XCB_SHAPE_SO_SET,
- XCB_SHAPE_SK_BOUNDING,
- XCB_CLIP_ORDERING_YX_BANDED,
- a_window,
- 0, 0,
- a_num_rects,
- rects);
- is_ok = TRUE;
-
-out:
- free(rects);
- rects = NULL;
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
#ifdef GLAMOR
Bool
ephyr_glamor_init(ScreenPtr screen)
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index 96d7394..1bc6f7e 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -43,32 +43,6 @@
typedef struct EphyrHostXVars EphyrHostXVars;
-typedef struct {
- VisualID visualid;
- int screen;
- int depth;
- int class;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- int colormap_size;
- int bits_per_rgb;
-} EphyrHostVisualInfo;
-
-typedef struct {
- int x, y;
- int width, height;
- int visualid;
-} EphyrHostWindowAttributes;
-
-typedef struct {
- int x, y, width, height;
-} EphyrBox;
-
-typedef struct {
- short x1, y1, x2, y2;
-} EphyrRect;
-
int
hostx_want_screen_geometry(KdScreenInfo *screen, int *width, int *height, int *x, int *y);
@@ -157,26 +131,6 @@ hostx_get_xcbconn(void);
int
hostx_get_screen(void);
-int
- hostx_get_window(int a_screen_number);
-
-int
- hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
-
-int
- hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
-
-int hostx_create_window(int a_screen_number,
- EphyrBox * a_geometry,
- int a_visual_id, int *a_host_win /*out parameter */ );
-
-int hostx_destroy_window(int a_win);
-
-int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
-
-int hostx_set_window_bounding_rectangles(int a_window,
- EphyrRect * a_rects, int a_num_rects);
-
int hostx_has_extension(xcb_extension_t *extension);
int hostx_get_fd(void);
--
2.7.4
More information about the xorg-devel
mailing list