open-src/lib/libX11/sun-src/src/XInteractive.c
changeset 1047 cebfb122be5a
parent 1029 2433d5075f1f
child 1236 3592c0ee5e0b
equal deleted inserted replaced
1046:ecba5d6aaf2e 1047:cebfb122be5a
   304     }
   304     }
   305     UnlockDisplay(dpy);
   305     UnlockDisplay(dpy);
   306     SyncHandle();
   306     SyncHandle();
   307     return True;
   307     return True;
   308 }
   308 }
   309 
       
   310 #if USE_XCB
       
   311 
       
   312 Bool
       
   313 XCBSolarisIAQueryExtension(xcb_connection_t* conn)
       
   314 {
       
   315     xcb_xia_query_extension_reply_t* re;
       
   316     xcb_xia_query_extension_cookie_t ce;
       
   317     xcb_generic_error_t* error;
       
   318 
       
   319     (void) memset(&ce, '\0', sizeof(ce));
       
   320 
       
   321     ce = xcb_xia_query_extension(conn);
       
   322     re = xcb_xia_query_extension_reply(conn, ce, &error);
       
   323 
       
   324     if (re && !error)
       
   325         return True;
       
   326 
       
   327     return False;
       
   328 }
       
   329 
       
   330 
       
   331 Bool
       
   332 XCBSolarisIAQueryVersion(xcb_connection_t* conn,
       
   333         int* majorVersion,
       
   334         int* minorVersion)
       
   335 {
       
   336     xcb_xia_query_version_reply_t* rv;
       
   337     xcb_xia_query_version_cookie_t cv;
       
   338     xcb_generic_error_t* error;
       
   339 
       
   340     (void) memset(&cv, '\0', sizeof(cv));
       
   341 
       
   342     cv = xcb_xia_query_version(conn);
       
   343     rv = xcb_xia_query_version_reply(conn, cv, &error);
       
   344 
       
   345     if (rv && !error) {
       
   346         *majorVersion = rv->major;
       
   347         *minorVersion = rv->minor;
       
   348         return True;
       
   349     }
       
   350 
       
   351     *majorVersion = 0;
       
   352     *minorVersion = 0;
       
   353     return False;
       
   354 }
       
   355 
       
   356 
       
   357 Bool
       
   358 XCBSolarisIAGetProcessInfo(xcb_connection_t* conn,
       
   359         unsigned char** Pinfo,
       
   360         CARD32 flags,
       
   361         int* count)
       
   362 {
       
   363     xcb_xia_get_process_info_cookie_t pc;
       
   364     xcb_generic_iterator_t itr;
       
   365     xcb_xia_get_process_info_reply_t* pr;
       
   366     xcb_generic_error_t* error;
       
   367     uint32_t* pinfo;
       
   368 
       
   369     if ((conn == NULL) || (count == NULL) || (Pinfo == NULL))
       
   370         return False;
       
   371 
       
   372     *Pinfo = NULL;
       
   373     *count = 0;
       
   374     (void) memset(&pc, '\0', sizeof(pc));
       
   375 
       
   376     pc = xcb_xia_get_process_info(conn, flags);
       
   377     pr = xcb_xia_get_process_info_reply(conn, pc, &error);
       
   378 
       
   379     if (pr && !error && (pr->count > 0)) {
       
   380 	uint32_t* pid = xcb_xia_get_process_info_pinfo(pr);
       
   381 	if (pid == NULL)
       
   382 	    return False;
       
   383 
       
   384         pinfo = (uint32_t*) Xmalloc((size_t) (pr->count * sizeof(uint32_t)));
       
   385         if (pinfo == NULL)
       
   386             return False;
       
   387 
       
   388 	*count = pr->count;
       
   389         (void) memcpy(pinfo, pid, (size_t) (*count * sizeof(uint32_t)));
       
   390         *Pinfo = (unsigned char *) pinfo;
       
   391         return True;
       
   392     }
       
   393 
       
   394     return False;
       
   395 }
       
   396 
       
   397 
       
   398 Bool
       
   399 XCBSolarisIASetProcessInfo(xcb_connection_t* conn,
       
   400         unsigned char* Pinfo,
       
   401         CARD32 flags,
       
   402         CARD32 count)
       
   403 {
       
   404     xcb_void_cookie_t pc;
       
   405 
       
   406     if (count == 0)
       
   407         return True;
       
   408 
       
   409     if ((conn == NULL) || (Pinfo == NULL))
       
   410         return False;
       
   411 
       
   412     pc = xcb_xia_set_process_info(conn, flags,
       
   413             (uint32_t) getuid(), count, (uint32_t *) Pinfo);
       
   414 
       
   415     return True;
       
   416 }
       
   417 
       
   418 #endif /* USE_XCB */
       
   419