/** Update WM_CLASS of a client.
 * \param c The client.
 * \param reply The reply to get property request, or NULL if none.
 */
void
property_update_wm_class(client_t *c, xcb_get_property_reply_t *reply)
{
    xcb_icccm_get_wm_class_reply_t hint;

    if(reply)
    {
        if(!xcb_icccm_get_wm_class_from_reply(&hint, reply))
            return;
    }
    else
    {
        if(!xcb_icccm_get_wm_class_reply(globalconf.connection,
                                         xcb_icccm_get_wm_class_unchecked(globalconf.connection, c->window),
                                         &hint, NULL))
            return;
    }

    luaA_object_push(globalconf.L, c);
    client_set_class_instance(globalconf.L, -1, hint.class_name, hint.instance_name);
    lua_pop(globalconf.L, 1);

    /* only delete reply if we get it ourselves */
    if(!reply)
        xcb_icccm_get_wm_class_reply_wipe(&hint);
}
Beispiel #2
0
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;
}
Beispiel #3
0
bool is_match(rule_t *r, xcb_window_t win)
{
    xcb_icccm_get_wm_class_reply_t reply; 
    if (xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL) == 1
            && (strcmp(reply.class_name, r->cause.name) == 0
                || strcmp(reply.instance_name, r->cause.name) == 0)) {
        xcb_icccm_get_wm_class_reply_wipe(&reply);
        return true;
    }
    return false;
}
Beispiel #4
0
bool is_presel_window(xcb_window_t win)
{
	xcb_icccm_get_wm_class_reply_t reply;
	bool ret = false;
	if (xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL) == 1) {
		if (streq(BSPWM_CLASS_NAME, reply.class_name) && streq(PRESEL_FEEDBACK_I, reply.instance_name)) {
			ret = true;
		}
		xcb_icccm_get_wm_class_reply_wipe(&reply);
	}
	return ret;
}
Beispiel #5
0
void Client::updateClass(xcb_connection_t* conn, xcb_get_property_cookie_t cookie)
{
    xcb_icccm_get_wm_class_reply_t prop;
    if (xcb_icccm_get_wm_class_reply(conn, cookie, &prop, 0)) {
        mClass.instanceName = prop.instance_name;
        mClass.className = prop.class_name;
        xcb_icccm_get_wm_class_reply_wipe(&prop);
    } else {
        mClass.instanceName.clear();
        mClass.className.clear();
    }
}
Beispiel #6
0
// === WindowClass() ===
QString LXCB::WindowClass(WId win){
  if(DEBUG){ qDebug() << "XCB: WindowClass()" << win; }
  QString out;
  if(win==0){ return ""; }
  xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_class_unchecked(QX11Info::connection(), win);
  if(cookie.sequence == 0){ return out; } 
  xcb_icccm_get_wm_class_reply_t value;
  if( 1== xcb_icccm_get_wm_class_reply( QX11Info::connection(), cookie, &value, NULL) ){
    out = QString::fromUtf8(value.class_name);
    xcb_icccm_get_wm_class_reply_wipe(&value);
  }
  return out;
}
/** Update WM_CLASS of a client.
 * \param c The client.
 * \param cookie Cookie returned by property_get_wm_class.
 */
void
property_update_wm_class(client_t *c, xcb_get_property_cookie_t cookie)
{
    xcb_icccm_get_wm_class_reply_t hint;

    if(!xcb_icccm_get_wm_class_reply(globalconf.connection,
				     cookie,
				     &hint, NULL))
        return;

    luaA_object_push(globalconf.L, c);
    client_set_class_instance(globalconf.L, -1, hint.class_name, hint.instance_name);
    lua_pop(globalconf.L, 1);

    xcb_icccm_get_wm_class_reply_wipe(&hint);
}
Beispiel #8
0
//! Process WM_CLASS reply and update fields
void Client::process_wm_class(xcb_get_property_cookie_t gpc)
{
    xcb_icccm_get_wm_class_reply_t igwcr;

    if (xcb_icccm_get_wm_class_reply(g_xcb.connection, gpc, &igwcr, NULL))
    {
        TRACE << "ICCCM: " << igwcr;

        INFO << "WM_CLASS = " << igwcr.class_name
             << " - INSTANCE = " << igwcr.instance_name;

        m_wm_class = igwcr.class_name;
        m_wm_class_instance = igwcr.instance_name;

        xcb_icccm_get_wm_class_reply_wipe(&igwcr);
    }
    else
    {
        WARN << "ICCCM WM_CLASS could not be retrieved.";

        m_wm_class = "<no WM_CLASS name>";
        m_wm_class_instance = "<no WM_CLASS instance>";
    }
}