当前位置: 首页>>代码示例>>C++>>正文


C++ xcb_change_window_attributes函数代码示例

本文整理汇总了C++中xcb_change_window_attributes函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_change_window_attributes函数的具体用法?C++ xcb_change_window_attributes怎么用?C++ xcb_change_window_attributes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xcb_change_window_attributes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: window_set_visibility

void window_set_visibility(xcb_window_t win, bool visible)
{
	uint32_t values_off[] = {ROOT_EVENT_MASK & ~XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY};
	uint32_t values_on[] = {ROOT_EVENT_MASK};
	xcb_change_window_attributes(dpy, root, XCB_CW_EVENT_MASK, values_off);
	if (visible) {
		xcb_map_window(dpy, win);
	} else {
		xcb_unmap_window(dpy, win);
	}
	xcb_change_window_attributes(dpy, root, XCB_CW_EVENT_MASK, values_on);
}
开发者ID:Stebalien,项目名称:bspwm,代码行数:12,代码来源:window.c

示例2: xcb_generate_id

void X11WindowedBackend::createCursor(const QImage &img, const QPoint &hotspot)
{
    const xcb_pixmap_t pix = xcb_generate_id(m_connection);
    const xcb_gcontext_t gc = xcb_generate_id(m_connection);
    const xcb_cursor_t cid = xcb_generate_id(m_connection);

    xcb_create_pixmap(m_connection, 32, pix, m_screen->root, img.width(), img.height());
    xcb_create_gc(m_connection, gc, pix, 0, nullptr);

    xcb_put_image(m_connection, XCB_IMAGE_FORMAT_Z_PIXMAP, pix, gc, img.width(), img.height(), 0, 0, 0, 32, img.byteCount(), img.constBits());

    XRenderPicture pic(pix, 32);
    xcb_render_create_cursor(m_connection, cid, pic, hotspot.x(), hotspot.y());
    for (auto it = m_windows.constBegin(); it != m_windows.constEnd(); ++it) {
        xcb_change_window_attributes(m_connection, (*it).window, XCB_CW_CURSOR, &cid);
    }

    xcb_free_pixmap(m_connection, pix);
    xcb_free_gc(m_connection, gc);
    if (m_cursor) {
        xcb_free_cursor(m_connection, m_cursor);
    }
    m_cursor = cid;
    xcb_flush(m_connection);
    markCursorAsRendered();
}
开发者ID:shadeslayer,项目名称:kwin,代码行数:26,代码来源:x11windowed_backend.cpp

示例3: client_focus

void client_focus(Client *c) {
	if(!c || !ISVISIBLE(c)) {
		for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
	}

	if(selmon->sel) {
		client_unfocus(selmon->sel, false);
	}

	if(c) {
		if(c->mon != selmon) {
			selmon = c->mon;
		}

		if(c->isurgent) {
			client_clear_urgent(c);
		}

		client_detach_stack(c);
		client_attach_stack(c);
		grabbuttons(c, true);
		xcb_change_window_attributes(conn, c->win, XCB_CW_BORDER_PIXEL, (uint32_t*)&dc.sel[ColBorder]);
		xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, c->win, XCB_CURRENT_TIME);
	}
	else {
		xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
	}

	selmon->sel = c;
	draw_bars();
}
开发者ID:julian-goldsmith,项目名称:dwm-xcb,代码行数:31,代码来源:client.c

示例4: redraw_screen

/*
 * Calls draw_image on a new pixmap and swaps that with the current pixmap
 *
 */
void redraw_screen(void) {

    /* avoid drawing if monitor state is not on */
    if (dpms_capable) {
        xcb_dpms_info_reply_t *dpms_info =
            xcb_dpms_info_reply(conn,xcb_dpms_info(conn), NULL);
        if (dpms_info) {
            /* monitor is off when DPMS state is enabled and power level is not
             * DPMS_MODE_ON */
            uint8_t monitor_off = dpms_info->state
                && dpms_info->power_level != XCB_DPMS_DPMS_MODE_ON;
            free(dpms_info);
            if (monitor_off)
                return;
        }
    }

    xcb_pixmap_t bg_pixmap = draw_image(last_resolution);
    xcb_change_window_attributes(conn, win, XCB_CW_BACK_PIXMAP, (uint32_t[1]){ bg_pixmap });
    /* XXX: Possible optimization: Only update the area in the middle of the
     * screen instead of the whole screen. */
    xcb_clear_area(conn, 0, win, 0, 0, last_resolution[0], last_resolution[1]);
    xcb_free_pixmap(conn, bg_pixmap);
    xcb_flush(conn);
}
开发者ID:jlesquembre,项目名称:i3lock-blur,代码行数:29,代码来源:unlock_indicator.c

示例5: QXcbObject

QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number)
    : QXcbObject(connection)
    , m_screen(screen)
    , m_number(number)
{
    printf ("\n");
    printf ("Information of screen %d:\n", screen->root);
    printf ("  width.........: %d\n", screen->width_in_pixels);
    printf ("  height........: %d\n", screen->height_in_pixels);
    printf ("  depth.........: %d\n", screen->root_depth);
    printf ("  white pixel...: %x\n", screen->white_pixel);
    printf ("  black pixel...: %x\n", screen->black_pixel);
    printf ("\n");

    const quint32 mask = XCB_CW_EVENT_MASK;
    const quint32 values[] = {
        // XCB_CW_EVENT_MASK
        XCB_EVENT_MASK_ENTER_WINDOW
        | XCB_EVENT_MASK_LEAVE_WINDOW
        | XCB_EVENT_MASK_PROPERTY_CHANGE
    };

    xcb_change_window_attributes(xcb_connection(), screen->root, mask, values);

    xcb_generic_error_t *error;

    xcb_get_property_reply_t *reply =
        xcb_get_property_reply(xcb_connection(),
            xcb_get_property(xcb_connection(), false, screen->root,
                             atom(QXcbAtom::_NET_SUPPORTING_WM_CHECK),
                             XCB_ATOM_WINDOW, 0, 1024), &error);

    if (reply && reply->format == 32 && reply->type == XCB_ATOM_WINDOW) {
        xcb_window_t windowManager = *((xcb_window_t *)xcb_get_property_value(reply));

        if (windowManager != XCB_WINDOW_NONE) {
            xcb_get_property_reply_t *windowManagerReply =
                xcb_get_property_reply(xcb_connection(),
                    xcb_get_property(xcb_connection(), false, windowManager,
                                     atom(QXcbAtom::_NET_WM_NAME),
                                     atom(QXcbAtom::UTF8_STRING), 0, 1024), &error);
            if (windowManagerReply && windowManagerReply->format == 8 && windowManagerReply->type == atom(QXcbAtom::UTF8_STRING)) {
                m_windowManagerName = QString::fromUtf8((const char *)xcb_get_property_value(windowManagerReply), xcb_get_property_value_length(windowManagerReply));
                printf("Running window manager: %s\n", qPrintable(m_windowManagerName));
            } else if (error) {
                connection->handleXcbError(error);
                free(error);
            }

            free(windowManagerReply);
        }
    } else if (error) {
        connection->handleXcbError(error);
        free(error);
    }

    free(reply);

    m_syncRequestSupported = m_windowManagerName != QLatin1String("KWin");
}
开发者ID:RS102839,项目名称:qt,代码行数:60,代码来源:qxcbscreen.cpp

示例6: watch

void watch(xcb_window_t win, bool state)
{
    if (win == XCB_NONE)
        return;
    uint32_t value = (state ? XCB_EVENT_MASK_PROPERTY_CHANGE : XCB_EVENT_MASK_NO_EVENT);
    xcb_change_window_attributes(dpy, win, XCB_CW_EVENT_MASK, &value);
}
开发者ID:mmso,项目名称:xtitle,代码行数:7,代码来源:xtitle.c

示例7: RegisterEvents

/**
 * (Try to) register to mouse events on a window if needed.
 */
static void RegisterEvents (vlc_object_t *obj, xcb_connection_t *conn,
                            xcb_window_t wnd)
{
    /* Subscribe to parent window resize events */
    uint32_t value = XCB_EVENT_MASK_POINTER_MOTION;
    xcb_change_window_attributes (conn, wnd, XCB_CW_EVENT_MASK, &value);
    /* Try to subscribe to click events */
    /* (only one X11 client can get them, so might not work) */
    if (var_InheritBool (obj, "mouse-events"))
    {
        value |= XCB_EVENT_MASK_BUTTON_PRESS
               | XCB_EVENT_MASK_BUTTON_RELEASE;
        xcb_change_window_attributes (conn, wnd,
                                      XCB_CW_EVENT_MASK, &value);
    }
}
开发者ID:maniacs-m,项目名称:vlc,代码行数:19,代码来源:events.c

示例8: cursor_set

static void
cursor_set (xcb_connection_t *c,
            xcb_screen_t     *screen,
            xcb_window_t      window,
            int               cursor_id)
{
  uint32_t             values_list[3];
  xcb_void_cookie_t    cookie_font;
  xcb_void_cookie_t    cookie_gc;
  xcb_generic_error_t *error;
  xcb_font_t           font;
  xcb_cursor_t         cursor;
  xcb_gcontext_t       gc;
  uint32_t             mask;
  uint32_t             value_list;

  font = xcb_generate_id (c);
  cookie_font = xcb_open_font_checked (c, font,
                                       strlen ("cursor"),
                                       "cursor");
  error = xcb_request_check (c, cookie_font);
  if (error) {
    fprintf (stderr, "ERROR: can't open font : %d\n", error->error_code);
    xcb_disconnect (c);
    exit (-1);
  }

  cursor = xcb_generate_id (c);
  xcb_create_glyph_cursor (c, cursor, font, font,
                           cursor_id, cursor_id + 1,
                           0, 0, 0,
                           0, 0, 0);

  gc = xcb_generate_id (c);
  mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;
  values_list[0] = screen->black_pixel;
  values_list[1] = screen->white_pixel;
  values_list[2] = font;
  cookie_gc = xcb_create_gc_checked (c, gc, window, mask, values_list);
  error = xcb_request_check (c, cookie_gc);
  if (error) {
    fprintf (stderr, "ERROR: can't create gc : %d\n", error->error_code);
    xcb_disconnect (c);
    exit (-1);
  }

  mask = XCB_CW_CURSOR;
  value_list = cursor;
  xcb_change_window_attributes (c, window, mask, &value_list);

  xcb_free_cursor (c, cursor);

  cookie_font = xcb_close_font_checked (c, font);
  error = xcb_request_check (c, cookie_font);
  if (error) {
    fprintf (stderr, "ERROR: can't close font : %d\n", error->error_code);
    xcb_disconnect (c);
    exit (-1);
  }
}
开发者ID:digitaltembo,项目名称:jade,代码行数:60,代码来源:x11cursor.cpp

示例9: EmOpen

/**
 * Wrap an existing X11 window to embed the video.
 */
static int EmOpen (vout_window_t *wnd, const vout_window_cfg_t *cfg)
{
    xcb_window_t window = var_InheritInteger (wnd, "drawable-xid");
    if (window == 0)
        return VLC_EGENERIC;

    if (AcquireDrawable (VLC_OBJECT(wnd), window))
        return VLC_EGENERIC;

    vout_window_sys_t *p_sys = malloc (sizeof (*p_sys));
    xcb_connection_t *conn = xcb_connect (NULL, NULL);
    if (p_sys == NULL || xcb_connection_has_error (conn))
        goto error;

    p_sys->embedded = true;
    p_sys->keys = NULL;
    wnd->handle.xid = window;
    wnd->control = Control;
    wnd->sys = p_sys;

    p_sys->conn = conn;

    xcb_get_geometry_reply_t *geo =
        xcb_get_geometry_reply (conn, xcb_get_geometry (conn, window), NULL);
    if (geo == NULL)
    {
        msg_Err (wnd, "bad X11 window 0x%08"PRIx8, window);
        goto error;
    }
    p_sys->root = geo->root;
    free (geo);

    if (var_InheritBool (wnd, "keyboard-events"))
    {
        p_sys->keys = CreateKeyHandler (VLC_OBJECT(wnd), conn);
        if (p_sys->keys != NULL)
        {
            const uint32_t mask = XCB_CW_EVENT_MASK;
            const uint32_t values[1] = {
                XCB_EVENT_MASK_KEY_PRESS,
            };
            xcb_change_window_attributes (conn, window, mask, values);
        }
    }

    CacheAtoms (p_sys);
    if ((p_sys->keys != NULL)
     && vlc_clone (&p_sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
        DestroyKeyHandler (p_sys->keys);

    xcb_flush (conn);
    (void) cfg;
    return VLC_SUCCESS;

error:
    xcb_disconnect (conn);
    free (p_sys);
    ReleaseDrawable (VLC_OBJECT(wnd), window);
    return VLC_EGENERIC;
}
开发者ID:CSRedRat,项目名称:vlc,代码行数:63,代码来源:window.c

示例10: xcb_generate_id

struct window *add_win(struct window **list, xcb_window_t wid)
{
	struct window *w = NULL;
	uint32_t mask = XCB_CW_EVENT_MASK;
	const uint32_t vals[1] = { XCB_EVENT_MASK_PROPERTY_CHANGE };
	uint8_t flag;

	if ((w = malloc(sizeof(struct window)))) {
		w->id = wid;
		w->damage = xcb_generate_id(X);
		flag = XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY;
		xcb_damage_create(X, w->damage, w->id, flag);
		w->region = xcb_generate_id(X);
		flag = XCB_SHAPE_SK_BOUNDING;
		xcb_xfixes_create_region_from_window(X, w->region, w->id, flag);
		w->pixmap = XCB_NONE;
		w->picture = XCB_NONE;
		w->opacity = get_window_opacity(w->id);
		w->alpha = XCB_NONE;
		w->prev = NULL;
		w->next = *list;
		*list = w;
		xcb_change_window_attributes(X, w->id, mask, vals);
	} else {
		fprintf(stderr, "add_window: can't alloc memory\n");
	}
	return w;
}
开发者ID:dosbre,项目名称:xray,代码行数:28,代码来源:window.c

示例11: simplewindow_border_color_set

/** Set a simple window border color.
 * \param sw The simple window to change border width.
 * \param color The border color.
 */
void
simplewindow_border_color_set(simple_window_t *sw, const xcolor_t *color)
{
    xcb_change_window_attributes(globalconf.connection, sw->window,
                                 XCB_CW_BORDER_PIXEL, &color->pixel);
    sw->border.color = *color;
}
开发者ID:kanru,项目名称:awesome,代码行数:11,代码来源:swindow.c

示例12: set_override

static void
set_override(xcb_window_t w, int or)
{
	uint32_t mask = XCB_CW_OVERRIDE_REDIRECT;
	uint32_t val[] = { or };

	xcb_change_window_attributes(conn, w, mask, val);
}
开发者ID:ThomasAdam,项目名称:core,代码行数:8,代码来源:ignw.c

示例13: register_events

void
register_events(xcb_window_t w, uint32_t m)
{
	uint32_t val[] = { m };

	xcb_change_window_attributes(conn, w, XCB_CW_EVENT_MASK, val);
	xcb_flush(conn);
}
开发者ID:laserswald,项目名称:opt,代码行数:8,代码来源:wew.c

示例14: luaA_systray

/** Update the systray
 * \param L The Lua VM state.
 * \return The number of elements pushed on stack.
 * \luastack
 * \lparam The drawin to display the systray in.
 * \lparam x X position for the systray.
 * \lparam y Y position for the systray.
 * \lparam base_size The size (width and height) each systray item gets.
 * \lparam horiz If true, the systray is horizontal, else vertical.
 * \lparam bg Color of the systray background.
 * \lparam revers If true, the systray icon order will be reversed, else default.
 * \lparam spacing The size of the spacing between icons.
 */
int
luaA_systray(lua_State *L)
{
    systray_register();

    if(lua_gettop(L) != 0)
    {
        size_t bg_len;
        drawin_t *w = luaA_checkudata(L, 1, &drawin_class);
        int x = luaL_checkinteger(L, 2);
        int y = luaL_checkinteger(L, 3);
        int base_size = luaL_checkinteger(L, 4);
        bool horiz = lua_toboolean(L, 5);
        const char *bg = luaL_checklstring(L, 6, &bg_len);
        bool revers = lua_toboolean(L, 7);
        int spacing = luaL_checkinteger(L, 8);
        color_t bg_color;

        if(color_init_reply(color_init_unchecked(&bg_color, bg, bg_len)))
        {
            uint32_t config_back[] = { bg_color.pixel };
            xcb_change_window_attributes(globalconf.connection,
                                         globalconf.systray.window,
                                         XCB_CW_BACK_PIXEL, config_back);
        }

        if(globalconf.systray.parent != w)
            xcb_reparent_window(globalconf.connection,
                                globalconf.systray.window,
                                w->window,
                                x, y);
        else
        {
            uint32_t config_vals[2] = { x, y };
            xcb_configure_window(globalconf.connection,
                                 globalconf.systray.window,
                                 XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
                                 config_vals);
        }

        globalconf.systray.parent = w;

        if(globalconf.embedded.len != 0)
        {
            systray_update(base_size, horiz, revers, spacing);
            xcb_map_window(globalconf.connection,
                           globalconf.systray.window);
        }
        else
            xcb_unmap_window(globalconf.connection,
                             globalconf.systray.window);
    }

    lua_pushinteger(L, globalconf.embedded.len);
    luaA_object_push(L, globalconf.systray.parent);
    return 2;
}
开发者ID:mcm3c,项目名称:configs,代码行数:70,代码来源:systray.c

示例15: redraw_screen

/*
 * Calls draw_image on a new pixmap and swaps that with the current pixmap
 *
 */
void redraw_screen(void) {
    xcb_pixmap_t bg_pixmap = draw_image(last_resolution);
    xcb_change_window_attributes(conn, win, XCB_CW_BACK_PIXMAP, (uint32_t[1]){bg_pixmap});
    /* XXX: Possible optimization: Only update the area in the middle of the
     * screen instead of the whole screen. */
    xcb_clear_area(conn, 0, win, 0, 0, last_resolution[0], last_resolution[1]);
    xcb_free_pixmap(conn, bg_pixmap);
    xcb_flush(conn);
}
开发者ID:NathanHarrington,项目名称:i3lock-svg,代码行数:13,代码来源:unlock_indicator.c


注:本文中的xcb_change_window_attributes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。