本文整理汇总了C++中xcb_get_property_reply函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_get_property_reply函数的具体用法?C++ xcb_get_property_reply怎么用?C++ xcb_get_property_reply使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcb_get_property_reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xdndProxy
static xcb_window_t xdndProxy(QXcbConnection *c, xcb_window_t w)
{
xcb_window_t proxy = XCB_NONE;
xcb_get_property_cookie_t cookie = Q_XCB_CALL2(xcb_get_property(c->xcb_connection(), false, w, c->atom(QXcbAtom::XdndProxy),
XCB_ATOM_WINDOW, 0, 1), c);
xcb_get_property_reply_t *reply = xcb_get_property_reply(c->xcb_connection(), cookie, 0);
if (reply && reply->type == XCB_ATOM_WINDOW)
proxy = *((xcb_window_t *)xcb_get_property_value(reply));
free(reply);
if (proxy == XCB_NONE)
return proxy;
// exists and is real?
cookie = Q_XCB_CALL2(xcb_get_property(c->xcb_connection(), false, proxy, c->atom(QXcbAtom::XdndProxy),
XCB_ATOM_WINDOW, 0, 1), c);
reply = xcb_get_property_reply(c->xcb_connection(), cookie, 0);
if (reply && reply->type == XCB_ATOM_WINDOW) {
xcb_window_t p = *((xcb_window_t *)xcb_get_property_value(reply));
if (proxy != p)
proxy = 0;
} else {
proxy = 0;
}
free(reply);
return proxy;
}
示例2: 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");
}
示例3: xcb_icccm_get_wm_class
void
x_client_name::update_wm_class(void)
{
m_class_name.clear();
m_instance_name.clear();
xcb_generic_error_t * error;
xcb_get_property_cookie_t c =
xcb_icccm_get_wm_class(m_c(), m_x_client.window());
xcb_get_property_reply_t * r = xcb_get_property_reply(m_c(), c, &error);
if (error) {
delete error;
} else {
xcb_icccm_get_wm_class_reply_t wm_class;
if (xcb_icccm_get_wm_class_from_reply(&wm_class, r)) {
m_class_name = wm_class.class_name;
m_instance_name = wm_class.instance_name;
xcb_icccm_get_wm_class_reply_wipe(&wm_class);
r = NULL;
}
}
if (r) delete r;
}
示例4: gpr
//! Process _NET_WM_STRUT reply and update fields
void Client::process_ewmh_strut(xcb_get_property_cookie_t gpc)
{
autofree_ptr<xcb_get_property_reply_t> gpr(
xcb_get_property_reply(g_xcb.connection, gpc, NULL)
);
if (!gpr) {
WARN << "Could not retrieve _NET_WM_STRUT for window";
m_ewmh_strut.clear();
return;
}
TRACE << *gpr;
if (gpr->type != XCB_ATOM_CARDINAL ||
gpr->format != 32 || gpr->length != 4)
{
WARN << "Could not retrieve _NET_WM_STRUT for window";
m_ewmh_strut.clear();
return;
}
uint32_t* strut = (uint32_t*)xcb_get_property_value(gpr.get());
m_ewmh_strut.valid = true;
m_ewmh_strut.left = strut[0];
m_ewmh_strut.right = strut[1];
m_ewmh_strut.top = strut[2];
m_ewmh_strut.bottom = strut[3];
INFO << "EWMH _NET_WM_STRUT of window " << window() << " is "
<< m_ewmh_strut;
}
示例5: while
void QXcbScreen::readXResources()
{
int offset = 0;
QByteArray resources;
while(1) {
xcb_get_property_reply_t *reply =
xcb_get_property_reply(xcb_connection(),
xcb_get_property_unchecked(xcb_connection(), false, screen()->root,
XCB_ATOM_RESOURCE_MANAGER,
XCB_ATOM_STRING, offset/4, 8192), NULL);
bool more = false;
if (reply && reply->format == 8 && reply->type == XCB_ATOM_STRING) {
resources += QByteArray((const char *)xcb_get_property_value(reply), xcb_get_property_value_length(reply));
offset += xcb_get_property_value_length(reply);
more = reply->bytes_after != 0;
}
if (reply)
free(reply);
if (!more)
break;
}
QList<QByteArray> split = resources.split('\n');
for (int i = 0; i < split.size(); ++i) {
const QByteArray &r = split.at(i);
int value;
if (xResource(r, "Xft.dpi:\t", &value))
m_forcedDpi = value;
else if (xResource(r, "Xft.hintstyle:\t", &value))
m_hintStyle = QFontEngine::HintStyle(value);
}
}
示例6: xcb_get_property
char *xcb_util_get_property(xcb_connection_t *conn, xcb_window_t window, xcb_atom_t atom,
xcb_atom_t type, size_t size) {
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
xcb_generic_error_t *err;
int reply_length;
char *content;
cookie = xcb_get_property(conn, 0, window, atom, type, 0, size);
reply = xcb_get_property_reply(conn, cookie, &err);
if (err != NULL) {
FREE(err);
return NULL;
}
if (reply == NULL || (reply_length = xcb_get_property_value_length(reply)) == 0) {
FREE(reply);
return NULL;
}
if (reply->bytes_after > 0) {
size_t adjusted_size = size + ceil(reply->bytes_after / 4.0);
FREE(reply);
return xcb_util_get_property(conn, window, atom, type, adjusted_size);
}
if (asprintf(&content, "%.*s", reply_length, (char *)xcb_get_property_value(reply)) < 0) {
FREE(reply);
return NULL;
}
FREE(reply);
return content;
}
示例7: Find_Roots
/*
* Find virtual roots (_NET_VIRTUAL_ROOTS)
*/
static xcb_window_t *
Find_Roots(xcb_connection_t * dpy, xcb_window_t root, unsigned int *num)
{
xcb_atom_t atom_virtual_root;
xcb_get_property_cookie_t prop_cookie;
xcb_get_property_reply_t *prop_reply;
xcb_window_t *prop_ret = NULL;
*num = 0;
atom_virtual_root = Get_Atom (dpy, "_NET_VIRTUAL_ROOTS");
if (atom_virtual_root == XCB_ATOM_NONE)
return NULL;
prop_cookie = xcb_get_property (dpy, False, root, atom_virtual_root,
XCB_ATOM_WINDOW, 0, 0x7fffffff);
prop_reply = xcb_get_property_reply (dpy, prop_cookie, NULL);
if (!prop_reply)
return NULL;
if ((prop_reply->value_len > 0) && (prop_reply->type == XCB_ATOM_WINDOW)
&& (prop_reply->format == 32)) {
int length = xcb_get_property_value_length (prop_reply);
prop_ret = malloc(length);
if (prop_ret) {
memcpy (prop_ret, xcb_get_property_value(prop_reply), length);
*num = prop_reply->value_len;
}
}
free (prop_reply);
return prop_ret;
}
示例8: weston_wm_get_selection_data
static void
weston_wm_get_selection_data(struct weston_wm *wm)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie = xcb_get_property(wm->conn,
1, /* delete */
wm->selection_window,
wm->atom.wl_selection,
XCB_GET_PROPERTY_TYPE_ANY,
0, /* offset */
0x1fffffff /* length */);
reply = xcb_get_property_reply(wm->conn, cookie, NULL);
if (reply->type == wm->atom.incr) {
dump_property(wm, wm->atom.wl_selection, reply);
wm->incr = 1;
free(reply);
} else {
dump_property(wm, wm->atom.wl_selection, reply);
wm->incr = 0;
weston_wm_write_property(wm, reply);
}
}
示例9: weston_wm_get_selection_data
static void
weston_wm_get_selection_data(struct weston_wm *wm)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie = xcb_get_property(wm->conn,
1, /* delete */
wm->selection_window,
wm->atom.wl_selection,
XCB_GET_PROPERTY_TYPE_ANY,
0, /* offset */
0x1fffffff /* length */);
reply = xcb_get_property_reply(wm->conn, cookie, NULL);
dump_property(wm, wm->atom.wl_selection, reply);
if (reply == NULL) {
return;
} else if (reply->type == wm->atom.incr) {
wm->incr = 1;
free(reply);
} else {
wm->incr = 0;
/* reply's ownership is transferred to wm, which is responsible
* for freeing it */
weston_wm_write_property(wm, reply);
}
}
示例10: xcb_randr_get_crtc_info_reply
void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
{
if (connection()->hasXRandr()) {
xcb_randr_get_crtc_info_reply_t *crtc = xcb_randr_get_crtc_info_reply(xcb_connection(),
xcb_randr_get_crtc_info_unchecked(xcb_connection(), m_crtc, timestamp), NULL);
if (crtc) {
m_geometry = QRect(crtc->x, crtc->y, crtc->width, crtc->height);
m_availableGeometry = m_geometry;
free(crtc);
}
}
xcb_get_property_reply_t * workArea =
xcb_get_property_reply(xcb_connection(),
xcb_get_property_unchecked(xcb_connection(), false, screen()->root,
atom(QXcbAtom::_NET_WORKAREA),
XCB_ATOM_CARDINAL, 0, 1024), NULL);
if (workArea && workArea->type == XCB_ATOM_CARDINAL && workArea->format == 32 && workArea->value_len >= 4) {
// If workArea->value_len > 4, the remaining ones seem to be for virtual desktops.
// But QScreen doesn't know about that concept. In reality there could be a
// "docked" panel (with _NET_WM_STRUT_PARTIAL atom set) on just one desktop.
// But for now just assume the first 4 values give us the geometry of the
// "work area", AKA "available geometry"
uint32_t *geom = (uint32_t*)xcb_get_property_value(workArea);
QRect virtualAvailableGeometry(geom[0], geom[1], geom[2], geom[3]);
// Take the intersection of the desktop's available geometry with this screen's geometry
// to get the part of the available geometry which belongs to this screen.
m_availableGeometry = m_geometry & virtualAvailableGeometry;
}
free(workArea);
}
示例11: getSettings
QByteArray getSettings()
{
QXcbConnectionGrabber connectionGrabber(screen->connection());
int offset = 0;
QByteArray settings;
xcb_atom_t _xsettings_atom = screen->connection()->atom(QXcbAtom::_XSETTINGS_SETTINGS);
while (1) {
xcb_get_property_cookie_t get_prop_cookie =
xcb_get_property_unchecked(screen->xcb_connection(),
false,
x_settings_window,
_xsettings_atom,
_xsettings_atom,
offset/4,
8192);
xcb_get_property_reply_t *reply = xcb_get_property_reply(screen->xcb_connection(), get_prop_cookie, NULL);
bool more = false;
if (!reply)
return settings;
settings += QByteArray((const char *)xcb_get_property_value(reply), xcb_get_property_value_length(reply));
offset += xcb_get_property_value_length(reply);
more = reply->bytes_after != 0;
free(reply);
if (!more)
break;
}
return settings;
}
示例12: weston_wm_get_incr_chunk
static void
weston_wm_get_incr_chunk(struct weston_wm *wm)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie = xcb_get_property(wm->conn,
0, /* delete */
wm->selection_window,
wm->atom.wl_selection,
XCB_GET_PROPERTY_TYPE_ANY,
0, /* offset */
0x1fffffff /* length */);
reply = xcb_get_property_reply(wm->conn, cookie, NULL);
dump_property(wm, wm->atom.wl_selection, reply);
if (xcb_get_property_value_length(reply) > 0) {
weston_wm_write_property(wm, reply);
} else {
weston_log("transfer complete\n");
close(wm->data_source_fd);
free(reply);
}
}
示例13: property_update_net_wm_pid
void
property_update_net_wm_pid(client_t *c,
xcb_get_property_reply_t *reply)
{
bool no_reply = !reply;
if(no_reply)
{
xcb_get_property_cookie_t prop_c =
xcb_get_property_unchecked(globalconf.connection, false, c->window, _NET_WM_PID, XCB_ATOM_CARDINAL, 0L, 1L);
reply = xcb_get_property_reply(globalconf.connection, prop_c, NULL);
}
if(reply && reply->value_len)
{
uint32_t *rdata = xcb_get_property_value(reply);
if(rdata)
{
luaA_object_push(globalconf.L, c);
client_set_pid(globalconf.L, -1, *rdata);
lua_pop(globalconf.L, 1);
}
}
if(no_reply)
p_delete(&reply);
}
示例14: window_state_get_reply
/** Get a window state (WM_STATE).
* \param cookie The cookie.
* \return The current state of the window, or 0 on error.
*/
uint32_t
window_state_get_reply(xcb_get_property_cookie_t cookie, int* pStateFound)
{
/* This is a bug fixed in updated versions of awesome already */
/* setting the result to 0 maps to XCB_WM_STATE_WITHDRAWN which */
/* causes a problem in scan. The default value should be XCB_WM_STATE_NORMAL */
/* returning 0 inside pStateFound to indicate to the caller that */
/* it was not found */
uint32_t result = XCB_WM_STATE_NORMAL;
if (pStateFound){
*pStateFound = 0;
}
xcb_get_property_reply_t *prop_r;
if((prop_r = xcb_get_property_reply(globalconf.connection, cookie, NULL)))
{
if(xcb_get_property_value_length(prop_r)){
result = *(uint32_t *) xcb_get_property_value(prop_r);
if (pStateFound){
*pStateFound = 1;
}
}
p_delete(&prop_r);
}
return result;
}
示例15: find_window_by_property
void find_window_by_property(xcb_window_t window, xcb_atom_t property,
xcb_window_t *res) {
*res = XCB_WINDOW_NONE;
xcb_get_property_cookie_t get_property_cookie =
xcb_get_property(display, 0, window, property, XCB_ATOM_ANY, 0, 0);
xcb_get_property_reply_t *get_property_reply =
xcb_get_property_reply(display, get_property_cookie, NULL);
if (get_property_reply != NULL) {
if (get_property_reply->type != XCB_ATOM_NONE) {
*res = window;
free(get_property_reply);
return;
}
free(get_property_reply);
}
xcb_query_tree_cookie_t query_tree_cookie =
xcb_query_tree(display, window);
xcb_query_tree_reply_t *query_tree_reply =
xcb_query_tree_reply(display, query_tree_cookie, NULL);
if (query_tree_reply == NULL)
return;
int length = xcb_query_tree_children_length(query_tree_reply);
xcb_window_t *children = xcb_query_tree_children(query_tree_reply);
for (int i = 0; i < length; i++) {
find_window_by_property(children[i], property, res);
if (*res != XCB_WINDOW_NONE)
break;
}
free(query_tree_reply);
}