[tekui-devel] tekui: Visual API: getTime() now returns two integers (sec, micr...

Timm S. Mueller tmueller at schulze-mueller.de
Thu Nov 20 22:40:07 CET 2008


details:   http://hg.teklib.org/tekui/rev/ce9ae4bc70fd
changeset: 38:ce9ae4bc70fd
user:      Timm S. Mueller <tmueller at schulze-mueller.de>
date:      Fri Nov 14 14:59:33 2008 +0100
description:
Visual API: getTime() now returns two integers (sec, microsec) to support
integer builds of the Interpreter, message timestamps are now divided into
sec, microsec with the latter being placed in msg[0], Lua numerical values are
now integer where appropriate; Application, Window: message handling reflects
timestamp in msg[0]; Window: DoubleClick testing reworked to reflect split
time stamps, checkDblClickTime() method added; DirList: Canvas.AutoWidth
property is now initialized with false

diffs (truncated from 344 to 100 lines):

diff -r ae81bcbdc3e6 -r ce9ae4bc70fd doc/manual.html
--- a/doc/manual.html	Thu Nov 13 03:18:00 2008 +0100
+++ b/doc/manual.html	Fri Nov 14 14:59:33 2008 +0100
@@ -419,7 +419,7 @@
 			</p>
 			<hr />
 		</div>
-		<div class="node"><h2><a name="tek.ui.class.dirlist" id="tek.ui.class.dirlist">DirList (v9.2)</a></h2>
+		<div class="node"><h2><a name="tek.ui.class.dirlist" id="tek.ui.class.dirlist">DirList (v9.3)</a></h2>
 			<div class="definition"><dfn>LINEAGE</dfn>
 				<blockquote>
 					<p>
@@ -624,7 +624,7 @@
 			</p>
 			<hr />
 		</div>
-		<div class="node"><h2><a name="tek.ui.class.application" id="tek.ui.class.application">Application (v9.1)</a></h2>
+		<div class="node"><h2><a name="tek.ui.class.application" id="tek.ui.class.application">Application (v9.2)</a></h2>
 			<div class="definition"><dfn>LINEAGE</dfn>
 				<blockquote>
 					<p>
@@ -4888,7 +4888,7 @@
 			</p>
 			<hr />
 		</div>
-		<div class="node"><h2><a name="tek.ui.class.window" id="tek.ui.class.window">Window (v8.1)</a></h2>
+		<div class="node"><h2><a name="tek.ui.class.window" id="tek.ui.class.window">Window (v9.0)</a></h2>
 			<div class="definition"><dfn>LINEAGE</dfn>
 				<blockquote>
 					<p>
@@ -5147,6 +5147,15 @@ message = function(object, message)
 				Sets/unsets the element
 				which is activated (or 'in use'). If <code>notify</code> is <strong>false</strong>, the
 				value is set, but no notification is triggered.
+			</p>
+			<hr />
+		</div>
+		<div class="node"><h3><a name="Window:checkDblClickTime" id="Window:checkDblClickTime"><code>dblclick = Window:checkDblClickTime(as, au, bs, bu)</code></a></h3>
+			<p>
+				Check if the two
+				given times (first a, second b) are within the doubleclick interval.
+				Each time is specified in seconds (s) and microseconds (u). Returns
+				<strong>true</strong> if the two times are indicative of a double click.
 			</p>
 			<hr />
 		</div>
@@ -7286,7 +7295,7 @@ Class.checkDescend(Button, Area)
 </pre>
 		<hr />
 		<p>
-			Document generated on Thu Nov 13 03:15:46 2008
+			Document generated on Fri Nov 14 14:54:06 2008
 		</p>
 	</div>
 	</body>
diff -r ae81bcbdc3e6 -r ce9ae4bc70fd tek/lib/visual_api.c
--- a/tek/lib/visual_api.c	Thu Nov 13 03:18:00 2008 +0100
+++ b/tek/lib/visual_api.c	Fri Nov 14 14:59:33 2008 +0100
@@ -32,7 +32,7 @@ tek_lib_visual_wait(lua_State *L)
 
 	if (lua_istable(L, 1))
 	{
-		n = lua_isnone(L, 2) ? 32 : luaL_checknumber(L, 2);
+		n = lua_isnone(L, 2) ? 32 : luaL_checkinteger(L, 2);
 		for (i = 1; i <= n; ++i)
 		{
 			lua_rawgeti(L, 1, i);
@@ -101,21 +101,15 @@ tek_lib_visual_gettime(lua_State *L)
 {
 	TEKVisual *vis;
 	TTIME dt;
-	lua_Number t;
 
 	lua_getfield(L, LUA_REGISTRYINDEX, TEK_LIB_VISUAL_BASECLASSNAME);
 	vis = lua_touserdata(L, -1);
 	lua_pop(L, 1);
 
 	TQueryTime(vis->vis_TimeRequest, &dt);
-
-	t = dt.ttm_USec;
-	t *= 0.000001;
-	t += dt.ttm_Sec;
-
-	lua_pushnumber(L, t);
-
-	return 1;
+	lua_pushinteger(L, dt.ttm_Sec);
+	lua_pushinteger(L, dt.ttm_USec);
+	return 2;
 }
 
 /*****************************************************************************/
@@ -130,7 +124,7 @@ tek_lib_visual_openfont(lua_State *L)
 	TEKVisual *vis;
 	TEKFont *font;
 	TSTRPTR name = (TSTRPTR) luaL_optstring(L, 1, "");
-	TINT size = luaL_optnumber(L, 2, -1);
+	TINT size = luaL_optinteger(L, 2, -1);
 
 	lua_getfield(L, LUA_REGISTRYINDEX, TEK_LIB_VISUAL_BASECLASSNAME);


More information about the tekui-devel mailing list