- Timestamp:
- Oct 30, 2009, 1:06:49 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/os2/xsystray/xsystray.c
r265 r268 152 152 153 153 #define TID_CHECKALIVE 1 154 // check alive timer155 #define TID_CHECKALIVE_TIMEOUT 1000 // ms156 // how often to check if windows associated with icons are still alive154 // timer that checks if windows associated with icons are still alive 155 #define TID_CHECKALIVE_TIMEOUT 2000 // ms 156 // how often to perform alive checks 157 157 158 158 /* ****************************************************************** … … 210 210 */ 211 211 212 // @todo the function declarations should become not necessary when we move into 213 // XWorkplace. Let's hope the prototypes will not change until then. Let's also 214 // pray that XFLDRxxx.DLL has the _Optlink calling convention for exports and 215 // not the default __cdecl (which happens if it builds with GCC according to the 216 // XWPENTRY definition in the current xwphelpers sources) 217 218 #define XWPENTRY _Optlink 219 220 typedef VOID XWPENTRY GPIHDRAW3DFRAME(HPS hps, 221 PRECTL prcl, 222 USHORT usWidth, 223 LONG lColorLeft, 224 LONG lColorRight); 225 typedef GPIHDRAW3DFRAME *PGPIHDRAW3DFRAME; 226 PGPIHDRAW3DFRAME pgpihDraw3DFrame = NULL; 227 228 typedef struct _RESOLVEFUNCTION 229 { 230 const char *pcszFunctionName; 231 PFN *ppFuncAddress; 232 } RESOLVEFUNCTION, *PRESOLVEFUNCTION; 233 RESOLVEFUNCTION G_aImports[] = 234 { 235 { "gpihDraw3DFrame", (PFN*)&pgpihDraw3DFrame }, 236 }; 237 212 238 /* ****************************************************************** 213 239 * … … 255 281 ********************************************************************/ 256 282 283 /* 284 *@@ FreeIconData: 285 * Frees all members of the ICONDATA structure and resets them to 0. 286 */ 287 288 static 257 289 VOID FreeIconData(PICONDATA pData) 258 290 { … … 271 303 pData->pszToolTip = NULL; 272 304 } 305 } 306 307 /* 308 *@@ DrawPointer: 309 * Draws a pointer in a presentation space. 310 */ 311 312 static 313 BOOL DrawPointer(HPS hps, LONG lx, LONG ly, HPOINTER hptrPointer, BOOL bMini) 314 { 315 return WinDrawPointer(hps, lx, ly, hptrPointer, bMini ? DP_MINI : DP_NORMAL); 316 // @todo: for icons with real alpha, do manual alpha blending 273 317 } 274 318 … … 334 378 } 335 379 336 static337 BOOL DrawPointer(HPS hps, LONG lx, LONG ly, HPOINTER hptrPointer, BOOL bMini)338 {339 return WinDrawPointer(hps, lx, ly, hptrPointer, bMini ? DP_MINI : DP_NORMAL);340 // @todo:341 // 1) for icons w/o real alpha, draw them manually by correctly selecting342 // the normal or mini HBITMAP (WinDrawPointer fails to do so);343 // 2) for icons with real alpha, do manual alpha blending344 }345 346 380 /* 347 381 *@@ WgtPaint: … … 365 399 RECTL rcl; 366 400 BOOL bLeftToRight; 367 LONG x, lTotalWidth;401 LONG x, y, lTotalWidth; 368 402 size_t i; 369 403 … … 383 417 384 418 LOGF(("rclPaint %d,%d-%d,%d\n", 385 rclPaint.xLeft, rclPaint. xRight, rclPaint.yBottom, rclPaint.yTop));419 rclPaint.xLeft, rclPaint.yBottom, rclPaint.xRight, rclPaint.yTop)); 386 420 387 421 // switch HPS to RGB mode … … 394 428 WinFillRect(hps, &rclPaint, 395 429 WinQuerySysColor(HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0)); 430 431 if ((pWidget->pGlobals->flDisplayStyle & XCS_SUNKBORDERS)) 432 { 433 rcl.xLeft = 0; 434 rcl.yBottom = 0; 435 rcl.xRight = swp.cx - 1; 436 rcl.yTop = swp.cy - 1; 437 pgpihDraw3DFrame(hps, &rcl, 1, 438 pWidget->pGlobals->lcol3DDark, 439 pWidget->pGlobals->lcol3DLight); 440 } 441 442 // always center the icon vertically (we may be given more height than 443 // we requested) 444 y = (swp.cy - pSysTrayData->lIconWidth) / 2; 396 445 397 446 if (bLeftToRight) … … 420 469 break; 421 470 422 DrawPointer(hps, x, pSysTrayData->lIconPad, 423 pSysTrayData->pIcons[i].hIcon, DP_MINI); 471 DrawPointer(hps, x, y, pSysTrayData->pIcons[i].hIcon, DP_MINI); 424 472 if (bLeftToRight) 425 473 x += lTotalWidth; … … 845 893 PSZ pszErrorMsg) // if 0 is returned, 500 bytes of error msg 846 894 { 847 ULONG ulrc = 0 ;895 ULONG ulrc = 0, ul = 0; 848 896 CLASSINFO ClassInfo; 849 897 … … 852 900 do 853 901 { 902 // resolve imports from XFLDR.DLL (this is basically 903 // a copy of the doshResolveImports code, but we can't 904 // use that before resolving...) 905 for (ul = 0; 906 ul < sizeof(G_aImports) / sizeof(G_aImports[0]); 907 ul++) 908 { 909 APIRET arc; 910 if ((arc = DosQueryProcAddr(hmodXFLDR, 911 0, // ordinal, ignored 912 (PSZ)G_aImports[ul].pcszFunctionName, 913 G_aImports[ul].ppFuncAddress)) 914 != NO_ERROR) 915 { 916 snprintf(pszErrorMsg, 500, 917 "Import %s failed with %ld.", 918 G_aImports[ul].pcszFunctionName, arc); 919 break; 920 } 921 } 922 if (ul < sizeof(G_aImports) / sizeof(G_aImports[0])) 923 break; 924 854 925 // register our PM window class 855 926 if (!WinRegisterClass(hab, … … 861 932 ) 862 933 { 863 LOG(("WinRegisterClass(%s) failed with %lX", 864 WNDCLASS_WIDGET_XSYSTRAY, WinGetLastError(hab))); 934 snprintf(pszErrorMsg, 500, 935 "WinRegisterClass(%s) failed with %lX.", 936 WNDCLASS_WIDGET_XSYSTRAY, WinGetLastError(hab)); 865 937 break; 866 938 } … … 882 954 { 883 955 // error registering class: report error then 884 snprintf(pszErrorMsg, 500, "WinRegisterClass(%s) failed with %lX", 956 snprintf(pszErrorMsg, 500, 957 "WinRegisterClass(%s) failed with %lX", 885 958 WNDCLASS_WIDGET_XSYSTRAY_SERVER, WinGetLastError(hab)); 886 959 break; … … 896 969 while (0); 897 970 898 LOGF(("pszErrorMsg %s\n", pszErrorMsg));971 LOGF(("pszErrorMsg '%s'\n", pszErrorMsg)); 899 972 LOGF(("ulrc %d\n", ulrc)); 900 973
Note:
See TracChangeset
for help on using the changeset viewer.