Changeset 269 for trunk/src/3rdparty/os2/xsystray
- Timestamp:
- Oct 30, 2009, 2:27:42 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/os2/xsystray/xsystray.c
r268 r269 133 133 typedef struct 134 134 { 135 136 135 137 LONG lIconWidth; 136 138 // system icon width in px … … 148 150 } SYSTRAYDATA, *PSYSTRAYDATA; 149 151 152 153 154 155 150 156 static ULONG QWL_USER_SERVER_DATA = 0; 151 157 // offset to the PXCENTERWIDGET pointer in the widget data array … … 303 309 pData->pszToolTip = NULL; 304 310 } 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 305 341 } 306 342 … … 492 528 */ 493 529 530 494 531 MRESULT EXPENTRY fnwpXSysTray(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 495 532 { … … 539 576 pSysTrayData->lIconHeight = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) / 2; 540 577 pSysTrayData->lIconPad = pSysTrayData->lIconHeight / 8; 541 pSysTrayData->cIconsMax = 4;578 pSysTrayData->cIconsMax = ; 542 579 pSysTrayData->pIcons = malloc(sizeof(*pSysTrayData->pIcons) * 543 580 pSysTrayData->cIconsMax); … … 548 585 } 549 586 pSysTrayData->cIcons = 0; 550 pWidget->pUser = pSysTrayData;551 587 552 588 // create the "server" window (note that we pass the XCENTERWIDGET 553 589 // pointer on to it) 554 HWNDhwndServer =590 hwndServer = 555 591 WinCreateWindow(HWND_DESKTOP, WNDCLASS_WIDGET_XSYSTRAY_SERVER, 556 592 NULL, WS_MINIMIZED, … … 558 594 HWND_DESKTOP, HWND_BOTTOM, 559 595 0, mp1, NULL); 560 if (hwndServer == NULLHANDLE) 596 if (pSysTrayData->hwndServer == NULLHANDLE) 597 { 598 free(pSysTrayData->pIcons); 599 free(pSysTrayData); 561 600 break; 601 602 603 562 604 563 605 mrc = FALSE; // confirm success … … 623 665 624 666 /* 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 625 700 *@@ WgtXSysTrayControl: 626 701 * implementation for WM_XST_CONTROL in fnwpXSysTrayServer. … … 659 734 POINTERINFO Info; 660 735 HPOINTER hIcon = NULLHANDLE; 736 737 661 738 662 739 LOGF(("SYSTRAYCMD_ADDICON\n")); 663 LOGF(("hIcon %x\n", pCtlData->u.icon.hIcon)); 740 LOGF((" hwnd %x\n", pCtlData->hwndSender)); 741 LOGF((" ulId %ld\n", pCtlData->u.icon.ulId)); 742 LOGF((" hIcon %x\n", pCtlData->u.icon.hIcon)); 664 743 665 744 pCtlData->bAcknowledged = TRUE; … … 677 756 } 678 757 679 // @todo just testing.... 680 if (pSysTrayData->pIcons[0].hIcon != NULLHANDLE) 681 WinDestroyPointer(pSysTrayData->pIcons[0].hIcon); 682 pSysTrayData->cIcons = 1; 683 pSysTrayData->pIcons[0].hwnd = pCtlData->hwndSender; 684 pSysTrayData->pIcons[0].ulId = pCtlData->u.icon.ulId; 685 pSysTrayData->pIcons[0].hIcon = hIcon; 686 pSysTrayData->pIcons[0].ulMsgId = pCtlData->u.icon.ulMsgId; 687 688 // ask XCenter to take our new size into account 689 // (this will also invalidate us) 690 WinPostMsg(pWidget->pGlobals->hwndClient, 691 XCM_REFORMAT, 692 (MPARAM)XFMF_GETWIDGETSIZES, 693 0); 694 695 if (pSysTrayData->cIcons == 1) 758 pData = FindIconData(pSysTrayData, pCtlData->hwndSender, 759 pCtlData->u.icon.ulId, &i); 760 if (pData) 696 761 { 697 // start a timer to perform "is window alive" checks 698 WinStartTimer(pWidget->habWidget, hwnd, 699 TID_CHECKALIVE, 700 TID_CHECKALIVE_TIMEOUT); 762 LOGF((" Updating hIcon %x\n", hIcon)); 763 764 WinDestroyPointer(pData->hIcon); 765 pData->hIcon = hIcon; 766 pData->ulMsgId = pCtlData->u.icon.ulMsgId; 767 768 // we didn't change the number of icons so simply invalidate 769 WinInvalidateRect(pWidget->hwndWidget, NULL, FALSE); 701 770 } 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 702 806 703 807 brc = TRUE; 704 808 } 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 705 846 706 847 default: … … 735 876 if (!WinIsWindow(pWidget->habWidget, pSysTrayData->pIcons[i].hwnd)) 736 877 { 878 879 880 881 882 737 883 bAnyDead = TRUE; 738 884 FreeIconData(&pSysTrayData->pIcons[i]); … … 761 907 } 762 908 763 if (pSysTrayData->cIcons == 0) 764 { 765 // stop the check alive timer 766 WinStopTimer(pWidget->habWidget, hwnd, 767 TID_CHECKALIVE); 768 } 769 770 // ask XCenter to take our new size into account 771 // (this will also invalidate us) 772 WinPostMsg(pWidget->pGlobals->hwndClient, 773 XCM_REFORMAT, 774 (MPARAM)XFMF_GETWIDGETSIZES, 775 0); 909 WgtXSysTrayUpdateAfterIconAddRemove(pWidget); 776 910 } 777 911 }
Note:
See TracChangeset
for help on using the changeset viewer.