本文整理汇总了C++中xcb_intern_atom_reply函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_intern_atom_reply函数的具体用法?C++ xcb_intern_atom_reply怎么用?C++ xcb_intern_atom_reply使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcb_intern_atom_reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool DesktopWindow::event(QEvent* event) {
switch(event->type()) {
case QEvent::WinIdChange: {
qDebug() << "winid change:" << effectiveWinId();
if(effectiveWinId() == 0) {
break;
}
// set freedesktop.org EWMH hints properly
if(QX11Info::isPlatformX11() && QX11Info::connection()) {
xcb_connection_t* con = QX11Info::connection();
const char* atom_name = "_NET_WM_WINDOW_TYPE_DESKTOP";
xcb_atom_t atom = xcb_intern_atom_reply(con, xcb_intern_atom(con, 0, strlen(atom_name), atom_name), nullptr)->atom;
const char* prop_atom_name = "_NET_WM_WINDOW_TYPE";
xcb_atom_t prop_atom = xcb_intern_atom_reply(con, xcb_intern_atom(con, 0, strlen(prop_atom_name), prop_atom_name), nullptr)->atom;
xcb_atom_t XA_ATOM = 4;
xcb_change_property(con, XCB_PROP_MODE_REPLACE, effectiveWinId(), prop_atom, XA_ATOM, 32, 1, &atom);
}
break;
}
#undef FontChange // FontChange is defined in the headers of XLib and clashes with Qt, let's undefine it.
case QEvent::StyleChange:
case QEvent::FontChange:
queueRelayout();
break;
default:
break;
}
return QWidget::event(event);
}
示例2: LoadAtoms
void LoadAtoms()
{
xcb_intern_atom_cookie_t wm_delete_window_cookie = xcb_intern_atom( WindowGlobal::connection, 0, 16, "WM_DELETE_WINDOW" );
xcb_intern_atom_cookie_t wm_protocols_cookie = xcb_intern_atom(WindowGlobal::connection, 0, strlen("WM_PROTOCOLS"), "WM_PROTOCOLS" );
xcb_flush( WindowGlobal::connection );
xcb_intern_atom_reply_t* wm_delete_window_cookie_reply = xcb_intern_atom_reply( WindowGlobal::connection, wm_delete_window_cookie, nullptr );
xcb_intern_atom_reply_t* wm_protocols_cookie_reply = xcb_intern_atom_reply( WindowGlobal::connection, wm_protocols_cookie, nullptr );
WindowGlobal::wm_protocols = wm_protocols_cookie_reply->atom;
WindowGlobal::wm_delete_window = wm_delete_window_cookie_reply->atom;
}
示例3: propsReply
bool KWinKScreenHelperEffect::checkValid()
{
#ifdef HAVE_XCB
if (QX11Info::isPlatformX11()) {
QScopedPointer<xcb_list_properties_reply_t, QScopedPointerPodDeleter> propsReply(xcb_list_properties_reply(QX11Info::connection(),
xcb_list_properties_unchecked(QX11Info::connection(), QX11Info::appRootWindow()),
NULL));
QScopedPointer<xcb_intern_atom_reply_t, QScopedPointerPodDeleter> atomReply(xcb_intern_atom_reply(QX11Info::connection(),
xcb_intern_atom_unchecked(QX11Info::connection(), false, 25, "_KDE_KWIN_KSCREEN_SUPPORT"),
NULL));
if (propsReply.isNull() || atomReply.isNull()) {
return false;
}
auto *atoms = xcb_list_properties_atoms(propsReply.data());
for (int i = 0; i < propsReply->atoms_len; ++i) {
if (atoms[i] == atomReply->atom) {
m_atom = atomReply->atom;
return true;
}
}
m_atom = 0;
return false;
}
#endif
return false;
}
示例4: ecore_x_atoms_get
EAPI void
ecore_x_atoms_get(const char **names,
int num,
Ecore_X_Atom *atoms)
{
xcb_intern_atom_cookie_t cookies[num];
int i = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
for (i = 0; i < num; i++)
{
cookies[i] =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(names[i]), names[i]);
}
for (i = 0; i < num; i++)
{
xcb_intern_atom_reply_t *reply = NULL;
if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0)))
continue;
atoms[i] = reply->atom;
free(reply);
}
}
示例5: while
void QXcbConnection::initializeAllAtoms() {
const char *names[QXcbAtom::NAtoms];
const char *ptr = xcb_atomnames;
int i = 0;
while (*ptr) {
names[i++] = ptr;
while (*ptr)
++ptr;
++ptr;
}
Q_ASSERT(i == QXcbAtom::NPredefinedAtoms);
QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_");
settings_atom_name += m_displayName;
names[i++] = settings_atom_name;
xcb_intern_atom_cookie_t cookies[QXcbAtom::NAtoms];
Q_ASSERT(i == QXcbAtom::NAtoms);
for (i = 0; i < QXcbAtom::NAtoms; ++i)
cookies[i] = xcb_intern_atom(xcb_connection(), false, strlen(names[i]), names[i]);
for (i = 0; i < QXcbAtom::NAtoms; ++i) {
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0);
m_allAtoms[i] = reply->atom;
free(reply);
}
}
示例6: composite_manager_running
/** Check whether a composite manager is running.
* \return True if such a manager is running.
*/
static bool
composite_manager_running(void)
{
xcb_intern_atom_reply_t *atom_r;
xcb_get_selection_owner_reply_t *selection_r;
char *atom_name;
bool result;
if(!(atom_name = xcb_atom_name_by_screen("_NET_WM_CM", globalconf.default_screen)))
{
warn("error getting composite manager atom");
return false;
}
atom_r = xcb_intern_atom_reply(globalconf.connection,
xcb_intern_atom_unchecked(globalconf.connection, false,
a_strlen(atom_name), atom_name),
NULL);
p_delete(&atom_name);
if(!atom_r)
return false;
selection_r = xcb_get_selection_owner_reply(globalconf.connection,
xcb_get_selection_owner_unchecked(globalconf.connection,
atom_r->atom),
NULL);
p_delete(&atom_r);
result = selection_r != NULL && selection_r->owner != XCB_NONE;
p_delete(&selection_r);
return result;
}
示例7: QObject
//_____________________________________________________________
WindowManager::WindowManager( QObject* parent ):
QObject( parent ),
_enabled( true ),
_useWMMoveResize( true ),
_dragMode( StyleConfigData::WD_FULL ),
_dragDistance( QApplication::startDragDistance() ),
_dragDelay( QApplication::startDragTime() ),
_dragAboutToStart( false ),
_dragInProgress( false ),
_locked( false ),
_cursorOverride( false ),
_isX11( false )
{
// install application wise event filter
_appEventFilter = new AppEventFilter( this );
qApp->installEventFilter( _appEventFilter );
#if HAVE_X11
_isX11 = QGuiApplication::platformName() == QStringLiteral("xcb");
_moveResizeAtom = 0;
if( _isX11 )
{
// create move-resize atom
xcb_connection_t* connection( QX11Info::connection() );
const QString atomName( QStringLiteral( "_NET_WM_MOVERESIZE" ) );
xcb_intern_atom_cookie_t cookie( xcb_intern_atom( connection, false, atomName.size(), qPrintable( atomName ) ) );
Helper::ScopedPointer<xcb_intern_atom_reply_t> reply( xcb_intern_atom_reply( connection, cookie, nullptr) );
_moveResizeAtom = reply ? reply->atom:0;
}
#endif
}
示例8: systray_cleanup
/** Remove systray information in X.
*/
void
systray_cleanup(void)
{
xcb_intern_atom_reply_t *atom_systray_r;
char *atom_name;
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", globalconf.default_screen))
|| !(atom_systray_r = xcb_intern_atom_reply(globalconf.connection,
xcb_intern_atom_unchecked(globalconf.connection,
false,
a_strlen(atom_name),
atom_name),
NULL)))
{
warn("error getting systray atom");
p_delete(&atom_name);
return;
}
p_delete(&atom_name);
xcb_set_selection_owner(globalconf.connection,
XCB_NONE,
atom_systray_r->atom,
XCB_CURRENT_TIME);
p_delete(&atom_systray_r);
xcb_unmap_window(globalconf.connection,
globalconf.systray.window);
}
示例9: systray_cleanup
/** Remove systray information in X.
* \param phys_screen Physical screen.
*/
void
systray_cleanup(int phys_screen)
{
xcb_intern_atom_reply_t *atom_systray_r;
char *atom_name;
if(!globalconf.screens.tab[phys_screen].systray.registered)
return;
globalconf.screens.tab[phys_screen].systray.registered = false;
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", phys_screen))
|| !(atom_systray_r = xcb_intern_atom_reply(globalconf.connection,
xcb_intern_atom_unchecked(globalconf.connection,
false,
a_strlen(atom_name),
atom_name),
NULL)))
{
warn("error getting systray atom");
p_delete(&atom_name);
return;
}
p_delete(&atom_name);
xcb_set_selection_owner(globalconf.connection,
XCB_NONE,
atom_systray_r->atom,
XCB_CURRENT_TIME);
p_delete(&atom_systray_r);
}
示例10: xcb_intern_atom_unchecked
xcb_window_t QXcbNativeInterface::locateSystemTray(xcb_connection_t *conn, const QXcbScreen *screen)
{
if (m_sysTraySelectionAtom == XCB_ATOM_NONE) {
const QByteArray net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen->screenNumber()).toLatin1();
xcb_intern_atom_cookie_t intern_c =
xcb_intern_atom_unchecked(conn, true, net_sys_tray.length(), net_sys_tray);
xcb_intern_atom_reply_t *intern_r = xcb_intern_atom_reply(conn, intern_c, 0);
if (!intern_r)
return XCB_WINDOW_NONE;
m_sysTraySelectionAtom = intern_r->atom;
free(intern_r);
}
xcb_get_selection_owner_cookie_t sel_owner_c = xcb_get_selection_owner_unchecked(conn, m_sysTraySelectionAtom);
xcb_get_selection_owner_reply_t *sel_owner_r = xcb_get_selection_owner_reply(conn, sel_owner_c, 0);
if (!sel_owner_r)
return XCB_WINDOW_NONE;
xcb_window_t selection_window = sel_owner_r->owner;
free(sel_owner_r);
return selection_window;
}
示例11: atoms_init
void
atoms_init(xcb_connection_t *conn)
{
unsigned int i;
xcb_intern_atom_cookie_t cs[countof(ATOM_LIST)];
xcb_intern_atom_reply_t *r;
/* Create the atom and get the reply in a XCB way (e.g. send all
* the requests at the same time and then get the replies) */
for(i = 0; i < countof(ATOM_LIST); i++)
cs[i] = xcb_intern_atom_unchecked(conn,
false,
a_strlen(ATOM_LIST[i].name),
ATOM_LIST[i].name);
for(i = 0; i < countof(ATOM_LIST); i++)
{
if(!(r = xcb_intern_atom_reply(conn, cs[i], NULL)))
/* An error occured, get reply for next atom */
continue;
*ATOM_LIST[i].atom = r->atom;
p_delete(&r);
}
}
示例12: atoms_init_finalise
/** Get replies to the previously sent InternAtom request. This
* function is not thread-safe but we don't care as it is only used
* during initialisation
*
* \return true on success, false otherwise
*/
bool
atoms_init_finalise(xcb_intern_atom_cookie_t *ewmh_cookies)
{
if(!xcb_ewmh_init_atoms_replies(&globalconf.ewmh, ewmh_cookies, NULL))
goto init_atoms_error;
xcb_intern_atom_reply_t *atom_reply;
for(int atom_n = 0; atom_n < atoms_list_len; atom_n++)
{
assert(atoms_list[atom_n].cookie.sequence);
atom_reply = xcb_intern_atom_reply(globalconf.connection,
atoms_list[atom_n].cookie,
NULL);
if(!atom_reply)
goto init_atoms_error;
*(atoms_list[atom_n].value) = atom_reply->atom;
free(atom_reply);
}
globalconf.atoms_supported.cookie =
xcb_ewmh_get_supported_unchecked(&globalconf.ewmh,
globalconf.screen_nbr);
return true;
init_atoms_error:
fatal("Cannot initialise atoms");
return false;
}
示例13: systray_init
/** Initialize systray information in X.
*/
void
systray_init(void)
{
xcb_intern_atom_cookie_t atom_systray_q;
xcb_intern_atom_reply_t *atom_systray_r;
char *atom_name;
xcb_screen_t *xscreen = globalconf.screen;
globalconf.systray.window = xcb_generate_id(globalconf.connection);
xcb_create_window(globalconf.connection, xscreen->root_depth,
globalconf.systray.window,
xscreen->root,
-1, -1, 1, 1, 0,
XCB_COPY_FROM_PARENT, xscreen->root_visual,
0, NULL);
atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", globalconf.default_screen);
if(!atom_name)
fatal("error getting systray atom name");
atom_systray_q = xcb_intern_atom_unchecked(globalconf.connection, false,
a_strlen(atom_name), atom_name);
p_delete(&atom_name);
atom_systray_r = xcb_intern_atom_reply(globalconf.connection, atom_systray_q, NULL);
if(!atom_systray_r)
fatal("error getting systray atom");
globalconf.systray.atom = atom_systray_r->atom;
p_delete(&atom_systray_r);
}
示例14: xcb_connect
void v_window::_initOSWindow() {
int screenNumber = 0;
_xcb_connection = xcb_connect(nullptr,&screenNumber);
const xcb_setup_t* setup = xcb_get_setup(_xcb_connection);
xcb_screen_iterator_t it = xcb_setup_roots_iterator(setup);
xcb_screen_t* screen = it.data;
_xcb_window = xcb_generate_id(_xcb_connection);
uint32_t value_mask, value_list[ 32 ];
int16_t x=0,y=0;
value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
value_list[0] = screen->black_pixel;
value_list[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_STRUCTURE_NOTIFY; //需要接收的事件
xcb_create_window(_xcb_connection,
XCB_COPY_FROM_PARENT,
_xcb_window,
screen->root,
x,y,
_width,_height,
1,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
screen->root_visual,
value_mask,
value_list);
/* Magic code that will send notification when window is destroyed */
xcb_intern_atom_cookie_t cookie = xcb_intern_atom( _xcb_connection, 1, 12, "WM_PROTOCOLS" );
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply( _xcb_connection, cookie, 0 );
xcb_intern_atom_cookie_t cookie2 = xcb_intern_atom( _xcb_connection, 0, 16, "WM_DELETE_WINDOW" );
_xcb_atom_window_reply = xcb_intern_atom_reply( _xcb_connection, cookie2, 0 );
xcb_change_property( _xcb_connection, XCB_PROP_MODE_REPLACE, _xcb_window,
( *reply ).atom, 4, 32, 1,
&( *_xcb_atom_window_reply ).atom );
free( reply );
xcb_map_window(_xcb_connection,_xcb_window);
// Force the x/y coordinates to 100,100 results are identical in consecutive
const uint32_t coords[] = { 100, 100 };
xcb_configure_window( _xcb_connection, _xcb_window, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, coords );
xcb_flush(_xcb_connection);
}
示例15: xcb_generate_id
// Set up a window using XCB and request event types
xcb_window_t VulkanExampleBase::setupWindow()
{
uint32_t value_mask, value_list[32];
window = xcb_generate_id(connection);
value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
value_list[0] = screen->black_pixel;
value_list[1] =
XCB_EVENT_MASK_KEY_RELEASE |
XCB_EVENT_MASK_EXPOSURE |
XCB_EVENT_MASK_STRUCTURE_NOTIFY |
XCB_EVENT_MASK_POINTER_MOTION |
XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE;
xcb_create_window(connection,
XCB_COPY_FROM_PARENT,
window, screen->root,
0, 0, width, height, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
screen->root_visual,
value_mask, value_list);
/* Magic code that will send notification when window is destroyed */
xcb_intern_atom_cookie_t cookie = xcb_intern_atom(connection, 1, 12, "WM_PROTOCOLS");
xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(connection, cookie, 0);
xcb_intern_atom_cookie_t cookie2 = xcb_intern_atom(connection, 0, 16, "WM_DELETE_WINDOW");
atom_wm_delete_window = xcb_intern_atom_reply(connection, cookie2, 0);
xcb_change_property(connection, XCB_PROP_MODE_REPLACE,
window, (*reply).atom, 4, 32, 1,
&(*atom_wm_delete_window).atom);
std::string windowTitle = getWindowTitle();
xcb_change_property(connection, XCB_PROP_MODE_REPLACE,
window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8,
title.size(), windowTitle.c_str());
free(reply);
xcb_map_window(connection, window);
return(window);
}