Changeset 6183 for trunk/src


Ignore:
Timestamp:
Jul 6, 2001, 3:47:00 PM (24 years ago)
Author:
sandervl
Message:

use 16 bits handles for icons & cursors

Location:
trunk/src/user32
Files:
2 edited

Legend:

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

    r5968 r6183  
    1 /* $Id: menu.cpp,v 1.33 2001-06-11 20:08:23 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.34 2001-07-06 13:46:59 sandervl Exp $*/
    22/*
    33 * Menu functions
     
    37043704
    37053705    if (IS_STRING_ITEM(flags) && str)
    3706         dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str));
     3706        dprintf(("USER32: InsertMenuA %x %d %x %x %s", hMenu, pos, flags, id, str));
    37073707    //    TRACE("hMenu %04x, pos %d, flags %08x, "
    37083708    //                  "id %04x, str '%s'\n",
     
    37543754                             UINT id, LPCSTR data )
    37553755{
    3756     dprintf(("USER32: AppendMenuA %x %x %d %x", hMenu, flags, id, data));
     3756    dprintf(("USER32: AppendMenuA %x %x %x %x", hMenu, flags, id, data));
    37573757
    37583758    return InsertMenuA( hMenu, -1, flags | MF_BYPOSITION, id, data );
     
    37663766                             UINT id, LPCWSTR data )
    37673767{
    3768     dprintf(("USER32: AppendMenuW %x %x %d %x", hMenu, flags, id, data));
     3768    dprintf(("USER32: AppendMenuW %x %x %x %x", hMenu, flags, id, data));
    37693769
    37703770    return InsertMenuW( hMenu, -1, flags | MF_BYPOSITION, id, data );
     
    41584158    MENUITEM * lpmi;
    41594159
    4160     dprintf(("USER32: GetSubMenu %x %d", nPos));
     4160    dprintf(("USER32: GetSubMenu %x %d", hMenu, nPos));
    41614161
    41624162    if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0;
  • trunk/src/user32/winicon.cpp

    r6168 r6183  
    1 /* $Id: winicon.cpp,v 1.25 2001-07-04 09:55:18 sandervl Exp $ */
     1/* $Id: winicon.cpp,v 1.26 2001-07-06 13:47:00 sandervl Exp $ */
    22/*
    33 * Win32 Icon Code for OS/2
     
    4848#include <winicon.h>
    4949#include <win\cursoricon.h>
     50#include <objhandle.h>
    5051#include "dib.h"
    5152#include <heapstring.h>
     
    190191        GetBitmapBits( iconinfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd);
    191192        GlobalUnlock(hObj);
     193
     194#ifdef __WIN32OS2__
     195        HICON hIcon;
     196        if(ObjAllocateHandle(&hIcon, (DWORD)hObj, USEROBJ_CURSORICON) == FALSE) {
     197            GlobalFree(hObj);
     198            dprintf(("ERROR: CreateIconIndirect ObjAllocateHandle failed!!"));
     199            return 0;
     200        }
     201#endif
     202        return hIcon;
    192203    }
    193204    else {
    194205        dprintf(("ERROR: CreateIconIndirect GlobalAlloc failed!!"));
    195     }
    196     return hObj;
     206        return 0;
     207    }
    197208}
    198209//******************************************************************************
     
    216227    CURSORICONINFO  *ciconinfo;
    217228
     229    hIcon = ObjGetHandleData(hIcon, USEROBJ_CURSORICON);
     230    if(hIcon == -1) {
     231        dprintf(("ERROR: Invalid cursor/icon!"));
     232        return 0;
     233    }
    218234    ciconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hIcon);
    219235    if (!ciconinfo)
     
    232248    dprintf(("GetIconInfo %x %x", hIcon, iconinfo));
    233249
     250#ifdef __WIN32OS2__
     251    hIcon = ObjGetHandleData(hIcon, USEROBJ_CURSORICON);
     252    if(hIcon == -1) {
     253        dprintf(("ERROR: Invalid cursor/icon!"));
     254        return 0;
     255    }
     256#endif
    234257    ciconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hIcon);
    235258    if (!ciconinfo)
     
    361384    hOldCursor = hActiveCursor;
    362385    hActiveCursor = hCursor;
     386
     387#ifdef __WIN32OS2__
     388    hCursor = ObjGetHandleData(hCursor, USEROBJ_CURSORICON);
     389    if(hCursor == -1) {
     390        dprintf(("ERROR: Invalid cursor/icon!"));
     391        return 0;
     392    }
     393#endif
    363394
    364395    CURSORICONINFO *iconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hCursor);
     
    510541    memcpy( ptr + sizeof(CURSORICONINFO) + sizeAnd, lpXORbits, sizeXor );
    511542    GlobalUnlock( handle );
     543
     544#ifdef __WIN32OS2__
     545    HICON hIcon;
     546    if(ObjAllocateHandle(&hIcon, (DWORD)handle, USEROBJ_CURSORICON) == FALSE) {
     547        GlobalFree(handle);
     548        dprintf(("ERROR: CreateCursorIconIndirect ObjAllocateHandle failed!!"));
     549        return 0;
     550    }
     551    return hIcon;
     552#else
    512553    return handle;
     554#endif
    513555}
    514556/**********************************************************************
     
    562604            info->dwResGroupId  = -1;
    563605
     606            HICON hIcon;
     607            if(ObjAllocateHandle(&hIcon, (DWORD)hObj, USEROBJ_CURSORICON) == FALSE) {
     608               GlobalUnlock( hObj );
     609               GlobalFree(hObj);
     610               dprintf(("ERROR: CURSORICON_Load ObjAllocateHandle failed!!"));
     611               return 0;
     612            }
     613
    564614            if (loadflags & LR_SHARED )
    565                 CURSORICON_AddSharedIcon( -1, hCursor, -1, hObj );
     615                CURSORICON_AddSharedIcon( -1, hIcon, -1, hObj );
    566616
    567617            GlobalUnlock( hObj );
    568618
    569             return hObj;
     619            return hIcon;
    570620        }
    571621    }
     
    10941144    DeleteObject( hAndBits );
    10951145    DeleteObject( hXorBits );
     1146
     1147#ifdef __WIN32OS2__
     1148    if(hObj) {
     1149        HICON hIcon;
     1150        if(ObjAllocateHandle(&hIcon, (DWORD)hObj, USEROBJ_CURSORICON) == FALSE) {
     1151            GlobalFree(hObj);
     1152            dprintf(("ERROR: CURSORICON_Load ObjAllocateHandle failed!!"));
     1153            return 0;
     1154        }
     1155        return hIcon;
     1156    }
     1157#endif
    10961158    return hObj;
    10971159}
     
    11171179    }
    11181180
     1181#ifdef __WIN32OS2__
     1182    HICON hIcon = ObjGetHandleData(handle, USEROBJ_CURSORICON);
     1183    if(hIcon == -1) {
     1184        dprintf(("ERROR: Invalid cursor/icon!"));
     1185        return 0;
     1186    }
     1187#endif
     1188
    11191189    /* Try shared cursor/icon first */
    11201190    if ( !(flags & CID_NONSHARED) )
    11211191    {
     1192#ifdef __WIN32OS2__
     1193        INT count = CURSORICON_DelSharedIcon( hIcon );
     1194#else
    11221195        INT count = CURSORICON_DelSharedIcon( handle );
     1196#endif
    11231197
    11241198        if ( count != -1 )
     
    11301204
    11311205#ifdef __WIN32OS2__
    1132     CURSORICONINFO *iconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)handle);
     1206    CURSORICONINFO *iconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hIcon);
    11331207    if (!iconinfo) {
    11341208        dprintf(("ERROR: Invalid cursor!"));
     
    11391213        OSLibWinDestroyPointer(iconinfo->hColorBmp);
    11401214    }
    1141     GlobalUnlock(handle);
    1142 #endif
    1143 
     1215    GlobalUnlock(hIcon);
     1216    retv = GlobalFree( hIcon );
     1217    ObjFreeHandle(handle);
     1218
     1219    return (flags & CID_RESOURCE)? retv : TRUE;
     1220#else
    11441221    retv = GlobalFree( handle );
    11451222    return (flags & CID_RESOURCE)? retv : TRUE;
     1223#endif
    11461224}
    11471225
     
    11571235    HGLOBAL hNew;
    11581236
     1237    handle = ObjGetHandleData(handle, USEROBJ_CURSORICON);
     1238    if(handle == -1) {
     1239        dprintf(("ERROR: Invalid cursor/icon!"));
     1240        return 0;
     1241    }
     1242
    11591243    if (!(ptrOld = (char *)GlobalLock( handle ))) return 0;
    11601244
    11611245    size = GlobalSize( handle );
    11621246    hNew = GlobalAlloc( GMEM_MOVEABLE, size );
     1247#ifdef __WIN32OS2__
     1248    if(hNew == NULL) {
     1249        dprintf(("ERROR: CURSORICON_Copy GlobalAlloc failed!!"));
     1250        return NULL;
     1251    }
     1252#endif
    11631253    ptrNew = (char *)GlobalLock( hNew );
    11641254    memcpy( ptrNew, ptrOld, size );
    11651255    GlobalUnlock( handle );
    11661256    GlobalUnlock( hNew );
     1257
     1258#ifdef __WIN32OS2__
     1259    HICON hIcon;
     1260    if(ObjAllocateHandle(&hIcon, (DWORD)hNew, USEROBJ_CURSORICON) == FALSE) {
     1261        GlobalFree(hNew);
     1262        dprintf(("ERROR: CURSORICON_Copy ObjAllocateHandle failed!!"));
     1263        return 0;
     1264    }
     1265    return hIcon;
     1266#else
    11671267    return hNew;
     1268#endif
    11681269}
    11691270
     
    11961297    HGLOBAL hNew=0;
    11971298
     1299#ifdef __WIN32OS2__
     1300    HICON hIcon = ObjGetHandleData(Handle, USEROBJ_CURSORICON);
     1301    if(hIcon == -1) {
     1302        dprintf(("ERROR: Invalid cursor/icon!"));
     1303        return 0;
     1304    }
     1305
     1306#else
    11981307    if(Handle == 0)
    11991308    {
    12001309        return 0;
    12011310    }
     1311#endif
    12021312    /* Best Fit or Monochrome */
    12031313    if( (nFlags & LR_COPYFROMRESOURCE
     
    12051315        || nFlags & LR_MONOCHROME)
    12061316    {
     1317#ifdef __WIN32OS2__
     1318        ICONCACHE* pIconCache = CURSORICON_FindCache(hIcon);
     1319#else
    12071320        ICONCACHE* pIconCache = CURSORICON_FindCache(Handle);
     1321#endif
    12081322
    12091323        /* Not Found in Cache, then do a straight copy
     
    12361350            BOOL bIsIcon = (nType == IMAGE_ICON);
    12371351
     1352#ifdef __WIN32OS2__
     1353            iconinfo = (CURSORICONINFO *)GlobalLock( hIcon );
     1354#else
    12381355            iconinfo = (CURSORICONINFO *)GlobalLock( Handle );
     1356#endif
    12391357            if(iconinfo == NULL) {
    12401358                dprintf(("ERROR: CURSORICON_ExtCopy invalid icon!"));
Note: See TracChangeset for help on using the changeset viewer.