diff os2/dw.c @ 37:360bc6a5f1c9

Sync with latest Dynamic Windows code.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 14 Oct 2001 23:27:37 +0000
parents b03b24bb95f8
children 538db2a48bac
line wrap: on
line diff
--- a/os2/dw.c	Mon Sep 17 09:15:40 2001 +0000
+++ b/os2/dw.c	Sun Oct 14 23:27:37 2001 +0000
@@ -21,10 +21,13 @@
 #include <stddef.h>
 #include <ctype.h>
 #include <process.h>
+#include <time.h>
 #include "dw.h"
 
 #define QWP_USER 0
 
+MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
+
 char ClassName[] = "dynamicwindows";
 char SplitbarClassName[] = "dwsplitbar";
 char DefaultFont[] = "9.WarpSans";
@@ -215,6 +218,9 @@
 	if(!handle)
 		return 0;
 
+	if(!WinIsWindowEnabled(handle))
+		return 0;
+
 	WinQueryClassName(handle, 99, tmpbuf);
 
 	/* These are the window classes which can
@@ -923,7 +929,7 @@
 
 						if(boxinfo && boxinfo->grouphwnd)
 							WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0,
-											width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
+											width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE /*| SWP_ZORDER*/);
 
 					}
 
@@ -1201,6 +1207,21 @@
 
 	switch(msg)
 	{
+	case WM_BUTTON1DOWN:
+	case WM_BUTTON2DOWN:
+	case WM_BUTTON3DOWN:
+		{
+			char tmpbuf[100];
+
+			WinQueryClassName(hWnd, 99, tmpbuf);
+
+			if(strncmp(tmpbuf, "#32", 3)==0)
+				_run_event(hWnd, WM_SETFOCUS, FALSE, TRUE);
+		}
+		break;
+	case WM_SETFOCUS:
+		_run_event(hWnd, msg, mp1, mp2);
+		break;
 	case WM_CHAR:
 		if(SHORT1FROMMP(mp2) == '\t')
 		{
@@ -2162,6 +2183,9 @@
 	switch(msg)
 	{
 #ifndef NO_SIGNALS
+	case WM_SETFOCUS:
+		_wndproc(hwnd, msg, mp1, mp2);
+		break;
 	case WM_BUTTON1UP:
 		{
 			SignalHandler *tmp = Root;
@@ -2432,6 +2456,28 @@
 }
 
 /*
+ * Runs a message loop for Dynamic Windows, for a period of seconds.
+ * Parameters:
+ *           seconds: Number of seconds to run the loop for.
+ */
+void dw_main_sleep(int seconds)
+{
+	QMSG qmsg;
+	time_t start = time(NULL);
+
+	while(time(NULL) - start <= seconds)
+	{
+		if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
+		{
+			WinGetMsg(dwhab, &qmsg, 0, 0, 0);
+			WinDispatchMsg(dwhab, &qmsg);
+		}
+		else
+			DosSleep(1);
+	}
+}
+
+/*
  * Free's memory allocated by dynamic windows.
  * Parameters:
  *           ptr: Pointer to dynamic windows allocated
@@ -3746,9 +3792,9 @@
 
 		thisbox->count++;
 
-        /* Don't set the ownership if it's an entryfield  or combobox */
+        /* Don't set the ownership if it's an entryfield  or spinbutton */
 		WinQueryClassName(item, 99, tmpbuf);
-		if(strncmp(tmpbuf, "#6", 3)!=0 /*&& strncmp(tmpbuf, "#2", 2)!=0*/)
+		if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 3)!=0)
 		{
 			if((boxowner = WinQueryWindow(box, QW_OWNER)) != 0)
 				WinSetOwner(item, boxowner);
@@ -5847,8 +5893,8 @@
 		thisbox->count++;
 
 		WinQueryClassName(item, 99, tmpbuf);
-		/* Don't set the ownership if it's an entryfield or combobox */
-		if(strncmp(tmpbuf, "#6", 3)!=0 /*&& strncmp(tmpbuf, "#2", 2)!=0*/)
+		/* Don't set the ownership if it's an entryfield or spinbutton */
+		if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 3)!=0)
 		{
 			if((boxowner = WinQueryWindow(box, QW_OWNER)) != 0)
 				WinSetOwner(item, boxowner);