/** 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);
}
Example #2
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;
}
Example #3
0
xcb_get_property_cookie_t
property_get_wm_class(client_t *c)
{
    return xcb_icccm_get_wm_class_unchecked(globalconf.connection, c->window);
}
Example #4
0
File: wm2.c Project: ITikhonov/wm
	}
}


int managed(xcb_window_t w) {
	int i;
	for(i=0;i<wn;i++) {
		if(m[i]==w) { return i; }
	}
	return -1;
}

int is_classname(xcb_window_t w, char *class, char *name) {
	xcb_get_property_cookie_t cookie;
	xcb_icccm_get_wm_class_reply_t ch;
	cookie = xcb_icccm_get_wm_class_unchecked(c,w);
        if(xcb_icccm_get_wm_class_reply(c,cookie,&ch,NULL)) {
		if(  (class && strcmp(class,ch.class_name)!=0)
		  || (name && strcmp(name,ch.instance_name)!=0)) {
			xcb_icccm_get_wm_class_reply_wipe(&ch);
			return 0;
		}
		xcb_icccm_get_wm_class_reply_wipe(&ch);
		return 1;
	}
	return 0;
}

void classname(xcb_window_t w) {
	xcb_get_property_cookie_t cookie;
	xcb_icccm_get_wm_class_reply_t ch;