WinWorkstat.st
changeset 2253 864c30e95b4b
parent 2251 43d624ce346f
child 2260 954c7dce96aa
equal deleted inserted replaced
2252:53bad848ffa8 2253:864c30e95b4b
   322 
   322 
   323 /*#undef DEBUG*/
   323 /*#undef DEBUG*/
   324 #ifdef DEBUG
   324 #ifdef DEBUG
   325 # define PRINTF(x)              { printf x;}
   325 # define PRINTF(x)              { printf x;}
   326 # define CPRINTF(x)              { if (__debug__) printf x;}
   326 # define CPRINTF(x)              { if (__debug__) printf x;}
   327 # define RESPRINTF(x)           { if (__debug__) printf x;}
   327 # define RESPRINTF(x)           /*{ if (__debug__) printf x;}*/
   328 # define RES1PRINTF(x)          { if (__debug__) printf x;}
   328 # define RES1PRINTF(x)          /*{ if (__debug__) printf x;}*/
   329 # define RES_BMP_PRINTF(x)      { if (__debug__) printf x;}
   329 # define RES_BMP_PRINTF(x)      /*{ if (__debug__) printf x;}*/
   330 # define TH_DPRINTF(x)          /*{ if (__debug__) printf x;}*/
   330 # define TH_DPRINTF(x)          /*{ if (__debug__) printf x;}*/
   331 # define POSTPRINTF(x)          { if (__debug__) printf x;}
   331 # define POSTPRINTF(x)          { if (__debug__) printf x;}
   332 # define DPRINTF(x)             { if (__debug__) printf x;}
   332 # define DPRINTF(x)             { if (__debug__) printf x;}
   333 # define DDPRINTF(x)            /*{ if (__debug__) printf x;}*/
   333 # define DDPRINTF(x)            /*{ if (__debug__) printf x;}*/
   334 # define EVENT_PRINTF(x)        /*{ if (__debug__) printf x;}*/
   334 # define EVENT_PRINTF(x)        /*{ if (__debug__) printf x;}*/
   550 %}
   550 %}
   551 ! !
   551 ! !
   552 
   552 
   553 !WinWorkstation primitiveFunctions!
   553 !WinWorkstation primitiveFunctions!
   554 %{
   554 %{
   555 #ifdef WIN32THREADS
   555 #ifdef xxWIN32THREADS
   556 extern void __suspendAktThread();
   556 extern void __suspendAktThread();
   557 extern void __resumeAktThread();
   557 extern void __resumeAktThread();
   558 #endif
   558 #endif
   559 
   559 
   560 __debugEvent__() {}
   560 __debugEvent__() {}
   875 	  } else {
   875 	  } else {
   876 	      eventQueueHead = ev;
   876 	      eventQueueHead = ev;
   877 	  }
   877 	  }
   878 	  eventQueueTail = ev;
   878 	  eventQueueTail = ev;
   879       } else {
   879       } else {
       
   880 
       
   881 	unlockEvent();
   880 	SetEvent(hInputEvent);
   882 	SetEvent(hInputEvent);
   881 
   883         printf("winthread wait\n");
   882 	unlockEvent();
       
   883 	if (repeatCount++ < 10)
   884 	if (repeatCount++ < 10)
   884 	{
   885 	{
   885 	  Sleep(20);
   886 	  Sleep(20);
   886 	  if (lockEvent())
   887 	  if (lockEvent())
   887 	  {
   888 	  {
   888 	     goto again;
   889 	     goto again;
   889 	  }
   890 	  }
   890 	}
   891 	}
       
   892         printf("winthread throw away\n");
   891 	/* throw away sorry */
   893 	/* throw away sorry */
   892 	return;
   894 	return;
   893       }
   895       }
   894 
   896 
   895 
   897 
       
   898 
       
   899       unlockEvent();
   896       SetEvent(hInputEvent);
   900       SetEvent(hInputEvent);
   897 
       
   898       unlockEvent();
       
   899       /*SetThreadPriority(_masterThread,THREAD_PRIORITY_HIGHEST);*/
   901       /*SetThreadPriority(_masterThread,THREAD_PRIORITY_HIGHEST);*/
   900       Sleep(0);
   902       //Sleep(0);
   901     }
   903     }
   902 }
   904 }
   903 
   905 
   904 static
   906 static
   905 deqEvent(struct queuedEvent *ret_ev,HWND hWnd,int mask)
   907 deqEvent(struct queuedEvent *ret_ev,HWND hWnd,int mask)
  1092 	      DPRINTF(("WM_DESTROY\n"));
  1094 	      DPRINTF(("WM_DESTROY\n"));
  1093 	      if (GETLOCALWINDOWINFOPTR(hWnd))
  1095 	      if (GETLOCALWINDOWINFOPTR(hWnd))
  1094 	      {
  1096 	      {
  1095 		if (GETLOCALWINDOWINFOPTR(hWnd)->flag & LI_TOPWIN)
  1097 		if (GETLOCALWINDOWINFOPTR(hWnd)->flag & LI_TOPWIN)
  1096 		{
  1098 		{
       
  1099 #if 0
  1097 #ifdef WIN32THREADS
  1100 #ifdef WIN32THREADS
  1098 		  __suspendAktThread();
  1101 		  __suspendAktThread();
  1099 #else
  1102 #else
  1100 		  SuspendThread(_masterThread);
  1103 		  SuspendThread(_masterThread);
  1101 #endif
  1104 #endif
       
  1105 #endif
  1102 		  n = (char*)malloc(200);
  1106 		  n = (char*)malloc(200);
       
  1107 #if 0
  1103 #ifdef WIN32THREADS
  1108 #ifdef WIN32THREADS
  1104 		  __resumeAktThread();
  1109 		  __resumeAktThread();
  1105 #else
  1110 #else
  1106 		  ResumeThread(_masterThread);
  1111 		  ResumeThread(_masterThread);
       
  1112 #endif
  1107 #endif
  1113 #endif
  1108 		  GetClassName(hWnd,n,200);
  1114 		  GetClassName(hWnd,n,200);
  1109 		}
  1115 		}
  1110 #ifdef COUNT_RESOURCES
  1116 #ifdef COUNT_RESOURCES
  1111 	      __cnt_createWindows--;
  1117 	      __cnt_createWindows--;
  1188 	    enqEvent(0,hWnd, message, wParam,
  1194 	    enqEvent(0,hWnd, message, wParam,
  1189 			       rct.left, rct.top,
  1195 			       rct.left, rct.top,
  1190 			       rct.right-rct.left,
  1196 			       rct.right-rct.left,
  1191 			       rct.bottom-rct.top);
  1197 			       rct.bottom-rct.top);
  1192 	    return 0;
  1198 	    return 0;
  1193 
  1199             break;
  1194 	case WM_ERASEBKGND:
  1200 	case WM_ERASEBKGND:
  1195 	    EVENT_PRINTF(("WM_ERASEBKGND\n"));
  1201 	    EVENT_PRINTF(("WM_ERASEBKGND\n"));
  1196 	    if (isNative) {
  1202 	    if (isNative) {
  1197 		*pDefault = 1;
  1203 		*pDefault = 1;
  1198 		return 0;
  1204 		return 0;
  1199 	    }
  1205 	    }
  1200 	    *pDefault = 0;
  1206 	    *pDefault = 0;
  1201 	    if ((GetWindow_Flag(hWnd) & LI_INPUTWIN) == 0)
  1207 	    if ((GetWindow_Flag(hWnd) & LI_INPUTWIN) == 0)
  1202 	    {
  1208 	    {
       
  1209 #if 0
  1203 		int state;
  1210 		int state;
  1204 		HDC dc = (HDC)wParam;
  1211 		HDC dc = (HDC)wParam;
  1205 		/*HBRUSH br = GetWindow_bgBrush(hWnd);*/
  1212 		/*HBRUSH br = GetWindow_bgBrush(hWnd);*/
  1206 		HBRUSH br = CreateSolidBrush(st2RGB(GetWindow_bgBrush(hWnd),0));
  1213 		HBRUSH br = CreateSolidBrush(st2RGB(GetWindow_bgBrush(hWnd),0));
  1207 		if (br == 0)
  1214 		if (br == 0)
  1224 		__resumeAktThread();
  1231 		__resumeAktThread();
  1225 #else
  1232 #else
  1226 		ResumeThread(_masterThread);
  1233 		ResumeThread(_masterThread);
  1227 #endif
  1234 #endif
  1228 		DelObject(br);
  1235 		DelObject(br);
       
  1236 #endif
  1229 	    }
  1237 	    }
  1230 	    return 1;
  1238 	    return 1;
  1231 	    break;
  1239 	    break;
  1232 	case WM_PAINT:
  1240 	case WM_PAINT:
  1233 	    EVENT_PRINTF(("WM_PAINT\n"));
  1241 	    EVENT_PRINTF(("WM_PAINT\n"));
  1234 	    if (isNative) {
  1242 	    if (isNative) {
  1235 		*pDefault = 1;
  1243 		*pDefault = 1;
  1236 		return 0;
  1244 		return 0;
  1237 	    }
  1245 	    }
  1238 	    if ((GetWindow_Flag(hWnd) & LI_INPUTWIN) == 0)
  1246 	    if (((GetWindow_Flag(hWnd) & LI_INPUTWIN) == 0) && (__rootWinSpezial != hWnd))
  1239 	    {
  1247 	    {
  1240 	      if (GetUpdateRect(hWnd, &upd, TRUE))
  1248 	      //if (GetUpdateRect(hWnd, &upd, TRUE))
  1241 	      //if (GetUpdateRect(hWnd, &upd, FALSE))
  1249 	      if (GetUpdateRect(hWnd, &upd, FALSE))
  1242 	      {
  1250 	      {
  1243 		  if ((GetWindow_Flag(hWnd) & LI_INPUTWIN) == 0)
  1251                   if (GetWindow_eventMask(hWnd) & ExposureMask)
  1244 		  {
  1252                     enqEvent(ExposureMask,hWnd, message, wParam, upd.left, upd.top, upd.right, upd.bottom);
  1245 		    if (GetWindow_eventMask(hWnd) & ExposureMask)
       
  1246 		      enqEvent(ExposureMask,hWnd, message, wParam, upd.left, upd.top, upd.right, upd.bottom);
       
  1247 		  }
       
  1248 	      }
  1253 	      }
  1249 	    }
  1254 	    }
  1250 	    /**pDefault = 0;*/
  1255             else
       
  1256 	      pDefault = 0;
  1251 	    return 0;
  1257 	    return 0;
  1252 	    break;
  1258 	    break;
  1253 
  1259 
  1254 	case WM_SIZE:
  1260 	case WM_SIZE:
  1255 	    EVENT_PRINTF(("WM_SIZE\n"));
  1261 	    EVENT_PRINTF(("WM_SIZE\n"));
  1269 	    enqEvent(0,hWnd, message, wParam, 0, 0, 0, 0);
  1275 	    enqEvent(0,hWnd, message, wParam, 0, 0, 0, 0);
  1270 	    if (isNative) {
  1276 	    if (isNative) {
  1271 		*pDefault = 1;
  1277 		*pDefault = 1;
  1272 		return 0;
  1278 		return 0;
  1273 	    }
  1279 	    }
  1274 	    *pDefault = 0;
  1280             break;
  1275 	    return 0;
  1281 	    //*pDefault = 0;
       
  1282 	    //return 0;
  1276 
  1283 
  1277 	case WM_MOUSEACTIVATE :
  1284 	case WM_MOUSEACTIVATE :
  1278 	    EVENT_PRINTF2(("WM_MOUSEACTIVATE h=%x\n", hWnd));
  1285 	    EVENT_PRINTF2(("WM_MOUSEACTIVATE h=%x\n", hWnd));
  1279 	    *pDefault = 0;
  1286 	    *pDefault = 0;
  1280 	    if (GetActiveWindow() &&
  1287 	    if ((__rootWinSpezial == hWnd) || (GetActiveWindow() && (LOWORD(lParam) == HTCLIENT))
  1281 		((GETLOCALWINDOWINFOPTR(hWnd)->flag & LI_TOPWIN) == 0)
  1288 		/*((GETLOCALWINDOWINFOPTR(hWnd)->flag & LI_TOPWIN) == 0) */
  1282 	       )
  1289 	       )
  1283 	       return MA_NOACTIVATE;
  1290 	       return MA_NOACTIVATE;
  1284 	    else
  1291 	    else
  1285 	    {
  1292 	    {
  1286 	      return MA_ACTIVATE;
  1293 	      return MA_ACTIVATE;
  1287 	    }
  1294 	    }
  1288 	    break;
  1295 	    break;
       
  1296         case WM_NCHITTEST:
       
  1297 	    EVENT_PRINTF(("WM_NCHITTEST\n"));
       
  1298             if (hWnd == __rootWinSpezial)
       
  1299             {
       
  1300 	      *pDefault = 0;
       
  1301               return HTCLIENT;
       
  1302             }
       
  1303 	    break;
       
  1304 	case WM_NCACTIVATE:
       
  1305 	    EVENT_PRINTF(("WM_NCACTIVATE\n"));
       
  1306 	    break;
  1289 	case WM_ACTIVATE:
  1307 	case WM_ACTIVATE:
  1290 	    CPRINTF(("WM_ACTIVATE %s h=%x\n",
  1308 	    CPRINTF(("WM_ACTIVATE %s h=%x\n",
  1291 			    LOWORD(wParam) ? "active" : "inactive",
  1309 			    LOWORD(wParam) ? "active" : "inactive",
  1292 			    hWnd));
  1310 			    hWnd));
  1293 
  1311 #if 0
  1294 	    enqEvent(0,hWnd, message, wParam, 0, 0, 0, 0);
  1312 	    enqEvent(0,hWnd, message, wParam, 0, 0, 0, 0);
  1295 	    switch (LOWORD(wParam)) {
  1313 	    switch (LOWORD(wParam)) {
  1296 		case WA_INACTIVE:
  1314 		case WA_INACTIVE:
  1297 		    EVENT_PRINTF2(("WM_ACTIVATE inactive h=%x\n", hWnd));
  1315 		    EVENT_PRINTF2(("WM_ACTIVATE inactive h=%x\n", hWnd));
  1298 		    break;
  1316 		    break;
  1343 		*pDefault = 1;
  1361 		*pDefault = 1;
  1344 		return 0;
  1362 		return 0;
  1345 	    }
  1363 	    }
  1346 	    *pDefault = 0;
  1364 	    *pDefault = 0;
  1347 	    return 0;
  1365 	    return 0;
  1348 
  1366 #endif
       
  1367             break;
  1349 	case WM_SYSCHAR:
  1368 	case WM_SYSCHAR:
  1350 	    EVENT_PRINTF2(("WM_SYSCHAR h=%x %x\n", hWnd, wParam));
  1369 	    EVENT_PRINTF2(("WM_SYSCHAR h=%x %x\n", hWnd, wParam));
  1351 	    goto commonChar;
  1370 	    goto commonChar;
  1352 
  1371 
  1353 	case WM_CHAR:
  1372 	case WM_CHAR:
  1607 		      //SetFocus(hWndChild);
  1626 		      //SetFocus(hWndChild);
  1608 		      currentPointerView = hWndChild;
  1627 		      currentPointerView = hWndChild;
  1609 		  }
  1628 		  }
  1610 	      }
  1629 	      }
  1611 	    }
  1630 	    }
       
  1631 #endif
  1612 	    if (isNative) {
  1632 	    if (isNative) {
  1613 		*pDefault = 1;
  1633 		*pDefault = 1;
  1614 		return 0;
  1634 		return 0;
  1615 	    }
  1635 	    }
  1616 	    *pDefault = 0;
  1636 	    *pDefault = 0;
  1617 #endif
  1637 	    break;
  1618 	    break;                                                                                                                                                                                      
       
  1619 	case WM_STYLECHANGING:
  1638 	case WM_STYLECHANGING:
  1620 	    EVENT_PRINTF(("WM_STYLECHANGING\n"));
  1639 	    EVENT_PRINTF(("WM_STYLECHANGING\n"));
  1621 	    break;
  1640 	    break;
  1622 
  1641 
  1623 	case WM_STYLECHANGED:
  1642 	case WM_STYLECHANGED:
  1632 	    EVENT_PRINTF(("WM_GETTEXTLENGTH %x\n", message));
  1651 	    EVENT_PRINTF(("WM_GETTEXTLENGTH %x\n", message));
  1633 	    break;
  1652 	    break;
  1634 
  1653 
  1635 	case WM_NCCREATE:
  1654 	case WM_NCCREATE:
  1636 	    EVENT_PRINTF(("WM_NCCREATE %x\n", message));
  1655 	    EVENT_PRINTF(("WM_NCCREATE %x\n", message));
  1637 	    break;
       
  1638 
       
  1639 	case WM_NCHITTEST:
       
  1640 	    EVENT_PRINTF3(("WM_NCHITTEST %x\n", message));
       
  1641 	    break;
  1656 	    break;
  1642 
  1657 
  1643 	case WM_NCMOUSEMOVE:
  1658 	case WM_NCMOUSEMOVE:
  1644 	    {
  1659 	    {
  1645 		short x, y;
  1660 		short x, y;
  1755 	case WM_QUERYNEWPALETTE:
  1770 	case WM_QUERYNEWPALETTE:
  1756 	    EVENT_PRINTF(("WM_QUERYNEWPALETTE\n"));
  1771 	    EVENT_PRINTF(("WM_QUERYNEWPALETTE\n"));
  1757 	    break;
  1772 	    break;
  1758 	case WM_PALETTECHANGED:
  1773 	case WM_PALETTECHANGED:
  1759 	    EVENT_PRINTF(("WM_PALETTECHANGED\n"));
  1774 	    EVENT_PRINTF(("WM_PALETTECHANGED\n"));
  1760 	    break;
       
  1761 	case WM_NCACTIVATE:
       
  1762 	    EVENT_PRINTF(("WM_NCACTIVATE\n"));
       
  1763 	    break;
  1775 	    break;
  1764 	case WM_ACTIVATEAPP:
  1776 	case WM_ACTIVATEAPP:
  1765 	    EVENT_PRINTF2(("WM_ACTIVATEAPP %s\n", wParam ? "active" : "inactive"));
  1777 	    EVENT_PRINTF2(("WM_ACTIVATEAPP %s\n", wParam ? "active" : "inactive"));
  1766 	    break;
  1778 	    break;
  1767 	case WM_SYSDEADCHAR:
  1779 	case WM_SYSDEADCHAR:
  1811 	    EVENT_PRINTF(("msg = %x\n", message));
  1823 	    EVENT_PRINTF(("msg = %x\n", message));
  1812 	    break;
  1824 	    break;
  1813     }
  1825     }
  1814     return 0;
  1826     return 0;
  1815 }
  1827 }
       
  1828 #if 0
  1816 static
  1829 static
  1817 winEventProcessingRoot(hWnd, message, wParam, lParam, pDefault)
  1830 winEventProcessingRoot(hWnd, message, wParam, lParam, pDefault)
  1818     HWND hWnd;                /* window handle                   */
  1831     HWND hWnd;                /* window handle                   */
  1819     UINT message;             /* type of message                 */
  1832     UINT message;             /* type of message                 */
  1820     UINT wParam;              /* additional information          */
  1833     UINT wParam;              /* additional information          */
  1825     WINDOWPOS *posStruct;
  1838     WINDOWPOS *posStruct;
  1826     RECT rct;
  1839     RECT rct;
  1827     RECT upd;
  1840     RECT upd;
  1828     int modifiers;
  1841     int modifiers;
  1829     int x, y, w, h;
  1842     int x, y, w, h;
       
  1843     int isNative = 0;
  1830     PAINTSTRUCT ps;
  1844     PAINTSTRUCT ps;
  1831 
  1845 
  1832 
  1846 /*
  1833 /*    printf("winEvent hWin=0x%x message=0x%x wP=0x%x lP=0x%x\n",
  1847     EVENT_PRINTF(("winEvent hWin=0x%x message=0x%x wP=0x%x lP=0x%x\n",
  1834 			hWnd, message, wParam, lParam);
  1848 			hWnd, message, wParam, lParam));
  1835 */
  1849 */
  1836 
  1850 
  1837 
  1851 
  1838     /*
  1852     /*
  1839      * messages which are enqueued to be handled by the view thread
  1853      * messages which are enqueued to be handled by the view thread
  1842 	case WM_CREATE:
  1856 	case WM_CREATE:
  1843 	    {
  1857 	    {
  1844 	      CREATESTRUCT *lpcs = (LPCREATESTRUCT) lParam; // structure with creation data
  1858 	      CREATESTRUCT *lpcs = (LPCREATESTRUCT) lParam; // structure with creation data
  1845 	      SETLOCALWINDOWINFOPTR(hWnd,lpcs->lpCreateParams);
  1859 	      SETLOCALWINDOWINFOPTR(hWnd,lpcs->lpCreateParams);
  1846 	      if (GETLOCALWINDOWINFOPTR(hWnd) != lpcs->lpCreateParams)
  1860 	      if (GETLOCALWINDOWINFOPTR(hWnd) != lpcs->lpCreateParams)
  1847 		DPRINTF(("SETLOCALWINDOWINFOPTR ERROR\n"));
  1861 		PRINTF(("SETLOCALWINDOWINFOPTR ERROR\n"));
  1848 	      *pDefault = 0;
  1862 	      *pDefault = 0;
       
  1863 #ifdef COUNT_RESOURCES
       
  1864 	      __cnt_createWindows++;
       
  1865 	   RESPRINTF(("CreateWindows %d\n",__cnt_createWindows));
       
  1866 #endif
  1849 	      DPRINTF(("WM_CREATE\n"));
  1867 	      DPRINTF(("WM_CREATE\n"));
       
  1868 	    }
       
  1869 	    break;
       
  1870 	case WM_CLOSE:
       
  1871 	    DPRINTF(("WM_CLOSE\n"));
       
  1872 	    if (!destroyWin)
       
  1873 	      enqEvent(0,hWnd, message, wParam, 0, 0, 0, 0);
       
  1874 	    else
       
  1875 	    {
       
  1876 	      destroyWin = 0;
       
  1877 	      if (!DestroyWindow(hWnd))
       
  1878 	      {
       
  1879 		DPRINTF(("DestroyWindow ERROR\n"));
       
  1880 	      }
       
  1881 
       
  1882 	    }
       
  1883 	    *pDefault = 0;
       
  1884 	    return 0;
       
  1885 	    break;
       
  1886 	case WM_DESTROY:
       
  1887 	    {
       
  1888 	      char *n = 0;
       
  1889 	      DPRINTF(("WM_DESTROY\n"));
       
  1890 	      if (GETLOCALWINDOWINFOPTR(hWnd))
       
  1891 	      {
       
  1892 		if (GETLOCALWINDOWINFOPTR(hWnd)->flag & LI_TOPWIN)
       
  1893 		{
       
  1894 #if 0
       
  1895 #ifdef WIN32THREADS
       
  1896 		  __suspendAktThread();
       
  1897 #else
       
  1898 		  SuspendThread(_masterThread);
       
  1899 #endif
       
  1900 #endif
       
  1901 		  n = (char*)malloc(200);
       
  1902 #if 0
       
  1903 #ifdef WIN32THREADS
       
  1904 		  __resumeAktThread();
       
  1905 #else
       
  1906 		  ResumeThread(_masterThread);
       
  1907 #endif
       
  1908 #endif
       
  1909 		  GetClassName(hWnd,n,200);
       
  1910 		}
       
  1911 #ifdef COUNT_RESOURCES
       
  1912 	      __cnt_createWindows--;
       
  1913 	   RESPRINTF(("DestroyWindows %d\n",__cnt_createWindows));
       
  1914 #endif
       
  1915 	      /* free all resources */
       
  1916 		/*if (GetWindow_bgBrush(hWnd))
       
  1917 		  DelObject(GetWindow_bgBrush(hWnd));*/
       
  1918 		free(GETLOCALWINDOWINFOPTR(hWnd));
       
  1919 		SETLOCALWINDOWINFOPTR(hWnd,0);
       
  1920 	      }
       
  1921 
       
  1922 
       
  1923 	      enqEvent(0,hWnd, message, wParam, (int)n, 0, 0, 0);
       
  1924 	      *pDefault = 0;
       
  1925 	      return 0;
  1850 	    }
  1926 	    }
  1851 	    break;
  1927 	    break;
  1852 	case WM_SETCURSOR:
  1928 	case WM_SETCURSOR:
  1853 	    {
  1929 	    {
  1854 		HCURSOR curs;
  1930 		HCURSOR curs;
  1876 	    goto commonChar;
  1952 	    goto commonChar;
  1877 
  1953 
  1878 	case WM_CHAR:
  1954 	case WM_CHAR:
  1879 	    EVENT_PRINTF2(("WM_CHAR h=%x %x\n", hWnd, wParam));
  1955 	    EVENT_PRINTF2(("WM_CHAR h=%x %x\n", hWnd, wParam));
  1880 	commonChar:
  1956 	commonChar:
       
  1957 	    if (isNative) {
       
  1958 		*pDefault = 1;
       
  1959 		return 0;
       
  1960 	    }
  1881 	    modifiers = getModifiers();
  1961 	    modifiers = getModifiers();
       
  1962 	    {
       
  1963 		POINT p;
       
  1964 
       
  1965 		p.x = evRootX;
       
  1966 		p.y = evRootY;
       
  1967 		ScreenToClient(hWnd, &p);
       
  1968 		x = p.x;
       
  1969 		y = p.y;
       
  1970 	    }
       
  1971 	    if (currentPointerView)
       
  1972 	    {
       
  1973 	      if (GetWindow_eventMask(currentPointerView) & KeyPressMask)
       
  1974 		enqEvent(KeyPressMask,currentPointerView, WM_KEYDOWN, wParam, x, y, lParam, modifiers | TRANSLATED_KEY);
       
  1975 	      if (GetWindow_eventMask(currentPointerView) & KeyReleaseMask)
       
  1976 		enqEvent(KeyReleaseMask,currentPointerView, WM_KEYUP, wParam, x, y, lParam, modifiers | TRANSLATED_KEY);
       
  1977 	    }
       
  1978 	    else
       
  1979 	    {
       
  1980 	      if (GetWindow_eventMask(hWnd) & KeyPressMask)
       
  1981 		enqEvent(KeyPressMask,hWnd, WM_KEYDOWN, wParam, x, y, lParam, modifiers | TRANSLATED_KEY);
       
  1982 	      if (GetWindow_eventMask(hWnd) & KeyReleaseMask)
       
  1983 		enqEvent(KeyReleaseMask,hWnd, WM_KEYUP, wParam, x, y, lParam, modifiers | TRANSLATED_KEY);
       
  1984 	    }
  1882 	    *pDefault = 0;
  1985 	    *pDefault = 0;
  1883 	    return 0;
  1986 	    return 0;
  1884 
  1987 
       
  1988 	case WM_KEYUP:
       
  1989 	    EVENT_PRINTF2(("WM_KEYUP h=%x %x\n", hWnd, wParam));
       
  1990 	    goto commonKeyUp;
       
  1991 
  1885 	case WM_SYSKEYUP:
  1992 	case WM_SYSKEYUP:
  1886 	    EVENT_PRINTF2(("WM_SYSKEYUP %x\n, wParam"));
  1993 	    EVENT_PRINTF2(("WM_SYSKEYUP %x\n, wParam"));
  1887 	    goto commonKey;
  1994 	commonKeyUp:
       
  1995 	    if (isNative) {
       
  1996 		*pDefault = 1;
       
  1997 		return 0;
       
  1998 	    }
       
  1999 	    modifiers = getModifiers();
       
  2000 	    {
       
  2001 		POINT p;
       
  2002 
       
  2003 		p.x = evRootX;
       
  2004 		p.y = evRootY;
       
  2005 		ScreenToClient(hWnd, &p);
       
  2006 		x = p.x;
       
  2007 		y = p.y;
       
  2008 	    }
       
  2009 
       
  2010 	    if (currentPointerView)
       
  2011 	    {
       
  2012 	      if (GetWindow_eventMask(currentPointerView) & KeyReleaseMask)
       
  2013 		enqEvent(KeyReleaseMask,currentPointerView, message, wParam, x, y, lParam, modifiers);
       
  2014 	    }
       
  2015 	    else
       
  2016 	    {
       
  2017 	      if (GetWindow_eventMask(hWnd) & KeyReleaseMask)
       
  2018 		enqEvent(KeyReleaseMask,hWnd, message, wParam, x, y, lParam, modifiers);
       
  2019 	    }
       
  2020 	    *pDefault = 0;
       
  2021 	    return 0;
  1888 
  2022 
  1889 	case WM_SYSKEYDOWN:
  2023 	case WM_SYSKEYDOWN:
  1890 	    EVENT_PRINTF2(("WM_SYSKEYDOWN %x\n, wParam"));
  2024 	    EVENT_PRINTF2(("WM_SYSKEYDOWN %x\n, wParam"));
  1891 	    goto commonKey;
       
  1892 
       
  1893 	case WM_KEYUP:
       
  1894 	    EVENT_PRINTF2(("WM_KEYUP h=%x %x\n", hWnd, wParam));
       
  1895 	    goto commonKey;
  2025 	    goto commonKey;
  1896 
  2026 
  1897 	case WM_KEYDOWN:
  2027 	case WM_KEYDOWN:
  1898 	    EVENT_PRINTF2(("WM_KEYDOWN h=%x %x\n", hWnd, wParam));
  2028 	    EVENT_PRINTF2(("WM_KEYDOWN h=%x %x\n", hWnd, wParam));
  1899 
  2029 
  1900 	    /* while debugging ... */
  2030 	    /* while debugging ... */
  1901 	    if (wParam == VK_ESCAPE) {
  2031 	    if (wParam == VK_ESCAPE) {
  1902 		ReleaseCapture();
  2032 		ReleaseCapture();
  1903 		currentCapture = CAPTURE_NONE;
  2033 		currentCapture = CAPTURE_NONE;
  1904 		ShowWindow(hWnd,SW_HIDE);
  2034 		CPRINTF(("ReleaseCapture <ESC>\n"));
  1905 		CPRINTF(("rootReleaseCapture <ESC>\n"));
       
  1906 	    }
  2035 	    }
  1907 
  2036 
  1908 	commonKey:
  2037 	commonKey:
       
  2038 	    if (isNative) {
       
  2039 		*pDefault = 1;
       
  2040 		return 0;
       
  2041 	    }
  1909 	    modifiers = getModifiers();
  2042 	    modifiers = getModifiers();
       
  2043 	    {
       
  2044 		POINT p;
       
  2045 
       
  2046 		p.x = evRootX;
       
  2047 		p.y = evRootY;
       
  2048 		ScreenToClient(hWnd, &p);
       
  2049 		x = p.x;
       
  2050 		y = p.y;
       
  2051 	    }
       
  2052 	    if (currentPointerView)
       
  2053 	    {
       
  2054 	      if (GetWindow_eventMask(currentPointerView) & KeyPressMask)
       
  2055 		enqEvent(KeyPressMask,currentPointerView, message, wParam, x, y, lParam, modifiers);
       
  2056 	    }
       
  2057 	    else
       
  2058 	    {
       
  2059 	      if (GetWindow_eventMask(hWnd) & KeyPressMask)
       
  2060 		enqEvent(KeyPressMask,hWnd, message, wParam, x, y, lParam, modifiers);
       
  2061 	    }
  1910 	    *pDefault = 0;
  2062 	    *pDefault = 0;
  1911 	    return 0;
  2063 	    return 0;
       
  2064 
       
  2065 	case WM_MOUSEMOVE:
       
  2066 	    EVENT_PRINTF3(("WM_MOUSEMOVE h=%x\n", hWnd));
       
  2067 	    if (isNative) {
       
  2068 		*pDefault = 1;
       
  2069 		return 0;
       
  2070 	    }
       
  2071 
       
  2072 	    {
       
  2073 		short x, y;
       
  2074 
       
  2075 		x = (int)(short)LOWORD(lParam);
       
  2076 		y = (int)(short)HIWORD(lParam);
       
  2077 
       
  2078 		modifiers = getModifiers();
       
  2079 
       
  2080 		if (currentCapture == CAPTURE_NONE)
       
  2081 		{
       
  2082 		  if (hWnd != currentPointerView) {
       
  2083 		      if (currentPointerView) {
       
  2084 			  if (GetWindow_eventMask(hWnd) & LeaveWindowMask)
       
  2085 			    enqEvent(LeaveWindowMask,currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers);
       
  2086 			  currentPointerView = 0;
       
  2087 		      }
       
  2088 		      if (GetWindow_eventMask(hWnd) & EnterWindowMask)
       
  2089 			enqEvent(EnterWindowMask,hWnd, __WM_MOUSEENTER, 0, x, y, 0, modifiers);
       
  2090 		      currentPointerView = hWnd;
       
  2091 		  }
       
  2092 		  CPRINTF(("MouseMove %x\n",currentPointerView));
       
  2093 		}
       
  2094 		else
       
  2095 		{
       
  2096 		  CPRINTF(("MouseMove Capture %x\n",currentPointerView));
       
  2097 		}
       
  2098 		if (    (GetWindow_eventMask(currentPointerView) & PointerMotionMask)
       
  2099 		     || (modifiers & (Button1Mask|Button2Mask|Button3Mask))
       
  2100 		   )
       
  2101 		     enqEvent(PointerMotionMask,currentPointerView, message, wParam, x, y, 0, modifiers);
       
  2102 	    }
       
  2103 	    *pDefault = 0;
       
  2104 	    return 0;
       
  2105 
       
  2106 	case WM_LBUTTONUP:
       
  2107 	case WM_MBUTTONUP:
       
  2108 	case WM_RBUTTONUP:
       
  2109 	    if (isNative) {
       
  2110 		*pDefault = 1;
       
  2111 		return 0;
       
  2112 	    }
       
  2113 
       
  2114 	    if (currentCapture == CAPTURE_IMPLICIT) {
       
  2115 		currentCapture = CAPTURE_NONE;
       
  2116 		ReleaseCapture();
       
  2117 		CPRINTF(("ReleaseCapture <BUTTONUP>\n"));
       
  2118 	    }
       
  2119 	    modifiers = getModifiers();
       
  2120 	    EVENT_PRINTF3(("WM_BUTTONUP h=%x pos=%d/%d\n",
       
  2121 			   hWnd, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)));
       
  2122 
       
  2123 
       
  2124 	    if (GetWindow_eventMask(hWnd) & ButtonReleaseMask)
       
  2125 	      enqEvent(ButtonReleaseMask,hWnd, message, wParam, (int)(short)LOWORD(lParam),(int)(short)HIWORD(lParam),
       
  2126 					      wParam,modifiers);
       
  2127 	    *pDefault = 0;
       
  2128 	    break;
       
  2129 
  1912 	case WM_LBUTTONDOWN:
  2130 	case WM_LBUTTONDOWN:
  1913 	case WM_MBUTTONDOWN:
  2131 	case WM_MBUTTONDOWN:
  1914 	case WM_RBUTTONDOWN:
  2132 	case WM_RBUTTONDOWN:
       
  2133 	    if (isNative) {
       
  2134 		*pDefault = 1;
       
  2135 		return 0;
       
  2136 	    }
       
  2137 
       
  2138 	    if (currentCapture == CAPTURE_NONE)
       
  2139 	    {
       
  2140 		currentCapture = CAPTURE_IMPLICIT;
       
  2141 		//SetFocus(hWnd);
       
  2142 		SetCapture(hWnd);
       
  2143 		CPRINTF(("SetCapture <BUTTONDOWN>%x\n",hWnd));
       
  2144 	    }
  1915 	    goto commonButton;
  2145 	    goto commonButton;
  1916 
       
  1917 	case WM_LBUTTONUP:
       
  1918 	case WM_MBUTTONUP:
       
  1919 	case WM_RBUTTONUP:
       
  1920 	    ReleaseCapture();
       
  1921 	    SetWindowPos(hWnd, HWND_BOTTOM , 0, 0, 0, 0, SWP_NOSENDCHANGING|SWP_NOOWNERZORDER|SWP_NOACTIVATE | SWP_NOMOVE|SWP_NOSIZE);
       
  1922 	    ShowWindow(hWnd,SW_HIDE);
       
  1923 	    currentCapture = CAPTURE_NONE;
       
  1924 	    CPRINTF(("rootReleaseCapture <BUTTONUP>\n"));
       
  1925 	    goto commonButton;
       
  1926 
       
  1927 	case WM_LBUTTONDBLCLK:
  2146 	case WM_LBUTTONDBLCLK:
  1928 	case WM_MBUTTONDBLCLK:
  2147 	case WM_MBUTTONDBLCLK:
  1929 	case WM_RBUTTONDBLCLK:
  2148 	case WM_RBUTTONDBLCLK:
       
  2149 	    if (isNative) {
       
  2150 		*pDefault = 1;
       
  2151 		return 0;
       
  2152 	    }
  1930 	commonButton:
  2153 	commonButton:
  1931 	    modifiers = getModifiers();
  2154 	    modifiers = getModifiers();
  1932 	    EVENT_PRINTF3(("WM_BUTTONUP/DOWN h=%x pos=%d/%d\n",
  2155 	    EVENT_PRINTF3(("WM_BUTTONDOWN h=%x pos=%d/%d\n",
  1933 			   hWnd, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)));
  2156 			   hWnd, LOWORD(lParam), HIWORD(lParam)));
  1934 
  2157 
       
  2158 
       
  2159 	    if (GetWindow_eventMask(hWnd) & ButtonPressMask)
       
  2160 	      enqEvent(ButtonPressMask,hWnd, message, wParam, (int)(short)LOWORD(lParam),(int)(short)HIWORD(lParam),
       
  2161 					      wParam,modifiers);
  1935 	    *pDefault = 0;
  2162 	    *pDefault = 0;
  1936 	    break;
  2163 	    break;
  1937 	default:
       
  1938 	    EVENT_PRINTF(("msg = %x\n", message));
       
  1939 	    break;
       
  1940     }
  2164     }
  1941     return 0;
  2165     return 0;
  1942 }
  2166 }
       
  2167 #endif
  1943 LONG APIENTRY
  2168 LONG APIENTRY
  1944 MainWndProc(HWND hWnd,UINT message,UINT wParam,LONG lParam);
  2169 MainWndProc(HWND hWnd,UINT message,UINT wParam,LONG lParam);
  1945 LONG APIENTRY
  2170 //LONG APIENTRY MainWndProcRoot(HWND hWnd,UINT message,UINT wParam,LONG lParam);
  1946 MainWndProcRoot(HWND hWnd,UINT message,UINT wParam,LONG lParam);
       
  1947 
  2171 
  1948 void _USERENTRY dispatchThread(void *arg)
  2172 void _USERENTRY dispatchThread(void *arg)
  1949 {
  2173 {
  1950     static int th_calls;
  2174     static int th_calls;
  1951     RECT rect;
  2175     RECT rect;
  1966     if (li)
  2190     if (li)
  1967     {
  2191     {
  1968       memset(li,0,sizeof(*_thread_local));
  2192       memset(li,0,sizeof(*_thread_local));
  1969     }
  2193     }
  1970 
  2194 
  1971     __rootWinSpezial = CreateWindowEx( WS_EX_TRANSPARENT,app_nameroot,app_nameroot,0,
  2195     __rootWinSpezial = CreateWindowEx( WS_EX_TOOLWINDOW|WS_EX_TRANSPARENT,app_nameroot,app_nameroot,
       
  2196                                        WS_POPUP|WS_DISABLED,
  1972 				0,0,
  2197 				0,0,
  1973 				rect.right-rect.left,rect.bottom-rect.top,
  2198 				rect.right-rect.left,rect.bottom-rect.top,
  1974 				0,0,(HANDLE) __getHInstance(),li);
  2199 				0,0,(HANDLE) __getHInstance(),li);
  1975 
  2200 
  1976     /*printf("__rootWinSpezial %x\n",__rootWinSpezial);*/
  2201     /*printf("__rootWinSpezial %x\n",__rootWinSpezial);*/
       
  2202     //ShowWindow(__rootWinSpezial,SW_SHOWNOACTIVATE);
  1977     SetWindowPos(__rootWinSpezial, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
  2203     SetWindowPos(__rootWinSpezial, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
  1978     SetEvent(hCreateEvent);
  2204     SetEvent(hCreateEvent);
  1979 
  2205 
  1980     while (bdispatchThreadState)
  2206     while (bdispatchThreadState)
  1981     {
  2207     {
  1989 	  msg.message = WM_CLOSE;
  2215 	  msg.message = WM_CLOSE;
  1990 	  CPRINTF(("thread WM_THREADDESTROYWINDOW %x\n",msg.hwnd));
  2216 	  CPRINTF(("thread WM_THREADDESTROYWINDOW %x\n",msg.hwnd));
  1991 	}
  2217 	}
  1992 	else if (msg.message == WM_THREADSETFOCUS)
  2218 	else if (msg.message == WM_THREADSETFOCUS)
  1993 	{
  2219 	{
  1994 #ifdef WIN32THREADS
  2220 #ifdef xxWIN32THREADS
  1995 	  if (msg.lParam)
  2221 	  if (msg.lParam)
  1996 	  {
  2222 	  {
  1997 	    if (AttachThreadInput(_dispatchThreadId,msg.lParam,TRUE) == FALSE)
  2223 	    if (AttachThreadInput(_dispatchThreadId,msg.lParam,TRUE) == FALSE)
  1998 	      PRINTF(("SetFocus AttachThreadInput error %d\n",GetLastError()));
  2224 	      PRINTF(("SetFocus AttachThreadInput error %d\n",GetLastError()));
  1999 	  }
  2225 	  }
  2000 #endif
  2226 #endif
  2001 	  CPRINTF(("threadSetfocus %x\n",msg.wParam));
  2227 	  CPRINTF(("threadSetfocus %x\n",msg.wParam));
  2002 
  2228           //SetForegroundWindow((HWND)msg.wParam);
       
  2229 	  //SetWindowPos((HWND)msg.wParam, HWND_TOP, 0, 0, 0, 0, SWP_NOOWNERZORDER  |SWP_NOACTIVATE | SWP_NOMOVE|SWP_NOSIZE);
  2003 	  SetFocus((HWND)msg.wParam);
  2230 	  SetFocus((HWND)msg.wParam);
  2004 	  continue;
  2231 	  continue;
  2005 	}
  2232 	}
  2006 	else if (msg.message == WM_THREADSETCURSOR)
  2233 	else if (msg.message == WM_THREADSETCURSOR)
  2007 	{
  2234 	{
  2021 	    CPRINTF(("threadSetCapture %x\n",msg.wParam));
  2248 	    CPRINTF(("threadSetCapture %x\n",msg.wParam));
  2022 	    SetCapture(currentPointerView);
  2249 	    SetCapture(currentPointerView);
  2023 	  }
  2250 	  }
  2024 	  else
  2251 	  else
  2025 	  {
  2252 	  {
       
  2253             if (currentPointerView  == __rootWinSpezial)
       
  2254             {
       
  2255               //ShowWindow(__rootWinSpezial, SW_HIDE);
       
  2256               SetWindowPos(__rootWinSpezial, HWND_BOTTOM, 0, 0, 0, 0,SWP_NOREDRAW|SWP_NOSENDCHANGING|SWP_NOCOPYBITS
       
  2257                              |SWP_HIDEWINDOW| SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE/*| SWP_NOZORDER|SWP_NOOWNERZORDER*/);
       
  2258             }
  2026 	    currentPointerView = 0;
  2259 	    currentPointerView = 0;
  2027 	    currentCapture = CAPTURE_NONE;
  2260 	    currentCapture = CAPTURE_NONE;
  2028 	    CPRINTF(("threadReleaseCapture\n"));
  2261 	    CPRINTF(("threadReleaseCapture\n"));
  2029 	    ReleaseCapture();
  2262 	    ReleaseCapture();
  2030 	  }
  2263 	  }
  2107 	retVal = DefWindowProc(hWnd, message, wParam, lParam);
  2340 	retVal = DefWindowProc(hWnd, message, wParam, lParam);
  2108 	DDPRINTF(("<<DefWindowProc\n"));
  2341 	DDPRINTF(("<<DefWindowProc\n"));
  2109     }
  2342     }
  2110     return retVal;
  2343     return retVal;
  2111 }
  2344 }
  2112 
  2345 #if 0
  2113 LONG APIENTRY
  2346 LONG APIENTRY
  2114 MainWndProcRoot(HWND hWnd,UINT message,UINT wParam,LONG lParam)
  2347 MainWndProcRoot(HWND hWnd,UINT message,UINT wParam,LONG lParam)
  2115 {
  2348 {
  2116     int wantDefault = 1;
  2349     int wantDefault = 1;
  2117     int retVal;
  2350     int retVal;
  2118 
  2351 
  2119     TH_DPRINTF(("TMW %d\n",message));
  2352     TH_DPRINTF(("TMW %d\n",message));
  2120     retVal = winEventProcessingRoot(hWnd, message, wParam, lParam, &wantDefault);
  2353     retVal = winEventProcessingRoot(hWnd, message, wParam, lParam, &wantDefault);
  2121     return TRUE;
  2354     return TRUE;
  2122 }
  2355 }
  2123 
  2356 #endif
  2124 int CALLBACK
  2357 int CALLBACK
  2125 EnumFPTypeFaceProc( lplf, lptm, dwType, lpData )
  2358 EnumFPTypeFaceProc( lplf, lptm, dwType, lpData )
  2126 	LOGFONT*        lplf;
  2359 	LOGFONT*        lplf;
  2127 	TEXTMETRIC*     lptm;
  2360 	TEXTMETRIC*     lptm;
  2128 	DWORD           dwType;
  2361 	DWORD           dwType;
  5444 	    {
  5677 	    {
  5445 		n = _stringSize(aString);
  5678 		n = _stringSize(aString);
  5446 		if (i2 < n) 
  5679 		if (i2 < n) 
  5447 		{
  5680 		{
  5448 		    cp += i1;
  5681 		    cp += i1;
  5449 		    DPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x hWnd=%x\n", cp, pX, pY,l,hDC,_HWNDVal(aDrawableId)));
  5682 		    DDPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x hWnd=%x\n", cp, pX, pY,l,hDC,_HWNDVal(aDrawableId)));
  5450 		    if (opaque == true) {
  5683 		    if (opaque == true) {
  5451 			SetBkMode(hDC, OPAQUE);
  5684 			SetBkMode(hDC, OPAQUE);
  5452 		    } else {
  5685 		    } else {
  5453 			SetBkMode(hDC, TRANSPARENT);
  5686 			SetBkMode(hDC, TRANSPARENT);
  5454 		    }
  5687 		    }
  5473 		n = __byteArraySize(aString) - nInstBytes - 1;
  5706 		n = __byteArraySize(aString) - nInstBytes - 1;
  5474 
  5707 
  5475 		if (i2 < n) 
  5708 		if (i2 < n) 
  5476 		{
  5709 		{
  5477 		    cp += i1;
  5710 		    cp += i1;
  5478 		    DPRINTF(("string: %s pos=%d/%d\n", cp, pX, pY));
  5711 		    DDPRINTF(("string: %s pos=%d/%d\n", cp, pX, pY));
  5479 		    if (opaque == true) {
  5712 		    if (opaque == true) {
  5480 			SetBkMode(hDC, OPAQUE);
  5713 			SetBkMode(hDC, OPAQUE);
  5481 		    } else {
  5714 		    } else {
  5482 			SetBkMode(hDC, TRANSPARENT);
  5715 			SetBkMode(hDC, TRANSPARENT);
  5483 		    }
  5716 		    }
  6297 		 (*nexpS.ilc_func)(self,
  6530 		 (*nexpS.ilc_func)(self,
  6298 			 @symbol(noExposeView:), nil, &nexpS,
  6531 			 @symbol(noExposeView:), nil, &nexpS,
  6299 			 theView);
  6532 			 theView);
  6300 		break;
  6533 		break;
  6301 	    case WM_PAINT:
  6534 	    case WM_PAINT:
  6302 #if 0
       
  6303 		{
  6535 		{
  6304 		  RECT rec;
  6536 		  RECT rec;
  6305 		  HDC dc = (HDC)GetDC(ev->ev_hWnd);
  6537 		  HDC dc = (HDC)GetDC(ev->ev_hWnd);
  6306 		  HBRUSH br = CreateSolidBrush(st2RGB(GetWindow_bgBrush(ev->ev_hWnd),0));
  6538 		  HBRUSH br = CreateSolidBrush(st2RGB(GetWindow_bgBrush(ev->ev_hWnd),0));
  6307 		  if (br)
  6539 		  if (br)
  6308 		  {
  6540 		  {
  6309 		    rec.left = ev->ev_x;
  6541 		    rec.left = ev->ev_x;
  6310 		    rec.top = ev->ev_y;
  6542 		    rec.top = ev->ev_y;
  6311 		    rec.right = ev->ev_w;
  6543 		    rec.right = ev->ev_w;
  6312 		    rec.bottom = ev->ev_h;
  6544 		    rec.bottom = ev->ev_h;
  6313 		    printf("erase %d %d %d %d\n",rec.left,rec.top,rec.right,rec.bottom);
  6545 		    //printf("erase %d %d %d %d\n",rec.left,rec.top,rec.right,rec.bottom);
  6314 		    SelectClipRgn(dc,0);
  6546 		    SelectClipRgn(dc,0);
  6315 		    FillRect(dc, &rec, br);
  6547 		    FillRect(dc, &rec, br);
  6316 		    DelObject(br);
  6548 		    DelObject(br);
  6317 		  }
  6549 		  }
  6318 		  ReleaseDC(ev->ev_hWnd,dc);
  6550 		  ReleaseDC(ev->ev_hWnd,dc);
  6319 		}
  6551 		}
  6320 #endif
       
  6321 		x = ev->ev_x;
  6552 		x = ev->ev_x;
  6322 		y = ev->ev_y;
  6553 		y = ev->ev_y;
  6323 		w = ev->ev_w;
  6554 		w = ev->ev_w;
  6324 		h = ev->ev_h;
  6555 		h = ev->ev_h;
  6325 		/*printf("paint %x: %d %d %d %d\n",ev->ev_hWnd,x,y,w,h);*/
  6556 		/*printf("paint %x: %d %d %d %d\n",ev->ev_hWnd,x,y,w,h);*/
  6990 !
  7221 !
  6991 
  7222 
  6992 handleExposeOnlyFor:aView
  7223 handleExposeOnlyFor:aView
  6993     "from now on, handle expose events only"
  7224     "from now on, handle expose events only"
  6994 
  7225 
  6995     dispatchingExpose := aView id
  7226     "/ dispatchingExpose := aView id
       
  7227     'handleExposeOnlyFor: not yet implemented' printCR.
  6996 !
  7228 !
  6997 
  7229 
  6998 mappingChanged:what event:eB
  7230 mappingChanged:what event:eB
  6999     "One of Keyboard-, Modifier- or PointerMap has change, probably by xmodmap.
  7231     "One of Keyboard-, Modifier- or PointerMap has change, probably by xmodmap.
  7000      Tell xlib about the fact."
  7232      Tell xlib about the fact."
  7693 		    {
  7925 		    {
  7694 			cp += i1;
  7926 			cp += i1;
  7695 
  7927 
  7696 			prevFont = SelectObject(tmpDC, hFont);
  7928 			prevFont = SelectObject(tmpDC, hFont);
  7697 			GetTextExtentPoint32(tmpDC, cp, l, &tsize);
  7929 			GetTextExtentPoint32(tmpDC, cp, l, &tsize);
  7698 #ifdef DEBUG
  7930 #ifdef xxDEBUG
  7699 			if (__debug__)
  7931 			if (__debug__)
  7700 			{
  7932 			{
  7701 			  char buf[80];
  7933 			  char buf[80];
  7702 			  GetTextFace(tmpDC,80,buf);
  7934 			  GetTextFace(tmpDC,80,buf);
  7703 			  printf("font1 %x %s >%s< l=%d dx=%d\n",hFont,buf,cp,l,tsize.cx);
  7935 			  printf("font1 %x %s >%s< l=%d dx=%d\n",hFont,buf,cp,l,tsize.cx);
  7717 		    {
  7949 		    {
  7718 			cp += i1;
  7950 			cp += i1;
  7719 
  7951 
  7720 			prevFont = SelectObject(tmpDC, hFont);
  7952 			prevFont = SelectObject(tmpDC, hFont);
  7721 			GetTextExtentPoint32(tmpDC, cp, l, &tsize);
  7953 			GetTextExtentPoint32(tmpDC, cp, l, &tsize);
  7722 #ifdef DEBUG
  7954 #ifdef xxDEBUG
  7723 			if (__debug__)
  7955 			if (__debug__)
  7724 			{
  7956 			{
  7725 			  char buf[80];
  7957 			  char buf[80];
  7726 			  GetTextFace(tmpDC,80,buf);
  7958 			  GetTextFace(tmpDC,80,buf);
  7727 			  printf("font1 %x %s >%s< l=%d dx=%d\n",hFont,buf,cp,l,tsize.cx);
  7959 			  printf("font1 %x %s >%s< l=%d dx=%d\n",hFont,buf,cp,l,tsize.cx);
  7772 #if 1
  8004 #if 1
  7773 	  if (hWnd == __rootWin)
  8005 	  if (hWnd == __rootWin)
  7774 	  {
  8006 	  {
  7775 	     hWnd = __rootWinSpezial;
  8007 	     hWnd = __rootWinSpezial;
  7776 	     ShowWindow(hWnd,SW_SHOWNOACTIVATE);
  8008 	     ShowWindow(hWnd,SW_SHOWNOACTIVATE);
  7777 	     SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSENDCHANGING|SWP_NOOWNERZORDER|SWP_NOACTIVATE | SWP_NOMOVE|SWP_NOSIZE);
  8009              //EnableWindow(hWnd,TRUE);
       
  8010 	     SetWindowPos(hWnd, HWND_TOP,
       
  8011               0, 0, 0, 0,SWP_NOREDRAW|SWP_NOSENDCHANGING|SWP_NOCOPYBITS
       
  8012               |SWP_NOACTIVATE |SWP_NOMOVE|SWP_NOSIZE);
  7778 	     CPRINTF(("setRootCapture %x\n",hWnd));
  8013 	     CPRINTF(("setRootCapture %x\n",hWnd));
  7779 	  }
  8014 	  }
  7780 #endif
  8015 #endif
  7781 	  if (__isExternalAddress(aCursorId))
  8016 	  if (__isExternalAddress(aCursorId))
  7782 	  {
  8017 	  {
  8343 	    DPRINTF(("RegisterClass failed\n"));
  8578 	    DPRINTF(("RegisterClass failed\n"));
  8344     /*            return NULL;     */
  8579     /*            return NULL;     */
  8345 	}
  8580 	}
  8346 
  8581 
  8347 	wc.style = 0;
  8582 	wc.style = 0;
  8348 	wc.lpfnWndProc = (WNDPROC) MainWndProcRoot;
  8583 	wc.lpfnWndProc = (WNDPROC) MainWndProc;// Root;
  8349 	wc.cbClsExtra = 0;
  8584 	wc.cbClsExtra = 0;
  8350 	wc.cbWndExtra = N_WINDOW_PRIVATE;
  8585 	wc.cbWndExtra = N_WINDOW_PRIVATE;
  8351 	wc.hInstance = (HANDLE) __getHInstance();
  8586 	wc.hInstance = (HANDLE) __getHInstance();
  8352 	wc.hIcon = NULL;
  8587 	wc.hIcon = NULL;
  8353 	wc.hCursor = 0;
  8588 	wc.hCursor = 0;
  8771      shiftMask/controlMask and modifierMask methods for the meaning of the bits."
  9006      shiftMask/controlMask and modifierMask methods for the meaning of the bits."
  8772 
  9007 
  8773     |s |
  9008     |s |
  8774 
  9009 
  8775 %{
  9010 %{
  8776     s = __MKSMALLINT(__modifiers);
  9011     int modifiers = 0;
       
  9012     int b1m = Button1Mask;
       
  9013     int b3m = Button3Mask;
       
  9014     if (GetSystemMetrics(SM_SWAPBUTTON))
       
  9015     {
       
  9016       b3m = Button1Mask;
       
  9017       b1m = Button3Mask;
       
  9018     }
       
  9019 
       
  9020     if (GetAsyncKeyState(VK_LBUTTON) & 0x8000)
       
  9021 	modifiers |= b1m;
       
  9022     if (GetAsyncKeyState(VK_MBUTTON) & 0x8000)
       
  9023 	modifiers |= Button2Mask;
       
  9024     if (GetAsyncKeyState(VK_RBUTTON) & 0x8000)
       
  9025 	modifiers |= b3m;
       
  9026 
       
  9027     s = __MKSMALLINT(modifiers);
  8777 %}.
  9028 %}.
  8778     ^ s
  9029     ^ s
  8779 
  9030 
  8780     "
  9031     "
  8781      Display buttonStates
  9032      Display buttonStates
  9418 	    CPRINTF(("mapView %x x:%d y:%d w:%d h:%d -> x:%d y:%d w:%d h:%d\n",win,__intVal(x),__intVal(y),__intVal(w),__intVal(h),rec.left,rec.top,
  9669 	    CPRINTF(("mapView %x x:%d y:%d w:%d h:%d -> x:%d y:%d w:%d h:%d\n",win,__intVal(x),__intVal(y),__intVal(w),__intVal(h),rec.left,rec.top,
  9419 			 rec.right - rec.left, rec.bottom - rec.top));
  9670 			 rec.right - rec.left, rec.bottom - rec.top));
  9420 	    SetWindowPos(win, (HWND)0,
  9671 	    SetWindowPos(win, (HWND)0,
  9421 			 rec.left, rec.top,
  9672 			 rec.left, rec.top,
  9422 			 rec.right - rec.left, rec.bottom - rec.top,
  9673 			 rec.right - rec.left, rec.bottom - rec.top,
  9423 			 SWP_NOACTIVATE | SWP_NOZORDER);
  9674 			 SWP_NOSENDCHANGING|SWP_NOACTIVATE | SWP_NOZORDER|SWP_NOOWNERZORDER);
  9424 	    if (aBoolean == true)
  9675 	    if (aBoolean == true)
  9425 	    {
  9676 	    {
  9426 	      ShowWindow(win, SW_SHOWMINIMIZED);
  9677 	      ShowWindow(win, SW_SHOWMINIMIZED);
  9427 	      enqEvent(0,win, WM_SHOWWINDOW, FALSE, 0, 0, 0, 0);
  9678 	      enqEvent(0,win, WM_SHOWWINDOW, FALSE, 0, 0, 0, 0);
  9428 	    }
  9679 	    }
  9429 	    else
  9680 	    else
  9430 	    {
  9681 	    {
  9431 	      enqEvent(0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0);
  9682 	      enqEvent(0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0);
  9432 	      ShowWindow(win, SW_RESTORE);
  9683 	      //ShowWindow(win, SW_RESTORE);
  9433 	      /*ShowWindow(win, SW_SHOW);*/
  9684 	      ShowWindow(win, SW_SHOWNOACTIVATE);
  9434 	    }
  9685 	    }
  9435 	}
  9686 	}
  9436 	RETURN ( self );
  9687 	RETURN ( self );
  9437     }
  9688     }
  9438 %}
  9689 %}
  9448 
  9699 
  9449 	if (win) {
  9700 	if (win) {
  9450 	    CPRINTF(("mapWindow %x\n",win));
  9701 	    CPRINTF(("mapWindow %x\n",win));
  9451 	    ShowWindow(win, SW_SHOWNOACTIVATE);
  9702 	    ShowWindow(win, SW_SHOWNOACTIVATE);
  9452 	    //ShowWindow(win, SW_SHOW);
  9703 	    //ShowWindow(win, SW_SHOW);
  9453 	    //SetWindowPos(_thread_newWinHandle, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|/*SWP_NOACTIVATE|*/SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
  9704 	    SetWindowPos(win, HWND_TOP, 0, 0, 0, 0, SWP_NOSENDCHANGING|/*SWP_SHOWWINDOW|*/SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE/*|SWP_NOZORDER|SWP_NOOWNERZORDER */	);
  9454 	    //enqEvent(0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0);
  9705 	    //enqEvent(0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0);
  9455 	}
  9706 	}
  9456 	RETURN ( self );
  9707 	RETURN ( self );
  9457     }
  9708     }
  9458 %}
  9709 %}
  9466     if (__isExternalAddress(aWindowId)) {
  9717     if (__isExternalAddress(aWindowId)) {
  9467 	HWND win = _HWNDVal(aWindowId);
  9718 	HWND win = _HWNDVal(aWindowId);
  9468 
  9719 
  9469 	if (win) {
  9720 	if (win) {
  9470 	    CPRINTF(("activateWindow %x\n",win));
  9721 	    CPRINTF(("activateWindow %x\n",win));
  9471             ShowWindowAsync(win, SW_SHOW | SW_SHOWNORMAL);
  9722 	    ShowWindowAsync(win, SW_SHOW | SW_SHOWNORMAL);
  9472 	    //ShowWindow(win, SW_SHOW);
  9723 	    //ShowWindow(win, SW_SHOW);
  9473 	    //SetWindowPos(_thread_newWinHandle, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|/*SWP_NOACTIVATE|*/SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
  9724 	    //SetWindowPos(_thread_newWinHandle, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|/*SWP_NOACTIVATE|*/SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
  9474 	    //enqEvent(0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0);
  9725 	    //enqEvent(0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0);
  9475 	}
  9726 	}
  9476 	RETURN ( self );
  9727 	RETURN ( self );
  9500 	    CPRINTF(("moveresize %x x:%d y:%d w:%d h:%d -> x:%d y:%d w:%d h:%d\n",win,__intVal(x),__intVal(y),__intVal(w),__intVal(h),rec.left,rec.top,
  9751 	    CPRINTF(("moveresize %x x:%d y:%d w:%d h:%d -> x:%d y:%d w:%d h:%d\n",win,__intVal(x),__intVal(y),__intVal(w),__intVal(h),rec.left,rec.top,
  9501 			 rec.right - rec.left, rec.bottom - rec.top));
  9752 			 rec.right - rec.left, rec.bottom - rec.top));
  9502 	    SetWindowPos(win, (HWND)0,
  9753 	    SetWindowPos(win, (HWND)0,
  9503 			 rec.left, rec.top,
  9754 			 rec.left, rec.top,
  9504 			 rec.right - rec.left, rec.bottom - rec.top,
  9755 			 rec.right - rec.left, rec.bottom - rec.top,
  9505 			 SWP_NOACTIVATE | SWP_NOZORDER);
  9756 			 SWP_NOSENDCHANGING|SWP_NOACTIVATE | SWP_NOZORDER|SWP_NOOWNERZORDER);
  9506 	}
  9757 	}
  9507 	RETURN ( self );
  9758 	RETURN ( self );
  9508     }
  9759     }
  9509 %}
  9760 %}
  9510 !
  9761 !
  9530 #endif
  9781 #endif
  9531 	    CPRINTF(("move %x x:%d y:%d -> x:%d y:%d\n",win,__intVal(x),__intVal(y),rec.left,rec.top));
  9782 	    CPRINTF(("move %x x:%d y:%d -> x:%d y:%d\n",win,__intVal(x),__intVal(y),rec.left,rec.top));
  9532 	    SetWindowPos(win, (HWND)0,
  9783 	    SetWindowPos(win, (HWND)0,
  9533 			 rec.left, rec.top,
  9784 			 rec.left, rec.top,
  9534 			 0, 0,
  9785 			 0, 0,
  9535 			 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
  9786 			 SWP_NOSENDCHANGING|SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER|SWP_NOOWNERZORDER);
  9536 	}
  9787 	}
  9537 	RETURN ( self );
  9788 	RETURN ( self );
  9538     }
  9789     }
  9539 %}
  9790 %}
  9540 !
  9791 !
  9626     if (__isExternalAddress(aWindowId)) {
  9877     if (__isExternalAddress(aWindowId)) {
  9627 	HWND hWnd = _HWNDVal(aWindowId);
  9878 	HWND hWnd = _HWNDVal(aWindowId);
  9628 
  9879 
  9629 	if (hWnd) {
  9880 	if (hWnd) {
  9630 	    CPRINTF(("raiseWindow %x\n",hWnd));
  9881 	    CPRINTF(("raiseWindow %x\n",hWnd));
  9631 	    SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOOWNERZORDER  |SWP_NOACTIVATE | SWP_NOMOVE|SWP_NOSIZE);
  9882 	    SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, /*SWP_NOOWNERZORDER  |*/SWP_NOSENDCHANGING|SWP_NOACTIVATE | SWP_NOMOVE|SWP_NOSIZE);
  9632 	}
  9883 	}
  9633 	RETURN ( self );
  9884 	RETURN ( self );
  9634     }
  9885     }
  9635 %}
  9886 %}
  9636 !
  9887 !
  9655 #endif
  9906 #endif
  9656 	    CPRINTF(("resize %x w:%d h:%d -> w:%d h:%d\n",hWnd,__intVal(w),__intVal(h),rec.right - rec.left, rec.bottom - rec.top));
  9907 	    CPRINTF(("resize %x w:%d h:%d -> w:%d h:%d\n",hWnd,__intVal(w),__intVal(h),rec.right - rec.left, rec.bottom - rec.top));
  9657 	    SetWindowPos(hWnd, (HWND)0,
  9908 	    SetWindowPos(hWnd, (HWND)0,
  9658 			 0, 0,
  9909 			 0, 0,
  9659 			 rec.right - rec.left, rec.bottom - rec.top,
  9910 			 rec.right - rec.left, rec.bottom - rec.top,
  9660 			 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
  9911 			 SWP_NOSENDCHANGING|SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER|SWP_NOOWNERZORDER);
  9661 	}
  9912 	}
  9662 	RETURN ( self );
  9913 	RETURN ( self );
  9663     }
  9914     }
  9664 %}
  9915 %}
  9665 !
  9916 !
  9847 
 10098 
  9848     if (__isExternalAddress(aWindowId)) {
 10099     if (__isExternalAddress(aWindowId)) {
  9849 	HWND win = _HWNDVal(aWindowId);
 10100 	HWND win = _HWNDVal(aWindowId);
  9850 
 10101 
  9851 	if (win) {
 10102 	if (win) {
       
 10103 	    CPRINTF(("unmapWindow %x\n",win));
  9852 	    ShowWindow(win, SW_HIDE);
 10104 	    ShowWindow(win, SW_HIDE);
  9853 	    CPRINTF(("unmapWindow %x\n",win));
 10105 	    CPRINTF(("unmapWindow1 %x\n",win));
  9854 	    //enqEvent(win, WM_SHOWWINDOW, FALSE, 0, 0, 0, 0);
 10106 	    //enqEvent(win, WM_SHOWWINDOW, FALSE, 0, 0, 0, 0);
  9855 	}
 10107 	}
  9856 	RETURN ( self );
 10108 	RETURN ( self );
  9857     }
 10109     }
  9858 %}
 10110 %}
  9859 ! !
 10111 ! !
  9860 
 10112 
  9861 !WinWorkstation class methodsFor:'documentation'!
 10113 !WinWorkstation class methodsFor:'documentation'!
  9862 
 10114 
  9863 version
 10115 version
  9864     ^ '$Header: /cvs/stx/stx/libview/Attic/WinWorkstat.st,v 1.43 1998-08-17 09:55:10 cg Exp $'
 10116     ^ '$Header: /cvs/stx/stx/libview/Attic/WinWorkstat.st,v 1.44 1998-08-19 14:21:21 cg Exp $'
  9865 ! !
 10117 ! !
  9866 WinWorkstation initialize!
 10118 WinWorkstation initialize!