Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何使用xcb绘制到根窗口的pixmap?_Linux_Window Managers_Xcb - Fatal编程技术网

Linux 如何使用xcb绘制到根窗口的pixmap?

Linux 如何使用xcb绘制到根窗口的pixmap?,linux,window-managers,xcb,Linux,Window Managers,Xcb,我正在尝试编写一个带有墙纸切换器的窗口管理器: void smoke_change_background(smoke_wm_state_t *config, char *desktop) { struct smoke_desktop_list_element_t *node = smoke_desktop_list_node(config->tree, desktop); if (node->background != 0) { xcb_intern_atom_re

我正在尝试编写一个带有墙纸切换器的窗口管理器:

void smoke_change_background(smoke_wm_state_t *config, char *desktop) {
  struct smoke_desktop_list_element_t *node = smoke_desktop_list_node(config->tree, desktop);

  if (node->background != 0) {
    xcb_intern_atom_reply_t *xpmap = xcb_intern_atom_reply(config->connection,
            xcb_intern_atom(config->connection,
                            false,
                            strlen("_X_ROOTPMAP_ID"),
                            "_X_ROOTPMAP_ID"),
            NULL);
    xcb_intern_atom_reply_t *esetr = xcb_intern_atom_reply(config->connection,
            xcb_intern_atom(config->connection,
                            false,
                            strlen("ESETROOT_PMAP_ID"),
                            "ESETROOT_PMAP_ID"),
            NULL);

    xcb_get_property_reply_t *xrepl = xcb_get_property_reply(config->connection,
            xcb_get_property(config->connection,
                             0,
                             config->screen->root,
                             xpmap->atom,
                             XCB_ATOM_PIXMAP,
                             0,
                             32),
            NULL);
    uint32_t *xp = (uint32_t*) xcb_get_property_value(xrepl);

    xcb_get_property_reply_t *erepl = xcb_get_property_reply(config->connection,
            xcb_get_property(config->connection,
                             0,
                             config->screen->root,
                             esetr->atom,
                             XCB_ATOM_PIXMAP,
                             0, 32),
            NULL);
    uint32_t *ep = (uint32_t*) xcb_get_property_value(erepl);

    xcb_change_property(config->connection,
                            XCB_PROP_MODE_REPLACE,
                            config->screen->root,
                            xpmap->atom,
                            XCB_ATOM_PIXMAP,
                            32, 1,
                            (void*) &node->background);
    xcb_change_property(config->connection,
                            XCB_PROP_MODE_REPLACE,
                            config->screen->root,
                            esetr->atom,
                            XCB_ATOM_PIXMAP,
                            32, 1,
                            (void*) &node->background);

    xcb_free_pixmap(config->connection, *xp);
    xcb_free_pixmap(config->connection, *ep);

    uint32_t values[1];
    values[0] = node->background;
    xcb_change_window_attributes(config->connection, config->screen->root, XCB_CW_BACK_PIXMAP, values);

    xcb_clear_area(config->connection, false, config->screen->root, 0, 0, 0, 0);
    xcb_flush(config->connection);
  }
}
这段代码应该更改根目录的pixmap,它应该显示在我的Xephyr窗口中,但事实并非如此。怎么了