Exemplo n.º 1
0
AfterShowXWindow *
aftershow_create_x_window (AfterShowContext *ctx, AfterShowXWindow *parent, int width, int height)
{
	AfterShowXWindow *window = safecalloc( 1, sizeof(AfterShowXWindow));
	AfterShowXScreen *scr = parent->screen;
	unsigned long attr_mask = CWEventMask ;
	XSetWindowAttributes attr;

	window->magic = MAGIC_AFTERSHOW_X_WINDOW;
	window->screen = scr;
	
	attr.event_mask = ExposureMask;
	
	window->w = create_visual_window(scr->asv, parent->w, 0, 0, width, height, 0, 
									 InputOutput, attr_mask, &attr);

	add_hash_item (scr->windows, AS_HASHABLE(window->w), window);

	window->width = width;
	window->height = height;

	window->back = create_visual_pixmap(scr->asv, window->w, width, height, 0);
	window->gc = create_visual_gc(scr->asv, window->w, 0, NULL);	
	window->depth = scr->asv->true_depth;
	window->back_width = width;
	window->back_height = height;
	
	return window;
}
Exemplo n.º 2
0
void cover_desktop ()
{
	XSetWindowAttributes attributes;
	unsigned long valuemask;
	Window w;
	XGCValues gcvalue;

	if (get_flags (Scr.Feel.flags, DontCoverDesktop))
		return;

	++_as_desktop_cover_recursion;

	if (_as_desktop_cover != None)
		return;

	valuemask = (CWBackPixmap | CWBackingStore | CWOverrideRedirect);
	attributes.background_pixmap = None;
	attributes.backing_store = NotUseful;
	attributes.override_redirect = True;

	w = create_visual_window (Scr.asv, Scr.Root, 0, 0,
														Scr.MyDisplayWidth, Scr.MyDisplayHeight,
														0, InputOutput, valuemask, &attributes);

	XMapRaised (dpy, w);
	XSync (dpy, False);
	if (_as_desktop_cover_gc == NULL) {
		unsigned long mask =
				GCFunction | GCForeground | GCBackground | GCGraphicsExposures;
		CARD32 r16, g16, b16;

		if (_as_desktop_cover_xfs == NULL)
			_as_desktop_cover_xfs = XLoadQueryFont (dpy, "fixed");

		if (_as_desktop_cover_xfs) {
			gcvalue.font = _as_desktop_cover_xfs->fid;
			mask |= GCFont;
		}

		LOCAL_DEBUG_OUT ("desk_anime_tint = %lX",
										 Scr.Look.desktop_animation_tint);
		r16 = ARGB32_RED16 (Scr.Look.desktop_animation_tint);
		g16 = ARGB32_GREEN16 (Scr.Look.desktop_animation_tint);
		b16 = ARGB32_BLUE16 (Scr.Look.desktop_animation_tint);
		if (ASCS_BLACK_O_WHITE_CRITERIA16 (r16, g16, b16)) {
			gcvalue.foreground = Scr.asv->black_pixel;
			gcvalue.background = Scr.asv->white_pixel;
		} else {
			gcvalue.foreground = Scr.asv->white_pixel;
			gcvalue.background = Scr.asv->black_pixel;
		}
		gcvalue.function = GXcopy;
		gcvalue.graphics_exposures = 0;

		_as_desktop_cover_gc =
				create_visual_gc (Scr.asv, Scr.Root, mask, &gcvalue);
	}
	if (_as_desktop_cover_gc) {
		unsigned long pixel;
		ARGB2PIXEL (Scr.asv, Scr.Look.desktop_animation_tint, &pixel);
		gcvalue.foreground = pixel;
		gcvalue.function = GXand;
		XChangeGC (dpy, _as_desktop_cover_gc, GCFunction | GCForeground,
							 &gcvalue);
		XFillRectangle (dpy, w, _as_desktop_cover_gc, 0, 0, Scr.MyDisplayWidth,
										Scr.MyDisplayHeight);
		gcvalue.foreground = Scr.asv->white_pixel;
		gcvalue.function = GXcopy;
		XChangeGC (dpy, _as_desktop_cover_gc, GCFunction | GCForeground,
							 &gcvalue);
	}
	_as_desktop_cover = w;
}