Changeset 1871 for trunk/dll/flesh.c
- Timestamp:
- Sep 21, 2015, 12:57:02 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/dll/flesh.c (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/flesh.c
r1867 r1871 37 37 19 Aug 15 SHL Allow WaitFleshWorkListEmpty to wait for dependent items 38 38 23 Aug 15 GKY Fixed code to notify on drive with no subdirectories in first 64 entries 39 20 Sep 15 GKY Add code for Flesh to skip the directory entry added by Stubby (eliminate 40 use of NULL/Nullstr pszFileNames by Stubby). Add code in Stubby to insert a 41 complete container item. Add a flag to indicate when a directory needed to be 42 Fleshed 39 43 40 44 ***********************************************************************/ … … 69 73 #include "listutil.h" // List... 70 74 #include "common.h" // IncrThreadUsage DecrThreadUsage 71 75 #include "pathutil.h" 72 76 #if 0 73 77 #define __PMPRINTF__ … … 84 88 85 89 static PCSZ pszFleshFocusPath; // 2015-08-20 SHL 86 90 #if 0 87 91 BOOL fNoFleshDbgMsg; // 2015-08-09 SHL FIXME to be gone 88 92 #endif 89 93 #pragma data_seg(GLOBAL1) 90 94 ULONG NoBrokenNotify; … … 189 193 ri.cRecordsInsert = 1; 190 194 ri.fInvalidateRecord = FALSE; 191 // 2015-08-03 SHL FIXME debug195 #if 0 // 2015-08-03 SHL FIXME debug 192 196 if (pciL->pszFileName == NullStr) 193 197 DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD pci %p pszFileName \"%s\"", pciL, pciL->pszFileName); // 2015-08-03 SHL FIXME debug 194 if (!WinSendMsg(hwndCnr, 198 #endif 199 if (!WinSendMsg(hwndCnr, 195 200 CM_INSERTRECORD, MPFROMP(pciL), MPFROMP(&ri))) 196 201 FreeCnrItem(hwndCnr, pciL); … … 238 243 return FALSE; 239 244 240 // 2015-08-03 SHL FIXME debug245 #if 0 // 2015-08-03 SHL FIXME debug 241 246 if (!fNoFleshDbgMsg) { 242 247 DbgMsg(pszSrcFile, __LINE__, "Flesh %s pciParent %p pszFileName %p", … … 246 251 pciParent && (INT)pciParent != -1 ? pciParent->pszFileName : (PVOID)-1); // 2015-08-03 SHL FIXME debug 247 252 } 248 249 pciL = (PCNRITEM)WinSendMsg(hwndCnr, 250 CM_QUERYRECORD, 251 MPFROMP(pciParent), 252 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); 253 253 #endif 254 254 // 2015-08-06 SHL allow pciL -1 255 255 // 2015-08-06 SHL FIXME to not need pszFileName check 256 if (!pciL || (INT)pciL == -1 || !*pciL->pszFileName || !strcmp(pciL->pszFileName, NullStr)) { 257 256 if (!pciParent->fleshed) { 257 pciL = (PCNRITEM)WinSendMsg(hwndCnr, 258 CM_QUERYRECORD, 259 MPFROMP(pciParent), 260 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); 258 261 // No children or filename null 259 262 if (pciL && (INT)pciL != -1) { 263 AddFleshWorkRequest(hwndCnr, pciL, eStubby); 260 264 // 2015-08-06 SHL FIXME to ensure this an not happen 261 // if (!*pciL->pszFileName)262 //Runtime_Error(pszSrcFile, __LINE__, "Flesh called with pci %p pszFileName (null)", pciL);263 265 if (!*pciL->pszFileName || !strcmp(pciL->pszFileName, NullStr)) 266 Runtime_Error(pszSrcFile, __LINE__, "Flesh called with pci %p pszFileName (null)", pciL); 267 #if 0 264 268 if (!fNoFleshDbgMsg) 265 269 DbgMsg(pszSrcFile, __LINE__, "Flesh RemoveCnrItems() pciL %p \"%s\"", … … 267 271 pciL->pszFileName ? pciL->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug 268 272 // Assume refernces to pciL already removed from work list 269 RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE); 270 } 271 273 #endif 274 } 272 275 dcd = INSTDATA(hwndCnr); 273 276 if (dcd && dcd->size != sizeof(DIRCNRDATA)) … … 287 290 dcd, 288 291 NULL, // total files 289 NULL); // total bytes 292 NULL, // total bytes 293 (pciL && (INT)pciL != -1) ? pciL->pszDisplayName : 0); 294 pciParent->fleshed = TRUE; 290 295 return TRUE; 291 296 } … … 306 311 if (!pciParent || !hwndCnr) 307 312 return; 308 313 #if 0 309 314 if (!fNoFleshDbgMsg) 310 315 DbgMsg(pszSrcFile, __LINE__, "UnFlesh pciParent %p pszFileName \"%s\"", pciParent, pciParent->pszFileName ? pciParent->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug 311 316 #endif 312 317 for (;;) { 313 318 pciL = (PCNRITEM)WinSendMsg(hwndCnr, … … 317 322 if (!pciL || (INT)pciL == -1) 318 323 break; // Done 319 324 #if 0 320 325 if (!fNoFleshDbgMsg) 321 326 DbgMsg(pszSrcFile, __LINE__, "UnFlesh RemoveCnrItems() pciL %p \"%s\"", pciL, pciL->pszFileName ? pciL->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug 327 #endif 322 328 RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE); 323 329 removed = TRUE; … … 328 334 CM_INVALIDATERECORD, 329 335 MPFROMP(&pciParent), 330 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION)); 336 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION)); 337 pciParent->fleshed = FALSE; 338 DosSleep(1); // Let container items go away 331 339 } 332 340 return; … … 368 376 static BOOL brokenlan = FALSE, isbroken = FALSE; 369 377 378 //DbgMsg(pszSrcFile, __LINE__,"Stubby pciParent %p", pciParent); 370 379 if (!pciParent || (INT)pciParent == -1 || !*pciParent->pszFileName 371 380 || pciParent->pszFileName == NullStr || !hwndCnr) 372 381 return FALSE; 373 382 #if 0 374 383 if (!fNoFleshDbgMsg) 375 384 DbgMsg(pszSrcFile, __LINE__, "Stubby pciParent %p pszFileName %s", pciParent, pciParent->pszFileName); // 2015-08-03 SHL FIXME debug 376 385 #endif 377 386 // Build wildcard 378 387 len = strlen(pciParent->pszFileName); … … 386 395 if (!isalpha(*wildcard) || wildcard[1] != ':' || wildcard[2] != '\\') { 387 396 MakeFullName(wildcard); 388 DbgMsg(pszSrcFile, __LINE__, "Stubby MakeFullName returned %s", wildcard); // 2015-08-19 SHL FIXME debug 389 } 390 397 //DbgMsg(pszSrcFile, __LINE__, "Stubby MakeFullName returned %s", wildcard); // 2015-08-19 SHL FIXME debug 398 } 391 399 drvNum = toupper(*pciParent->pszFileName) - 'A'; 392 400 flags = driveflags[drvNum]; … … 421 429 fl = includefiles ? FILE_DIRECTORY : MUST_HAVE_DIRECTORY; 422 430 423 DbgMsg(pszSrcFile, __LINE__, "Stubby DosFindFirst(%s)", wildcard); // 2015-08-19 SHL FIXME debug431 //DbgMsg(pszSrcFile, __LINE__, "Stubby DosFindFirst(%s)", wildcard); // 2015-08-19 SHL FIXME debug 424 432 425 433 rc = DosFindFirst(wildcard, … … 495 503 goto None; // Done 496 504 } 497 498 499 505 if (!rc) { 500 506 DosFindClose(hDir); … … 539 545 (pffb->achName[1] != '.' || pffb->achName[2])))) 540 546 { 541 // Got directory other than . or .. (or a file)547 // Got directory other than . or .. (or a file) 542 548 isadir = TRUE; 543 549 break; … … 562 568 } 563 569 else { 564 RECORDINSERT ri; 565 // 2015-08-19 SHL FIXME to use BldFullPathName(wildcard, ...) 566 pci->pszFileName = NullStr; // 2015-08-19 SHL FIXME to doc why 567 pci->pszDisplayName = NullStr; 568 pci->rc.pszIcon = pci->pszDisplayName; 570 RECORDINSERT ri; 571 CHAR szBuffer[CCHMAXPATH + 14]; 572 CHAR *p; 573 HPOINTER hptr; 574 575 p = strchr(wildcard, '*'); 576 *p = 0;; 577 BldFullPathName(szBuffer, wildcard, pffb->achName); 578 pci->pszFileName = xstrdup(szBuffer, pszSrcFile, __LINE__); //NullStr; // 2015-08-19 SHL FIXME to doc why 579 p = strrchr(pci->pszFileName, '\\'); 580 p++; 581 pci->pszDisplayName = p; //NullStr; 582 pci->rc.pszIcon = pci->pszDisplayName; 583 if (fForceUpper) 584 strupr(pci->pszFileName); 585 else if (fForceLower) 586 strlwr(pci->pszFileName); 587 588 flags = driveflags[toupper(*pci->pszFileName) - 'A']; 589 590 // get an icon to use with it 591 if (pffb->attrFile & FILE_DIRECTORY) { 592 // is directory 593 if (fNoIconsDirs || 594 (flags & DRIVE_NOLOADICONS) || 595 !isalpha(*pci->pszFileName)) { 596 hptr = (HPOINTER) 0; 597 } 598 else 599 hptr = WinLoadFileIcon(pci->pszFileName, FALSE); 600 } 601 else { 602 // is file 603 if (fNoIconsFiles || 604 (flags & DRIVE_NOLOADICONS) || 605 !isalpha(*pci->pszFileName)) { 606 hptr = (HPOINTER) 0; 607 } 608 else 609 hptr = WinLoadFileIcon(pci->pszFileName, FALSE); 610 611 if (!hptr || IsDefaultIcon(hptr)) 612 hptr = IDFile(pci->pszFileName); 613 } 614 615 if (!hptr) { 616 hptr = pffb->attrFile & FILE_DIRECTORY ? 617 hptrDir : pffb->attrFile & FILE_SYSTEM ? 618 hptrSystem : pffb->attrFile & FILE_HIDDEN ? 619 hptrHidden : pffb->attrFile & FILE_READONLY ? 620 hptrReadonly : hptrFile; 621 } 622 pci->rc.hptrIcon = hptr; 569 623 memset(&ri, 0, sizeof(RECORDINSERT)); 570 624 ri.cb = sizeof(RECORDINSERT); … … 574 628 ri.cRecordsInsert = 1; 575 629 ri.fInvalidateRecord = TRUE; 576 // 2015-08-03 SHL FIXME debug630 #if 0 // 2015-08-03 SHL FIXME debug 577 631 if (pci->pszFileName == NullStr) 578 632 DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD %p \"%s\" %.255s", pci, pci->pszFileName, pffb->achName); 579 if (!WinSendMsg(hwndCnr, 633 #endif 634 if (!WinSendMsg(hwndCnr, 580 635 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { 581 636 // Assume busy and try again 582 637 DosSleep(50); //05 Aug 07 GKY 100 583 638 WinSetFocus(HWND_DESKTOP, hwndCnr); 584 if (WinIsWindow((HAB)0, hwndCnr)) { 639 if (WinIsWindow((HAB)0, hwndCnr)) { 640 #if 0 585 641 if (!fNoFleshDbgMsg) { 586 // 2015-08-03 SHL FIXME debug 587 if (pci->pszFileName == NullStr) 588 DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD pci %p pszFileName \"%s\"", pci, pci->pszFileName); // 2015-08-03 SHL FIXME debug 589 } 642 // 2015-08-03 SHL FIXME debug 643 //if (pci->pszFileName == NullStr) 644 // DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD pci %p pszFileName \"%s\"", pci, pci->pszFileName); // 2015-08-03 SHL FIXME debug 645 } 646 #endif 590 647 if (!WinSendMsg(hwndCnr, 591 648 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { … … 594 651 FreeCnrItem(hwndCnr, pci); 595 652 } 596 else653 else 597 654 ok = TRUE; 598 655 } … … 670 727 if (!item) 671 728 break; 672 DbgMsg(pszSrcFile, __LINE__, "DeleteStaleFleshWorkListItems deleting %p %s", pci, pci->pszFileName ? pci->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug729 //DbgMsg(pszSrcFile, __LINE__, "DeleteStaleFleshWorkListItems deleting %p %s", pci, pci->pszFileName ? pci->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug 673 730 List2Delete(&FleshWorkList, item); 674 731 xfree(item, pszSrcFile, __LINE__); … … 815 872 return; // Avoid hang 816 873 } 874 #if 0 817 875 else if (IsFleshWorkListEmpty()) { 818 876 # ifdef WaitFleshWorkListEmpty … … 822 880 # endif 823 881 } 882 #endif 824 883 825 884 // Can not wait if call from thread 1 or FleshWorkListThread … … 859 918 if (!item) { 860 919 if (waited) 861 DosSleep( 250); // Let PM do some work920 DosSleep(100); // Let PM do some work 862 921 break; // Dependents gone from work list 863 922 } … … 889 948 if (pszOld) 890 949 xfree((PVOID)pszOld, pszSrcFile, __LINE__); 891 DbgMsg(pszSrcFile, __LINE__, "SetFleshFocusPath focus path set to %s", pszFleshFocusPath); // 2015-08-03 SHL FIXME debug950 //DbgMsg(pszSrcFile, __LINE__, "SetFleshFocusPath focus path set to %s", pszFleshFocusPath); // 2015-08-03 SHL FIXME debug 892 951 893 952 } … … 948 1007 // Wait for new items to be added to list 949 1008 if (!item) { 950 ULONG ul; 1009 ULONG ul; 1010 #if 0 951 1011 if (!fNoFleshDbgMsg) 952 1012 DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread work list empty - waiting"); // 2015-08-03 SHL FIXME debug 953 xDosWaitEventSem(hevFleshWorkListChanged, SEM_INDEFINITE_WAIT); 954 xDosResetEventSem(hevFleshWorkListChanged, &ul); 1013 #endif 1014 xDosWaitEventSem(hevFleshWorkListChanged, SEM_INDEFINITE_WAIT); 1015 xDosResetEventSem(hevFleshWorkListChanged, &ul); 1016 #if 0 955 1017 if (!fNoFleshDbgMsg) 956 1018 DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread work hev posted"); // 2015-08-03 SHL FIXME debug 957 continue; 1019 #endif 1020 continue; 958 1021 } 959 1022 960 if (WinIsWindow((HAB)0, item->hwndCnr)) { 961 #if 0 // 2015-08-07 SHL FIXME debug 962 // 2015-08-03 SHL FIXME debug 1023 if (WinIsWindow((HAB)0, item->hwndCnr)) { 1024 #if 0 // 2015-08-07 SHL FIXME debug 963 1025 { 964 1026 static PSZ itemNames[] = { … … 979 1041 980 1042 switch (item->action) { 981 case eUnFlesh:982 UnFlesh(item->hwndCnr, item->pci);1043 case eUnFlesh: 1044 UnFlesh(item->hwndCnr, item->pci); 983 1045 break; 984 1046 case eFleshEnv: … … 987 1049 case eStubby: 988 1050 // DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread pci %p pszFileName %s", stubbyArgs->pci, stubbyArgs->pci->pszFileName); // 2015-08-03 SHL FIXME debug 989 Stubby(item->hwndCnr, item->pci); 1051 priority_bumped(); 1052 Stubby(item->hwndCnr, item->pci); 1053 priority_normal(); 990 1054 break; 991 1055 case eFlesh: … … 1041 1105 if (rc) 1042 1106 return FALSE; // Give up 1043 1044 /*DbgMsg is time consuming1107 #if 0 1108 /*DbgMsg is time consuming 1045 1109 define FM2_NO_FLESH_DBGMSG to suppress 1046 1110 2015-08-09 SHL FIXME to be gone 1047 */1111 */ 1048 1112 1049 1113 fNoFleshDbgMsg = getenv("FM2_NO_FLESH_DBGMSG") != NULL; 1050 1114 #endif 1051 1115 tidFleshWorkListThread = xbeginthread(FleshWorkThread, 1052 1116 65536,
Note:
See TracChangeset
for help on using the changeset viewer.
