Ignore:
Timestamp:
Jul 25, 1999, 10:00:52 PM (26 years ago)
Author:
cbratschi
Message:

bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/oslibres.cpp

    r350 r396  
    1 /* $Id: oslibres.cpp,v 1.2 1999-07-20 17:50:39 sandervl Exp $ */
     1/* $Id: oslibres.cpp,v 1.3 1999-07-25 20:00:52 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    6262
    6363    if(hIcon == 0) {
    64             //skip xor/and mask
    65             bfh = (BITMAPFILEHEADER2 *)((char *)&bafh->bfh2 + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2));
    66             hps = WinGetPS(hwnd);
    67             hbmColor = GpiCreateBitmap(hps, &bfh->bmp2, CBM_INIT,
    68                                        (char *)bafh + bfh->offBits,
    69                                        (BITMAPINFO2 *)&bfh->bmp2);
    70             if(hbmColor == GPI_ERROR) {
    71                 dprintf(("OSLibWinSetIcon: GpiCreateBitmap failed!"));
    72                 WinReleasePS(hps);
    73                 return 0;
    74             }
    75             hbmMask = GpiCreateBitmap(hps, &bafh->bfh2.bmp2, CBM_INIT,
    76                                       (char *)bafh + bafh->bfh2.offBits,
    77                                       (BITMAPINFO2 *)&bafh->bfh2.bmp2);
    78             if(hbmMask == GPI_ERROR) {
    79                 dprintf(("OSLibWinSetIcon: GpiCreateBitmap hbmMask failed!"));
    80                 WinReleasePS(hps);
    81                 return 0;
    82             }
    83        
    84             pointerInfo.fPointer   = FALSE; //icon
    85             pointerInfo.xHotspot   = bfh->xHotspot;
    86             pointerInfo.yHotspot   = bfh->yHotspot;
    87             pointerInfo.hbmColor   = hbmColor;
    88             pointerInfo.hbmPointer = hbmMask;
    89             hIcon = WinCreatePointerIndirect(HWND_DESKTOP, &pointerInfo);
    90             if(hIcon == NULL) {
    91                 dprintf(("WinSetIcon: WinCreatePointerIndirect failed!"));
    92                 GpiDeleteBitmap(hbmMask);
    93                 GpiDeleteBitmap(hbmColor);
    94                 WinReleasePS(hps);
    95             }
     64            if (!iconbitmap) return 0; //CB: or load a default icon
     65
     66            //skip xor/and mask
     67            bfh = (BITMAPFILEHEADER2 *)((char *)&bafh->bfh2 + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2));
     68            hps = WinGetPS(hwnd);
     69            hbmColor = GpiCreateBitmap(hps, &bfh->bmp2, CBM_INIT,
     70                                       (char *)bafh + bfh->offBits,
     71                                       (BITMAPINFO2 *)&bfh->bmp2);
     72            if(hbmColor == GPI_ERROR) {
     73                dprintf(("OSLibWinSetIcon: GpiCreateBitmap failed!"));
     74                WinReleasePS(hps);
     75                return 0;
     76            }
     77            hbmMask = GpiCreateBitmap(hps, &bafh->bfh2.bmp2, CBM_INIT,
     78                                      (char *)bafh + bafh->bfh2.offBits,
     79                                      (BITMAPINFO2 *)&bafh->bfh2.bmp2);
     80            if(hbmMask == GPI_ERROR) {
     81                dprintf(("OSLibWinSetIcon: GpiCreateBitmap hbmMask failed!"));
     82                WinReleasePS(hps);
     83                return 0;
     84            }
     85
     86            pointerInfo.fPointer   = FALSE; //icon
     87            pointerInfo.xHotspot   = bfh->xHotspot;
     88            pointerInfo.yHotspot   = bfh->yHotspot;
     89            pointerInfo.hbmColor   = hbmColor;
     90            pointerInfo.hbmPointer = hbmMask;
     91            hIcon = WinCreatePointerIndirect(HWND_DESKTOP, &pointerInfo);
     92            if(hIcon == NULL) {
     93                dprintf(("WinSetIcon: WinCreatePointerIndirect failed!"));
     94                GpiDeleteBitmap(hbmMask);
     95                GpiDeleteBitmap(hbmColor);
     96                WinReleasePS(hps);
     97            }
    9698    }
    9799    WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0);
    98     WinReleasePS(hps);
    99100    return hIcon;
    100101}
Note: See TracChangeset for help on using the changeset viewer.