[teklib-general] teklib: Added TVisual_ExposeHook

hg-notify at neoscientists.org hg-notify at neoscientists.org
Wed Jan 16 10:34:25 CET 2008


details:   http://hg.teklib.org/teklib/rev/e95c48c87d1f
changeset: 150:e95c48c87d1f
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Tue Jan 15 03:44:45 2008 +0100
description:
Added TVisual_ExposeHook

diffs (truncated from 122 to 100 lines):

diff -r c5f8dd05d5db -r e95c48c87d1f src/display_x11/display_x11_api.c
--- a/src/display_x11/display_x11_api.c	Tue Jan 15 02:20:07 2008 +0100
+++ b/src/display_x11/display_x11_api.c	Tue Jan 15 03:44:45 2008 +0100
@@ -495,7 +495,17 @@ x11_copyarea(TMOD_X11 *mod, struct TVReq
 	TINT h = req->tvr_Op.CopyArea.Rect[3];
 	TINT dx = req->tvr_Op.CopyArea.DestX;
 	TINT dy = req->tvr_Op.CopyArea.DestY;
-	XCopyArea(mod->x11_Display, v->window, v->window, v->gc, x, y, w, h, dx, dy);
+
+	XCopyArea(mod->x11_Display, v->window, v->window, v->gc,
+		x, y, w, h, dx, dy);
+
+	mod->x11_CopyExposeHook = (struct THook *)
+		TGetTag(req->tvr_Op.CopyArea.Tags, TVisual_ExposeHook, TNULL);
+	if (mod->x11_CopyExposeHook)
+	{
+		/* register request in progress: */
+		mod->x11_RequestInProgress = req;
+	}
 }
 
 /*****************************************************************************/
diff -r c5f8dd05d5db -r e95c48c87d1f src/display_x11/display_x11_inst.c
--- a/src/display_x11/display_x11_inst.c	Tue Jan 15 02:20:07 2008 +0100
+++ b/src/display_x11/display_x11_inst.c	Tue Jan 15 03:44:45 2008 +0100
@@ -408,9 +408,12 @@ x11_taskfunc(TAPTR task)
 	{
 		TBOOL do_interval = TFALSE;
 
-		while ((req = TExecGetMsg(inst->x11_ExecBase, inst->x11_CmdPort)))
+		while (inst->x11_RequestInProgress == TNULL &&
+			(req = TExecGetMsg(inst->x11_ExecBase, inst->x11_CmdPort)))
 		{
 			x11_docmd(inst, req);
+			if (inst->x11_RequestInProgress)
+				break;
 			TExecReplyMsg(inst->x11_ExecBase, req);
 		}
 
@@ -583,7 +586,6 @@ x11_processvisualevent(TMOD_X11 *mod, VI
 			break;
 
 		case MapNotify:
-			/* remap everything */
 			if ((v->eventmask & TITYPE_REFRESH) &&
 				((XExposeEvent *) ev)->count == 0)
 			{
@@ -598,7 +600,6 @@ x11_processvisualevent(TMOD_X11 *mod, VI
 			}
 			break;
 
-		case GraphicsExpose:
 		case Expose:
 			if ((v->eventmask & TITYPE_REFRESH) &&
 				getimsg(mod, v, &imsg, TITYPE_REFRESH))
@@ -609,16 +610,33 @@ x11_processvisualevent(TMOD_X11 *mod, VI
 				imsg->timsg_Height = ((XExposeEvent *) ev)->height;
 				TAddTail(&v->imsgqueue, &imsg->timsg_Node);
 			}
-			/* fallthru: */
+			break;
+
+		case GraphicsExpose:
+			if (mod->x11_CopyExposeHook)
+			{
+				TINT rect[4];
+				rect[0] = ((XGraphicsExposeEvent *) ev)->x;
+				rect[1] = ((XGraphicsExposeEvent *) ev)->y;
+				rect[2] = rect[0] + ((XGraphicsExposeEvent *) ev)->width - 1;
+				rect[3] = rect[1] + ((XGraphicsExposeEvent *) ev)->height - 1;
+				TCallHookPkt(mod->x11_CopyExposeHook,
+					mod->x11_RequestInProgress->tvr_Op.CopyArea.Instance,
+					(TTAG) rect);
+			}
+
+			if (((XGraphicsExposeEvent *) ev)->count > 0)
+				break;
+
+			/* no more graphics expose events, fallthru: */
 
 		case NoExpose:
-
-			if (ev->type == NoExpose || (ev->type == GraphicsExpose &&
-				((XGraphicsExposeEvent *) ev)->count == 0))
-			{
-				TDBPRINTF(10,("COPY COMPLETE\n"));
-			}
-
+			if (mod->x11_RequestInProgress)
+			{
+				TExecReplyMsg(mod->x11_ExecBase, mod->x11_RequestInProgress);
+				mod->x11_RequestInProgress = TNULL;
+				mod->x11_CopyExposeHook = TNULL;
+			}
 			break;
 
 		case FocusIn:
diff -r c5f8dd05d5db -r e95c48c87d1f src/display_x11/display_x11_mod.h
--- a/src/display_x11/display_x11_mod.h	Tue Jan 15 02:20:07 2008 +0100
+++ b/src/display_x11/display_x11_mod.h	Tue Jan 15 03:44:45 2008 +0100


More information about the teklib-general mailing list