[teklib-general] teklib: Now uses a prepared 'huge' Region for unsetcliprect

hg-notify at neoscientists.org hg-notify at neoscientists.org
Fri Jan 25 22:14:48 CET 2008


details:   http://hg.teklib.org/teklib/rev/c6d06642c20a
changeset: 155:c6d06642c20a
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Fri Jan 25 02:31:20 2008 +0100
description:
Now uses a prepared 'huge' Region for unsetcliprect

diffs (79 lines):

diff -r 64acd43770f6 -r c6d06642c20a src/display_x11/display_x11_api.c
--- a/src/display_x11/display_x11_api.c	Tue Jan 15 18:46:22 2008 +0100
+++ b/src/display_x11/display_x11_api.c	Fri Jan 25 02:31:20 2008 +0100
@@ -568,23 +568,10 @@ x11_unsetcliprect(TMOD_X11 *mod, struct 
 x11_unsetcliprect(TMOD_X11 *mod, struct TVRequest *req)
 {
 	VISUAL *v = req->tvr_Op.ClipRect.Instance;
-	XSetClipMask(mod->x11_Display, v->gc, None);
-
-	if (mod->x11_use_xft == TTRUE)
-	{
-		Region region = XCreateRegion();
-		XRectangle rectangle;
-
-		rectangle.x = 0;
-		rectangle.y = 0;
-		rectangle.width = (unsigned short) v->winwidth;
-		rectangle.height = (unsigned short) v->winheight;
-
-		/* union rect into region */
-		XUnionRectWithRegion(&rectangle, region, region);
-		(*mod->x11_xftiface.XftDrawSetClip)(v->draw, region);
-		XDestroyRegion(region);
-	}
+	/*XSetClipMask(mod->x11_Display, v->gc, None);*/
+	XSetRegion(mod->x11_Display, v->gc, mod->x11_HugeRegion);
+	if (mod->x11_use_xft)
+		(*mod->x11_xftiface.XftDrawSetClip)(v->draw, mod->x11_HugeRegion);
 }
 
 /*****************************************************************************/
diff -r 64acd43770f6 -r c6d06642c20a src/display_x11/display_x11_inst.c
--- a/src/display_x11/display_x11_inst.c	Tue Jan 15 18:46:22 2008 +0100
+++ b/src/display_x11/display_x11_inst.c	Fri Jan 25 02:31:20 2008 +0100
@@ -191,6 +191,7 @@ x11_initinstance(TAPTR task)
 	{
 		TTAGITEM ftags[3];
 		int pipefd[2];
+		XRectangle rectangle;
 
 		/* list of free input messages: */
 		TInitList(&inst->x11_imsgpool);
@@ -223,6 +224,15 @@ x11_initinstance(TAPTR task)
 			TMAX(inst->x11_fd_sigpipe_read, inst->x11_fd_display) + 1;
 
 		initlibxft(inst);
+
+		/* needed for unsetcliprect: */
+		inst->x11_HugeRegion = XCreateRegion();
+		rectangle.x = 0;
+		rectangle.y = 0;
+		rectangle.width = (unsigned short) 0xffff;
+		rectangle.height = (unsigned short) 0xffff;
+		XUnionRectWithRegion(&rectangle, inst->x11_HugeRegion,
+			inst->x11_HugeRegion);
 
 		ftags[0].tti_Tag = TVisual_FontName;
 		ftags[0].tti_Value = (TTAG) FNT_DEFNAME;
@@ -271,6 +281,8 @@ x11_exitinstance(TMOD_X11 *inst)
 	node = inst->x11_fm.openfonts.tlh_Head;
 	for (; (next = node->tln_Succ); node = next)
 		x11_hostclosefont(inst, (TAPTR) node);
+
+	XDestroyRegion(inst->x11_HugeRegion);
 
 	if (inst->x11_fd_sigpipe_read != -1)
 	{
diff -r 64acd43770f6 -r c6d06642c20a src/display_x11/display_x11_mod.h
--- a/src/display_x11/display_x11_mod.h	Tue Jan 15 18:46:22 2008 +0100
+++ b/src/display_x11/display_x11_mod.h	Fri Jan 25 02:31:20 2008 +0100
@@ -110,6 +110,8 @@ typedef struct X11Display
 	struct TVRequest *x11_RequestInProgress;
 	struct THook *x11_CopyExposeHook;
 
+	Region x11_HugeRegion;
+
 } TMOD_X11;
 
 struct X11Pen


More information about the teklib-general mailing list