本文整理汇总了C++中xcb_configure_window函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_configure_window函数的具体用法?C++ xcb_configure_window怎么用?C++ xcb_configure_window使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcb_configure_window函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q_XCB_CALL
void QXcbWindow::setGeometry(const QRect &rect)
{
QPlatformWindow::setGeometry(rect);
const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
const quint32 values[] = { rect.x(), rect.y(), rect.width(), rect.height() };
Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, values));
}
示例2: qCDebug
void XWaylandManager::handleConfigureRequest(xcb_configure_request_event_t *event)
{
qCDebug(XWAYLAND_TRACE, "XCB_CONFIGURE_REQUEST (window %d) %d,%d @ %dx%d",
event->window, event->x, event->y, event->width, event->height);
if (!m_windowsMap.contains(event->window))
return;
XWaylandShellSurface *shellSurface = m_windowsMap[event->window];
if (!shellSurface->surface())
return;
if (shellSurface->fullscreen()) {
xcb_configure_notify_event_t notify;
notify.response_type = XCB_CONFIGURE_NOTIFY;
notify.pad0 = 0;
notify.event = event->window;
notify.window = event->window;
notify.above_sibling = XCB_WINDOW_NONE;
notify.x = event->x;
notify.y = event->y;
notify.width = event->width;
notify.height = event->height;
notify.border_width = 0;
notify.override_redirect = 0;
notify.pad1 = 0;
xcb_send_event(Xcb::connection(), 0, event->window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char *) ¬ify);
return;
}
int x = 0, y = 0;
QSize size = shellSurface->surface()->size();
if (event->value_mask & XCB_CONFIG_WINDOW_WIDTH)
size.setWidth(event->width);
if (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
size.setHeight(event->height);
quint32 i = 0, values[16];
values[i++] = x;
values[i++] = y;
values[i++] = size.width();
values[i++] = size.height();
values[i++] = 0;
quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
XCB_CONFIG_WINDOW_BORDER_WIDTH;
if (event->value_mask & XCB_CONFIG_WINDOW_SIBLING) {
values[i++] = event->sibling;
mask |= XCB_CONFIG_WINDOW_SIBLING;
}
if (event->value_mask & XCB_CONFIG_WINDOW_STACK_MODE) {
values[i++] = event->stack_mode;
mask |= XCB_CONFIG_WINDOW_STACK_MODE;
}
xcb_configure_window(Xcb::connection(), event->window, mask, values);
}
示例3: window_stack
void window_stack(xcb_window_t w1, xcb_window_t w2, uint32_t mode)
{
if (w2 == XCB_NONE) {
return;
}
uint16_t mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
uint32_t values[] = {w2, mode};
xcb_configure_window(dpy, w1, mask, values);
}
示例4: 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;
}
示例5: systray_update
static void
systray_update(int base_size, bool horizontal, bool reverse, int spacing)
{
if(base_size <= 0)
return;
int embedded_len = globalconf.embedded.len + 1;
/* Give the systray window the correct size */
uint32_t config_vals[4] = { base_size, base_size, 0, 0 };
if(horizontal)
config_vals[0] = base_size * embedded_len + spacing * (embedded_len - 1);
else
config_vals[1] = base_size * embedded_len + spacing * (embedded_len - 1);
xcb_configure_window(globalconf.connection,
globalconf.systray.window,
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
config_vals);
/* Now resize each embedded window */
config_vals[0] = config_vals[1] = 0;
config_vals[2] = config_vals[3] = base_size;
fprintf(stderr, "embedded len: %d \n", sizeof(globalconf.embedded.tab) / sizeof(globalconf.embedded.tab[0]));
for(int i = 0; i < embedded_len + 1; i++)
{
xembed_window_t *em;
if(reverse)
em = &globalconf.embedded.tab[(embedded_len - i - 1)];
else
em = &globalconf.embedded.tab[i];
xcb_configure_window(globalconf.connection, em->win,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
config_vals);
xcb_map_window(globalconf.connection, em->win);
if(horizontal)
config_vals[0] += base_size + spacing;
else
config_vals[1] += base_size + spacing;
}
}
示例6: vout_display_PlacePicture
/**
* Return a direct buffer
*/
static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
{
vout_display_sys_t *p_sys = vd->sys;
(void)requested_count;
if (!p_sys->pool)
{
vout_display_place_t place;
vout_display_PlacePicture (&place, &vd->source, vd->cfg, false);
/* */
const uint32_t values[] = { place.x, place.y, place.width, place.height };
xcb_configure_window (p_sys->conn, p_sys->window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
values);
picture_t *pic = picture_NewFromFormat (&vd->fmt);
if (!pic)
return NULL;
assert (pic->i_planes == 1);
memset (p_sys->resource, 0, sizeof(p_sys->resource));
unsigned count;
picture_t *pic_array[MAX_PICTURES];
for (count = 0; count < MAX_PICTURES; count++)
{
picture_resource_t *res = &p_sys->resource[count];
res->p->i_lines = pic->p->i_lines;
res->p->i_pitch = pic->p->i_pitch;
if (PictureResourceAlloc (vd, res, res->p->i_pitch * res->p->i_lines,
p_sys->conn, p_sys->shm))
break;
pic_array[count] = picture_NewFromResource (&vd->fmt, res);
if (!pic_array[count])
{
PictureResourceFree (res, p_sys->conn);
memset (res, 0, sizeof(*res));
break;
}
}
picture_Release (pic);
if (count == 0)
return NULL;
p_sys->pool = picture_pool_New (count, pic_array);
/* TODO release picture resources if NULL */
xcb_flush (p_sys->conn);
}
return p_sys->pool;
}
示例7: assert
void
Window::resize_to(uint32_t width, uint32_t height)
{
assert(width != 0);
assert(height != 0);
uint16_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
uint32_t values[] = {width, height};
xcb_configure_window(conn->xcb(), window, mask, values);
}
示例8: raise_window
static void
raise_window(xcb_connection_t *xcb_conn, xcb_window_t window)
{
const uint32_t values[] = {
XCB_STACK_MODE_ABOVE
};
xcb_configure_window(xcb_conn, window,
XCB_CONFIG_WINDOW_STACK_MODE, values);
}
示例9: open_fullscreen_window
xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, char *color, xcb_pixmap_t pixmap) {
uint32_t mask = 0;
uint32_t values[3];
xcb_window_t win = xcb_generate_id(conn);
if (pixmap == XCB_NONE) {
mask |= XCB_CW_BACK_PIXEL;
values[0] = get_colorpixel(color);
} else {
mask |= XCB_CW_BACK_PIXMAP;
values[0] = pixmap;
}
mask |= XCB_CW_OVERRIDE_REDIRECT;
values[1] = 1;
mask |= XCB_CW_EVENT_MASK;
values[2] = XCB_EVENT_MASK_EXPOSURE |
XCB_EVENT_MASK_KEY_PRESS |
XCB_EVENT_MASK_KEY_RELEASE |
XCB_EVENT_MASK_VISIBILITY_CHANGE |
XCB_EVENT_MASK_STRUCTURE_NOTIFY;
xcb_create_window(conn,
XCB_COPY_FROM_PARENT,
win, /* the window id */
scr->root, /* parent == root */
0, 0,
scr->width_in_pixels,
scr->height_in_pixels, /* dimensions */
0, /* border = 0, we draw our own */
XCB_WINDOW_CLASS_INPUT_OUTPUT,
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
mask,
values);
char *name = "i3lock";
xcb_change_property(conn,
XCB_PROP_MODE_REPLACE,
win,
XCB_ATOM_WM_NAME,
XCB_ATOM_STRING,
8,
strlen(name),
name);
/* Map the window (= make it visible) */
xcb_map_window(conn, win);
/* Raise window (put it on top) */
values[0] = XCB_STACK_MODE_ABOVE;
xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
return win;
}
示例10: xcb_configure_window
void Client::setRect(const Rect &rect)
{
mRect = rect;
xcb_connection_t* conn = WindowManager::instance()->connection();
const uint16_t mask = (XCB_CONFIG_WINDOW_X|XCB_CONFIG_WINDOW_Y
|XCB_CONFIG_WINDOW_WIDTH|XCB_CONFIG_WINDOW_HEIGHT);
const uint32_t values[4] = { static_cast<uint32_t>(rect.x), static_cast<uint32_t>(rect.y),
static_cast<uint32_t>(rect.width), static_cast<uint32_t>(rect.height) };
xcb_configure_window(conn, mFrame, mask, values);
}
示例11: overlay_show
void overlay_show(struct overlay * overlay, int x, int y, int w, int h, int border) {
xcb_connection_t * connection = overlay->connection;
const uint32_t XYWH = XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y
| XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT;
xcb_map_window(overlay->connection, overlay->top);
xcb_map_window(overlay->connection, overlay->left);
xcb_map_window(overlay->connection, overlay->right);
xcb_map_window(overlay->connection, overlay->bottom);
uint32_t xywh[4];
xywh[0] = x; xywh[1] = y; xywh[2] = w; xywh[3] = border;
xcb_configure_window(connection, overlay->top, XYWH, xywh);
xywh[0] = x; xywh[1] = y; xywh[2] = border; xywh[3] = h;
xcb_configure_window(connection, overlay->left, XYWH, xywh);
xywh[0] = x+w-border; xywh[1] = y; xywh[2] = border; xywh[3] = h;
xcb_configure_window(connection, overlay->right, XYWH, xywh);
xywh[0] = x; xywh[1] = y+h-border; xywh[2] = w; xywh[3] = border;
xcb_configure_window(connection, overlay->bottom, XYWH, xywh);
xcb_flush(overlay->connection);
}
示例12: client_resize_client
void client_resize_client(Client *c, int x, int y, int w, int h) {
uint32_t values[] = { x, y, w, h, c->bw };
xcb_configure_window(conn, c->win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_BORDER_WIDTH,
values);
c->oldx = c->x; c->x = x;
c->oldy = c->y; c->y = y;
c->oldw = c->w; c->w = w;
c->oldh = c->h; c->h = h;
client_configure(c);
xcb_flush(conn);
}
示例13: center_pointer
static void
center_pointer (xcb_window_t win) {
uint32_t values[1];
xcb_get_geometry_reply_t *geom;
geom = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL);
xcb_warp_pointer(conn, XCB_NONE, win, 0, 0, 0, 0,
(geom->width + (BORDERWIDTH * 2)) / 2,
(geom->height + (BORDERWIDTH * 2)) / 2);
values[0] = XCB_STACK_MODE_ABOVE;
xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
}
示例14: warning
void Client::move(const Point& point)
{
warning() << "move" << point << this;
mRect.x = point.x;
mRect.y = point.y;
if (!mFrame)
return;
xcb_connection_t* conn = WindowManager::instance()->connection();
const uint16_t mask = XCB_CONFIG_WINDOW_X|XCB_CONFIG_WINDOW_Y;
const uint32_t values[2] = { static_cast<uint32_t>(point.x), static_cast<uint32_t>(point.y) };
xcb_configure_window(conn, mFrame, mask, values);
}
示例15: systray_update
static void
systray_update(int base_size, bool horizontal, bool reverse)
{
if(base_size <= 0)
return;
/* Give the systray window the correct size */
uint32_t config_vals[4] = { base_size, base_size, 0, 0 };
if(horizontal)
config_vals[0] = base_size * globalconf.embedded.len;
else
config_vals[1] = base_size * globalconf.embedded.len;
xcb_configure_window(globalconf.connection,
globalconf.systray.window,
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
config_vals);
/* Now resize each embedded window */
config_vals[0] = config_vals[1] = 0;
config_vals[2] = config_vals[3] = base_size;
for(int i = 0; i < globalconf.embedded.len; i++)
{
xembed_window_t *em;
if(reverse)
em = &globalconf.embedded.tab[(globalconf.embedded.len - i - 1)];
else
em = &globalconf.embedded.tab[i];
xcb_configure_window(globalconf.connection, em->win,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
config_vals);
xcb_map_window(globalconf.connection, em->win);
if(horizontal)
config_vals[0] += base_size;
else
config_vals[1] += base_size;
}
}