Esempio n. 1
0
File: window.c Progetto: dosbre/xray
struct window *add_win(struct window **list, xcb_window_t wid)
{
	struct window *w = NULL;
	uint32_t mask = XCB_CW_EVENT_MASK;
	const uint32_t vals[1] = { XCB_EVENT_MASK_PROPERTY_CHANGE };
	uint8_t flag;

	if ((w = malloc(sizeof(struct window)))) {
		w->id = wid;
		w->damage = xcb_generate_id(X);
		flag = XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY;
		xcb_damage_create(X, w->damage, w->id, flag);
		w->region = xcb_generate_id(X);
		flag = XCB_SHAPE_SK_BOUNDING;
		xcb_xfixes_create_region_from_window(X, w->region, w->id, flag);
		w->pixmap = XCB_NONE;
		w->picture = XCB_NONE;
		w->opacity = get_window_opacity(w->id);
		w->alpha = XCB_NONE;
		w->prev = NULL;
		w->next = *list;
		*list = w;
		xcb_change_window_attributes(X, w->id, mask, vals);
	} else {
		fprintf(stderr, "add_window: can't alloc memory\n");
	}
	return w;
}
Esempio n. 2
0
/**
 * Create a region from a window.
 * @param win The window used to initialize the region.
 * @param type   The type of the region.
 * @return       The newly created region.
 *
 * Creates a region initialized to the specified @p window region. See
 * the Shape extension for the definition of Bounding and Clip
 * regions.
 * @ingroup Ecore_X_Fixes_Group
 */
EAPI Ecore_X_Region
ecore_x_region_new_from_window(Ecore_X_Window      win,
                               Ecore_X_Region_Type type)
{
   Ecore_X_Region region = 0;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   CHECK_XCB_CONN;

   if (!_xfixes_avail) return 0;

#ifdef ECORE_XCB_XFIXES
   region = xcb_generate_id(_ecore_xcb_conn);
   xcb_xfixes_create_region_from_window(_ecore_xcb_conn, region, win, type);
//   ecore_x_flush();
#endif

   return region;
}