[teklib-general] changeset in /hg/teklib/current: Added WinLeft/WinTop

Timm S. Mueller tmueller at neoscientists.org
Mon Nov 26 16:23:28 CET 2007


changeset 1f4bfce8c3cb in /hg/teklib/current
details: http://teklib.org:8001/hg/teklib/current?cmd=changeset;node=1f4bfce8c3cb
description:
	Added WinLeft/WinTop

diffs (87 lines):

diff -r 78721a2f595e -r 1f4bfce8c3cb src/visual/posix/visual_host.c
--- a/src/visual/posix/visual_host.c	Sun Sep 16 15:08:29 2007 +0200
+++ b/src/visual/posix/visual_host.c	Mon Sep 17 18:51:22 2007 +0200
@@ -456,6 +456,12 @@ getattrfunc(struct THook *hook, TAPTR ob
 		case TVisual_PixHeight:
 			*((TINT *) item->tti_Value) = v->winheight;
 			break;
+		case TVisual_WinLeft:
+			*((TINT *) item->tti_Value) = v->winleft;
+			break;
+		case TVisual_WinTop:
+			*((TINT *) item->tti_Value) = v->wintop;
+			break;
 		case TVisual_TextWidth:
 			*((TINT *) item->tti_Value) = v->textwidth;
 			break;
@@ -616,6 +622,8 @@ getnextevent(TMOD_VIS *mod, TIMSG *newim
 				break;
 
 			case ConfigureNotify:
+				v->winleft = ((XConfigureEvent *) &ev)->x;
+				v->wintop = ((XConfigureEvent *) &ev)->y;
 				if ((v->winwidth != ((XConfigureEvent *) &ev)->width ||
 					v->winheight != ((XConfigureEvent *) &ev)->height))
 				{
@@ -893,7 +901,7 @@ getnextevent(TMOD_VIS *mod, TIMSG *newim
 				break;
 
 			default:
-				TDBPRINTF(5,("event not handled\n"));
+				TDBPRINTF(10, ("event not handled: %d\n", ev.type));
 				return TFALSE;
 		}
 	}
@@ -1087,6 +1095,7 @@ vis_open(TMOD_VIS *mod)
 
 	for (;;)
 	{
+		TBOOL popup = TFALSE;
 		XSetWindowAttributes swa;
 		TUINT swa_mask;
 		XGCValues gcv;
@@ -1146,8 +1155,20 @@ vis_open(TMOD_VIS *mod)
 		swa.colormap = v->colormap;
 		swa.event_mask = StructureNotifyMask;
 
+		v->winleft = (TINT) TGetTag(mod->vis_InitTags, TVisual_WinLeft, -1);
+		v->wintop = (TINT) TGetTag(mod->vis_InitTags, TVisual_WinTop, -1);
+		if (v->winleft > -1 || v->wintop > -1)
+		{
+			v->winleft = TMAX(v->winleft, 0);
+			v->wintop = TMAX(v->wintop, 0);
+			swa_mask |= CWOverrideRedirect;
+			swa.override_redirect = True;
+			popup = TTRUE;
+		}
+
 		v->window = XCreateWindow(v->display,
-			RootWindow(v->display, v->screen), 0, 0, v->winwidth, v->winheight,
+			RootWindow(v->display, v->screen),
+			v->winleft, v->wintop, v->winwidth, v->winheight,
 			0, CopyFromParent, CopyFromParent, CopyFromParent,
 			swa_mask, &swa);
 		if (v->window == TNULL) break;
diff -r 78721a2f595e -r 1f4bfce8c3cb src/visual/posix/visual_host.h
--- a/src/visual/posix/visual_host.h	Sun Sep 16 15:08:29 2007 +0200
+++ b/src/visual/posix/visual_host.h	Mon Sep 17 18:51:22 2007 +0200
@@ -24,6 +24,7 @@ typedef struct
 	TMOD_VIS *mod;				/* backpointer to module instance */
 
 	TINT winwidth, winheight;
+	TINT winleft, wintop;
 	TINT fontwidth, fontheight;
 	TINT textwidth, textheight;
 	TSTRPTR title;
diff -r 78721a2f595e -r 1f4bfce8c3cb tek/mod/visual.h
--- a/tek/mod/visual.h	Sun Sep 16 15:08:29 2007 +0200
+++ b/tek/mod/visual.h	Mon Sep 17 18:51:22 2007 +0200
@@ -37,6 +37,8 @@ typedef TTAG TVPEN;
 #define TVisual_MaxWidth			(TVISTAGS_ + 10)
 #define TVisual_MaxHeight			(TVISTAGS_ + 11)
 #define TVisual_Open				(TVISTAGS_ + 12)
+#define TVisual_WinLeft				(TVISTAGS_ + 24)
+#define TVisual_WinTop				(TVISTAGS_ + 25)
 
 /*
 **	Tags for font handling


More information about the teklib-general mailing list