Ignore:
Timestamp:
Mar 27, 2001, 6:17:52 PM (24 years ago)
Author:
sandervl
Message:

cursor handling updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/loadres.cpp

    r4586 r5385  
    1 /* $Id: loadres.cpp,v 1.34 2000-11-12 10:58:12 sandervl Exp $ */
     1/* $Id: loadres.cpp,v 1.35 2001-03-27 16:17:51 sandervl Exp $ */
    22
    33/*
     
    2525#include "dib.h"
    2626#include "initterm.h"
    27 #include <win\cursoricon.h>
    2827#include <winres.h>
     28#include "pmwindow.h"
    2929
    3030#define DBG_LOCALLOG    DBG_loadres
     
    121121    dprintf(("LoadIconA %x %x", hinst, lpszIcon));
    122122    return LoadImageW(hinst, lpszIcon, IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE);
    123 }
    124 //******************************************************************************
    125 //******************************************************************************
    126 HCURSOR LoadCursorW(HINSTANCE hinst, LPCWSTR lpszCursor, DWORD cxDesired,
    127                     DWORD cyDesired, DWORD fuLoad)
    128 {
    129  HCURSOR    hCursor;
    130  HANDLE     hMapping = 0;
    131  char      *ptr = NULL;
    132  HRSRC      hRes;
    133  LPSTR      restype = RT_CURSORA;
    134  LPVOID     lpOS2Resdata = NULL;
    135 
    136     if(fuLoad & LR_LOADFROMFILE)
    137     {
    138         hMapping = VIRTUAL_MapFileW( lpszCursor, (LPVOID *)&ptr, TRUE);
    139         if(hMapping == INVALID_HANDLE_VALUE)
    140             return 0;
    141 
    142         lpOS2Resdata = ConvertCursorToOS2(ptr);
    143         hCursor = OSLibWinCreatePointer(lpOS2Resdata, cxDesired, cyDesired);
    144         FreeOS2Resource(lpOS2Resdata);
    145 
    146         UnmapViewOfFile(ptr);
    147         CloseHandle(hMapping);
    148     }
    149     else
    150     {
    151         if(!hinst)
    152         {
    153             hRes = FindResourceW(hInstanceUser32,lpszCursor,RT_CURSORW);
    154             if(!hRes)  {
    155                 hRes = FindResourceW(hInstanceUser32,lpszCursor,RT_GROUP_CURSORW);
    156                 restype = RT_GROUP_CURSORA;
    157             }
    158             if(hRes)
    159             {
    160                  lpOS2Resdata = ConvertResourceToOS2(hInstanceUser32, restype, hRes);
    161                  hCursor = OSLibWinCreatePointer(lpOS2Resdata, cxDesired, cyDesired);
    162                  FreeOS2Resource(lpOS2Resdata);
    163             }
    164             else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor, cxDesired, cyDesired);
    165         }
    166         else
    167         { //not a system icon
    168             hRes = FindResourceW(hinst,lpszCursor,RT_CURSORW);
    169             if(!hRes)  {
    170                 hRes = FindResourceW(hinst,lpszCursor,RT_GROUP_CURSORW);
    171                 restype = RT_GROUP_CURSORA;
    172             }
    173             if(hRes) {
    174                  lpOS2Resdata = ConvertResourceToOS2(hinst, restype, hRes);
    175                  hCursor = OSLibWinCreatePointer(lpOS2Resdata, cxDesired, cyDesired);
    176                  FreeOS2Resource(lpOS2Resdata);
    177             }
    178             else hCursor = 0;
    179         }
    180     }
    181     dprintf(("LoadCursorA %x from %x returned %x\n", lpszCursor, hinst, hCursor));
    182 
    183     return(hCursor);
    184123}
    185124//******************************************************************************
     
    466405        case IMAGE_ICON:
    467406        {
     407#ifdef __WIN32OS2__
     408            ULONG palEnts = (1 << ScreenBitsPerPel);
     409#else
    468410            HDC hdc = GetDC(0);
    469411            UINT palEnts = GetSystemPaletteEntries(hdc, 0, 0, NULL);
     
    471413                palEnts = 256;
    472414            ReleaseDC(0, hdc);
     415#endif
    473416
    474417            hRet = CURSORICON_Load(hinst, lpszName, cxDesired, cyDesired,  palEnts, FALSE, fuLoad);
     
    477420
    478421        case IMAGE_CURSOR:
    479             hRet = (HANDLE)LoadCursorW(hinst, lpszName, cxDesired, cyDesired, fuLoad);
    480             break;
    481 //            return CURSORICON_Load(hinst, name, desiredx, desiredy, 1, TRUE, loadflags);
     422            return CURSORICON_Load(hinst, lpszName, cxDesired, cyDesired, 1, TRUE, fuLoad);
    482423
    483424        default:
    484                 dprintf(("LoadImageW: unsupported type %d!!", uType));
    485                 return 0;
     425            dprintf(("LoadImageW: unsupported type %d!!", uType));
     426            return 0;
    486427  }
    487428  dprintf(("LoadImageW returned %x\n", (int)hRet));
     
    518459                return (HANDLE)CURSORICON_ExtCopy(hnd, type, desiredx, desiredy, flags);
    519460        case IMAGE_CURSOR:
    520         /* Should call CURSORICON_ExtCopy but more testing
    521          * needs to be done before we change this
    522          */
    523                 return O32_CopyCursor(hnd);
    524 //              return CopyCursorIcon(hnd,type, desiredx, desiredy, flags);
     461                /* Should call CURSORICON_ExtCopy but more testing
     462                 * needs to be done before we change this
     463                 */
     464                return CURSORICON_ExtCopy(hnd,type, desiredx, desiredy, flags);
    525465        default:
    526466                dprintf(("CopyImage: Unsupported type"));
Note: See TracChangeset for help on using the changeset viewer.