- Timestamp:
- Jul 6, 2001, 3:47:00 PM (24 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/menu.cpp
r5968 r6183 1 /* $Id: menu.cpp,v 1.3 3 2001-06-11 20:08:23sandervl Exp $*/1 /* $Id: menu.cpp,v 1.34 2001-07-06 13:46:59 sandervl Exp $*/ 2 2 /* 3 3 * Menu functions … … 3704 3704 3705 3705 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)); 3707 3707 // TRACE("hMenu %04x, pos %d, flags %08x, " 3708 3708 // "id %04x, str '%s'\n", … … 3754 3754 UINT id, LPCSTR data ) 3755 3755 { 3756 dprintf(("USER32: AppendMenuA %x %x % d%x", hMenu, flags, id, data));3756 dprintf(("USER32: AppendMenuA %x %x %x %x", hMenu, flags, id, data)); 3757 3757 3758 3758 return InsertMenuA( hMenu, -1, flags | MF_BYPOSITION, id, data ); … … 3766 3766 UINT id, LPCWSTR data ) 3767 3767 { 3768 dprintf(("USER32: AppendMenuW %x %x % d%x", hMenu, flags, id, data));3768 dprintf(("USER32: AppendMenuW %x %x %x %x", hMenu, flags, id, data)); 3769 3769 3770 3770 return InsertMenuW( hMenu, -1, flags | MF_BYPOSITION, id, data ); … … 4158 4158 MENUITEM * lpmi; 4159 4159 4160 dprintf(("USER32: GetSubMenu %x %d", nPos));4160 dprintf(("USER32: GetSubMenu %x %d", hMenu, nPos)); 4161 4161 4162 4162 if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0; -
trunk/src/user32/winicon.cpp
r6168 r6183 1 /* $Id: winicon.cpp,v 1.2 5 2001-07-04 09:55:18sandervl Exp $ */1 /* $Id: winicon.cpp,v 1.26 2001-07-06 13:47:00 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Icon Code for OS/2 … … 48 48 #include <winicon.h> 49 49 #include <win\cursoricon.h> 50 #include <objhandle.h> 50 51 #include "dib.h" 51 52 #include <heapstring.h> … … 190 191 GetBitmapBits( iconinfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd); 191 192 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; 192 203 } 193 204 else { 194 205 dprintf(("ERROR: CreateIconIndirect GlobalAlloc failed!!")); 195 }196 return hObj;206 return 0; 207 } 197 208 } 198 209 //****************************************************************************** … … 216 227 CURSORICONINFO *ciconinfo; 217 228 229 hIcon = ObjGetHandleData(hIcon, USEROBJ_CURSORICON); 230 if(hIcon == -1) { 231 dprintf(("ERROR: Invalid cursor/icon!")); 232 return 0; 233 } 218 234 ciconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hIcon); 219 235 if (!ciconinfo) … … 232 248 dprintf(("GetIconInfo %x %x", hIcon, iconinfo)); 233 249 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 234 257 ciconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hIcon); 235 258 if (!ciconinfo) … … 361 384 hOldCursor = hActiveCursor; 362 385 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 363 394 364 395 CURSORICONINFO *iconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hCursor); … … 510 541 memcpy( ptr + sizeof(CURSORICONINFO) + sizeAnd, lpXORbits, sizeXor ); 511 542 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 512 553 return handle; 554 #endif 513 555 } 514 556 /********************************************************************** … … 562 604 info->dwResGroupId = -1; 563 605 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 564 614 if (loadflags & LR_SHARED ) 565 CURSORICON_AddSharedIcon( -1, h Cursor, -1, hObj );615 CURSORICON_AddSharedIcon( -1, hIcon, -1, hObj ); 566 616 567 617 GlobalUnlock( hObj ); 568 618 569 return h Obj;619 return hIcon; 570 620 } 571 621 } … … 1094 1144 DeleteObject( hAndBits ); 1095 1145 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 1096 1158 return hObj; 1097 1159 } … … 1117 1179 } 1118 1180 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 1119 1189 /* Try shared cursor/icon first */ 1120 1190 if ( !(flags & CID_NONSHARED) ) 1121 1191 { 1192 #ifdef __WIN32OS2__ 1193 INT count = CURSORICON_DelSharedIcon( hIcon ); 1194 #else 1122 1195 INT count = CURSORICON_DelSharedIcon( handle ); 1196 #endif 1123 1197 1124 1198 if ( count != -1 ) … … 1130 1204 1131 1205 #ifdef __WIN32OS2__ 1132 CURSORICONINFO *iconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)h andle);1206 CURSORICONINFO *iconinfo = (CURSORICONINFO *)GlobalLock((HGLOBAL)hIcon); 1133 1207 if (!iconinfo) { 1134 1208 dprintf(("ERROR: Invalid cursor!")); … … 1139 1213 OSLibWinDestroyPointer(iconinfo->hColorBmp); 1140 1214 } 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 1144 1221 retv = GlobalFree( handle ); 1145 1222 return (flags & CID_RESOURCE)? retv : TRUE; 1223 #endif 1146 1224 } 1147 1225 … … 1157 1235 HGLOBAL hNew; 1158 1236 1237 handle = ObjGetHandleData(handle, USEROBJ_CURSORICON); 1238 if(handle == -1) { 1239 dprintf(("ERROR: Invalid cursor/icon!")); 1240 return 0; 1241 } 1242 1159 1243 if (!(ptrOld = (char *)GlobalLock( handle ))) return 0; 1160 1244 1161 1245 size = GlobalSize( handle ); 1162 1246 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 1163 1253 ptrNew = (char *)GlobalLock( hNew ); 1164 1254 memcpy( ptrNew, ptrOld, size ); 1165 1255 GlobalUnlock( handle ); 1166 1256 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 1167 1267 return hNew; 1268 #endif 1168 1269 } 1169 1270 … … 1196 1297 HGLOBAL hNew=0; 1197 1298 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 1198 1307 if(Handle == 0) 1199 1308 { 1200 1309 return 0; 1201 1310 } 1311 #endif 1202 1312 /* Best Fit or Monochrome */ 1203 1313 if( (nFlags & LR_COPYFROMRESOURCE … … 1205 1315 || nFlags & LR_MONOCHROME) 1206 1316 { 1317 #ifdef __WIN32OS2__ 1318 ICONCACHE* pIconCache = CURSORICON_FindCache(hIcon); 1319 #else 1207 1320 ICONCACHE* pIconCache = CURSORICON_FindCache(Handle); 1321 #endif 1208 1322 1209 1323 /* Not Found in Cache, then do a straight copy … … 1236 1350 BOOL bIsIcon = (nType == IMAGE_ICON); 1237 1351 1352 #ifdef __WIN32OS2__ 1353 iconinfo = (CURSORICONINFO *)GlobalLock( hIcon ); 1354 #else 1238 1355 iconinfo = (CURSORICONINFO *)GlobalLock( Handle ); 1356 #endif 1239 1357 if(iconinfo == NULL) { 1240 1358 dprintf(("ERROR: CURSORICON_ExtCopy invalid icon!"));
Note:
See TracChangeset
for help on using the changeset viewer.