[teklib-general] teklib: Formatting fixed in README; display_x11: size hints calc...

Timm S. Mueller tmueller at neoscientists.org
Tue Apr 15 21:58:40 CEST 2008


details:   http://hg.teklib.org/teklib/rev/9a2f1726822a
changeset: 180:9a2f1726822a
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Tue Apr 15 09:56:26 2008 +0200
description:
Formatting fixed in README; display_x11: size hints calculation was still
broken, fixed

diffs (82 lines):

diff -r 63ae4159c90e -r 9a2f1726822a README
--- a/README	Sat Apr 12 15:06:02 2008 +0200
+++ b/README	Tue Apr 15 09:56:26 2008 +0200
@@ -12,7 +12,7 @@ software license. By picking from its fa
 	have to be ported to many individual hosts
 
 	* Component architecture and hosting environment to allow plug-ins
-  and their hosts to be written in a platform-independent manner
+	and their hosts to be written in a platform-independent manner
 
 Its freestanding nature, small resource footprint and absence of
 global data recommend it as a layer for portability and code reuse in
diff -r 63ae4159c90e -r 9a2f1726822a src/display_x11/display_x11_api.c
--- a/src/display_x11/display_x11_api.c	Sat Apr 12 15:06:02 2008 +0200
+++ b/src/display_x11/display_x11_api.c	Tue Apr 15 09:56:26 2008 +0200
@@ -106,10 +106,7 @@ x11_openvisual(TMOD_X11 *mod, struct TVR
 			v->sizehints->max_height =
 				v->sizehints->max_height <= 0 ? 1000000 : v->sizehints->max_height;
 
-			/*if (v->sizehints->min_width >= 0 && v->sizehints->min_height >= 0)*/
-				v->sizehints->flags |= PMinSize;
-			/*if (v->sizehints->max_width >= 0 && v->sizehints->max_height >= 0)*/
-				v->sizehints->flags |= PMaxSize;
+			v->sizehints->flags |= PMinSize | PMaxSize;
 		}
 
 		TDBPRINTF(TDB_INFO,("width: %d..%d..%d - height: %d..%d..%d\n",
@@ -656,29 +653,15 @@ setattrfunc(struct THook *hook, TAPTR ob
 			break;*/
 		case TVisual_MinWidth:
 			v->sizehints->min_width = (TINT) item->tti_Value;
-			v->sizehints->flags |= PMinSize;
-			data->sizechanged = TTRUE;
 			break;
 		case TVisual_MinHeight:
 			v->sizehints->min_height = (TINT) item->tti_Value;
-			v->sizehints->flags |= PMinSize;
-			data->sizechanged = TTRUE;
 			break;
 		case TVisual_MaxWidth:
 			v->sizehints->max_width = (TINT) item->tti_Value;
-			if (v->sizehints->max_width == -1)
-				v->sizehints->flags &= ~PMaxSize;
-			else
-				v->sizehints->flags |= PMaxSize;
-			data->sizechanged = TTRUE;
 			break;
 		case TVisual_MaxHeight:
 			v->sizehints->max_height = (TINT) item->tti_Value;
-			if (v->sizehints->max_width == -1)
-				v->sizehints->flags &= ~PMaxSize;
-			else
-				v->sizehints->flags |= PMaxSize;
-			data->sizechanged = TTRUE;
 			break;
 		case TVisualHost_GrabButton:
 			switch (item->tti_Value)
@@ -754,14 +737,21 @@ x11_setattrs(TMOD_X11 *mod, struct TVReq
 	data.v = v;
 	data.num = 0;
 	data.mod = mod;
-	data.sizechanged = TFALSE;
 	TInitHook(&hook, setattrfunc, &data);
 
 	TForEachTag(req->tvr_Op.SetAttrs.Tags, &hook);
 	req->tvr_Op.SetAttrs.Num = data.num;
 
-	if (data.sizechanged)
-		XSetWMNormalHints(mod->x11_Display, v->window, v->sizehints);
+	v->sizehints->min_width =
+		v->sizehints->min_width <= 0 ? 1 : v->sizehints->min_width;
+	v->sizehints->min_height =
+		v->sizehints->min_height <= 0 ? 1 : v->sizehints->min_height;
+	v->sizehints->max_width =
+		v->sizehints->max_width <= 0 ? 1000000 : v->sizehints->max_width;
+	v->sizehints->max_height =
+		v->sizehints->max_height <= 0 ? 1000000 : v->sizehints->max_height;
+
+	XSetWMNormalHints(mod->x11_Display, v->window, v->sizehints);
 }
 
 /*****************************************************************************/


More information about the teklib-general mailing list