Changeset 4825 for trunk/src/user32
- Timestamp:
- Dec 17, 2000, 4:04:14 PM (25 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/caret.cpp
r3873 r4825 1 /* $Id: caret.cpp,v 1.1 3 2000-07-20 18:08:12sandervl Exp $ */1 /* $Id: caret.cpp,v 1.14 2000-12-17 15:04:09 sandervl Exp $ */ 2 2 3 3 /* 4 4 * Caret functions for USER32 5 * 6 * 7 * TODO: Getting height of window instead of checking whether it needs 8 * to be window or client appears to be wrong.... 5 9 * 6 10 * Project Odin Software License can be found in LICENSE.TXT -
trunk/src/user32/oslibwin.cpp
r4551 r4825 1 /* $Id: oslibwin.cpp,v 1.8 4 2000-11-04 16:28:25sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.85 2000-12-17 15:04:10 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 88 88 89 89 return WinCreateWindow (hwndParent, 90 WIN32_STDFRAMECLASS,90 hwndParent == HWND_DESKTOP ? WIN32_STDFRAMECLASS : WIN32_STDCLASS, 91 91 pszName, dwWinStyle, 0, 0, 0, 0, 92 92 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP, -
trunk/src/user32/pmwindow.cpp
r4658 r4825 1 /* $Id: pmwindow.cpp,v 1.10 8 2000-11-21 11:36:09sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.109 2000-12-17 15:04:10 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 956 956 switch(fsCmd) { 957 957 case QFC_NEXTINCHAIN: 958 break;958 goto RunDefWndProc; 959 959 case QFC_ACTIVE: 960 960 case QFC_FRAME: … … 965 965 break; 966 966 case QFC_SELECTACTIVE: 967 break;967 goto RunDefWndProc; 968 968 case QFC_PARTOFCHAIN: 969 return (MRESULT)TRUE;969 goto RunDefWndProc; 970 970 } 971 971 break; -
trunk/src/user32/text.cpp
r2873 r4825 1 /* $Id: text.cpp,v 1. 9 2000-02-23 17:05:17 cbratschiExp $ */1 /* $Id: text.cpp,v 1.10 2000-12-17 15:04:11 sandervl Exp $ */ 2 2 3 3 /* … … 22 22 INT WIN32API DrawTextA(HDC hDC,LPCSTR lpString,INT nCount,PRECT lpRect,UINT nFormat) 23 23 { 24 int bla;25 26 24 dprintf(("USER32: DrawTextA %x %s %d (%d,%d)(%d,%d) %x",hDC, lpString, nCount, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, nFormat)); 27 25 28 if(nFormat == 0x828) {29 bla = 1;30 }31 26 return InternalDrawTextExA(hDC,lpString,nCount,lpRect,nFormat,NULL,FALSE); 32 27 } -
trunk/src/user32/user32rsrc.orc
r4579 r4825 1 /* $Id: user32rsrc.orc,v 1. 5 2000-11-09 20:20:32sandervl Exp $ */1 /* $Id: user32rsrc.orc,v 1.6 2000-12-17 15:04:11 sandervl Exp $ */ 2 2 /* converted from WINE */ 3 3 4 4 #include "winuser.h" 5 #include "winnls.h" 5 6 #include "odinrsrc.h" 6 7 /* System Menu */ 8 9 SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE 10 { 11 MENUITEM "&Restore", 61728 12 MENUITEM "&Move", 61456 13 MENUITEM "&Size", 61440 14 MENUITEM "Mi&nimize", 61472 15 MENUITEM "Ma&ximize", 61488 16 MENUITEM SEPARATOR 17 MENUITEM "&Close\tAlt-F4", 61536 18 MENUITEM SEPARATOR 19 MENUITEM "&Switch to ...\tCtrl-Esc", 61744 20 MENUITEM SEPARATOR 21 MENUITEM "&About Odin ...", 61761 22 MENUITEM SEPARATOR 23 MENUITEM "&Put mark in debug log", 61762 24 MENUITEM "&DebugInt3", 61763 25 } 7 #include "mdi.h" 26 8 27 9 /* Frame */ … … 796 778 #define EM_SETSEL 0x00b1 797 779 798 EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE799 {800 POPUP ""801 BEGIN802 MENUITEM "&Undo", EM_UNDO803 MENUITEM SEPARATOR804 MENUITEM "Cu&t", WM_CUT805 MENUITEM "&Copy", WM_COPY806 MENUITEM "&Paste", WM_PASTE807 MENUITEM "&Delete", WM_CLEAR808 MENUITEM SEPARATOR809 MENUITEM "Select &All", EM_SETSEL810 END811 }812 813 780 /* Icons */ 814 781 … … 899 866 #define OCR_HELP 32651 /* only defined in Odin */ 900 867 901 902 MSGBOX DIALOG 100, 80, 216, 168903 STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU904 BEGIN905 ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE906 LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP907 PUSHBUTTON "&OK", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP908 PUSHBUTTON "&Cancel", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP909 PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP910 PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP911 PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP912 PUSHBUTTON "&Yes", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP913 PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP914 END915 868 916 869 … … 950 903 END 951 904 END 905 906 /* 907 * Everything specific to any language goes 908 * in one of the specific files. 909 * Note that you can and may override resources 910 * which also have a neutral version. This is to 911 * get localized bitmaps for example. 912 */ 913 #include "resources\user32_Ca.orc" 914 #include "resources\user32_Cs.orc" 915 #include "resources\user32_Da.orc" 916 #include "resources\user32_De.orc" 917 #include "resources\user32_En.orc" 918 #include "resources\user32_Eo.orc" 919 #include "resources\user32_Es.orc" 920 #include "resources\user32_Fi.orc" 921 #include "resources\user32_Fr.orc" 922 #include "resources\user32_Hu.orc" 923 #include "resources\user32_It.orc" 924 #include "resources\user32_Ko.orc" 925 #include "resources\user32_Nl.orc" 926 #include "resources\user32_No.orc" 927 #include "resources\user32_Pl.orc" 928 #include "resources\user32_Pt.orc" 929 #include "resources\user32_Ru.orc" 930 #include "resources\user32_Sk.orc" 931 #include "resources\user32_Sv.orc" 932 #include "resources\user32_Wa.orc" 933 #include "resources\user32_Ja.orc" -
trunk/src/user32/win32wbase.cpp
r4658 r4825 1 /* $Id: win32wbase.cpp,v 1.22 4 2000-11-21 11:36:09sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.225 2000-12-17 15:04:11 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 194 194 } 195 195 196 /* Decrement class window counter */ 197 if(windowClass) { 198 windowClass->DecreaseWindowCount(); 199 } 200 196 201 if(isOwnDC()) 197 202 releaseOwnDC(ownDC); … … 290 295 } 291 296 292 /* Find the window class */293 windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom);294 if (!windowClass)295 {297 /* Find the window class */ 298 windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom); 299 if (!windowClass) 300 { 296 301 GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) ); 297 302 dprintf(("Bad class '%s'\n", buffer )); 298 303 SetLastError(ERROR_INVALID_PARAMETER); 299 304 return 0; 300 } 305 } 306 /* Increment class window counter */ 307 windowClass->IncreaseWindowCount(); 308 301 309 #ifdef DEBUG 302 if(HIWORD(cs->lpszClass))303 {310 if(HIWORD(cs->lpszClass)) 311 { 304 312 char *astring; 305 313 … … 309 317 dprintf(("Window class %s", astring)); 310 318 if(isUnicode) FreeAsciiString(astring); 311 }312 elsedprintf(("Window class %x", cs->lpszClass));319 } 320 else dprintf(("Window class %x", cs->lpszClass)); 313 321 #endif 314 322 315 /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX316 * with an atom as the class name, put some programs expect to have a *REAL* string in317 * lpszClass when the CREATESTRUCT is sent with WM_CREATE318 */319 if (!HIWORD(cs->lpszClass) ) {323 /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX 324 * with an atom as the class name, put some programs expect to have a *REAL* string in 325 * lpszClass when the CREATESTRUCT is sent with WM_CREATE 326 */ 327 if (!HIWORD(cs->lpszClass) ) { 320 328 if (isUnicode) { 321 329 GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) ); … … 325 333 } 326 334 cs->lpszClass = buffer; 327 }328 329 /* Fix the coordinates */330 fXDefault = FALSE;331 fCXDefault = FALSE;332 if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))333 {335 } 336 337 /* Fix the coordinates */ 338 fXDefault = FALSE; 339 fCXDefault = FALSE; 340 if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16)) 341 { 334 342 /* Never believe Microsoft's documentation... CreateWindowEx doc says 335 343 * that if an overlapped window is created with WS_VISIBLE style bit … … 354 362 cs->y = 0; 355 363 fXDefault = TRUE; 356 }357 if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))358 {364 } 365 if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16)) 366 { 359 367 cs->cx = 600; /* FIXME */ 360 368 cs->cy = 400; 361 369 fCXDefault = TRUE; 362 }363 if (cs->style & (WS_POPUP | WS_CHILD))364 {365 fXDefault = FALSE;366 if (fCXDefault)367 {368 fCXDefault = FALSE;369 cs->cx = cs->cy = 0;370 }371 }372 if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe)373 374 if (cs->x < 0) cs->x = 0;375 if (cs->y < 0) cs->y = 0;376 377 //Allocate window words378 nrUserWindowLong = windowClass->getExtraWndWords();379 if(nrUserWindowLong) {370 } 371 if (cs->style & (WS_POPUP | WS_CHILD)) 372 { 373 fXDefault = FALSE; 374 if (fCXDefault) 375 { 376 fCXDefault = FALSE; 377 cs->cx = cs->cy = 0; 378 } 379 } 380 if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe) 381 382 if (cs->x < 0) cs->x = 0; 383 if (cs->y < 0) cs->y = 0; 384 385 //Allocate window words 386 nrUserWindowLong = windowClass->getExtraWndWords(); 387 if(nrUserWindowLong) { 380 388 userWindowLong = (ULONG *)_smalloc(nrUserWindowLong); 381 389 memset(userWindowLong, 0, nrUserWindowLong); 382 }383 384 if ((cs->style & WS_CHILD) && cs->hwndParent)385 {390 } 391 392 if ((cs->style & WS_CHILD) && cs->hwndParent) 393 { 386 394 SetParent(cs->hwndParent); 387 395 // owner = GetWindowFromHandle(cs->hwndParent); 388 owner = 0;396 owner = 0; 389 397 /* if(owner == NULL) 390 398 { … … 395 403 //SvL: Shell positioning shouldn't be done for child windows! (breaks Notes) 396 404 fXDefault = fCXDefault = FALSE; 397 }398 else399 {405 } 406 else 407 { 400 408 SetParent(0); 401 409 if (!cs->hwndParent || (cs->hwndParent == windowDesktop->getWindowHandle())) { … … 412 420 } 413 421 } 414 } 415 416 WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW); 417 hInstance = cs->hInstance; 418 dwStyle = cs->style & ~WS_VISIBLE; 419 dwExStyle = cs->dwExStyle; 420 421 hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP; 422 423 /* Increment class window counter */ 424 windowClass->IncreaseWindowCount(); 425 426 if (HOOK_IsHooked( WH_CBT )) 427 { 422 } 423 424 WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW); 425 hInstance = cs->hInstance; 426 dwStyle = cs->style & ~WS_VISIBLE; 427 dwExStyle = cs->dwExStyle; 428 429 hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP; 430 431 /* Correct the window style */ 432 if (!(cs->style & WS_CHILD)) 433 { 434 dwStyle |= WS_CLIPSIBLINGS; 435 if (!(cs->style & WS_POPUP)) 436 { 437 dwStyle |= WS_CAPTION; 438 flags |= WIN_NEED_SIZE; 439 } 440 } 441 if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME; 442 443 //copy pointer of CREATESTRUCT for usage in MsgCreate method 444 tmpcs = cs; 445 446 //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it 447 TEB *teb = GetThreadTEB(); 448 if(teb == NULL) { 449 dprintf(("Window creation failed - teb == NULL")); //this is VERY bad 450 ExitProcess(666); 451 return FALSE; 452 } 453 454 teb->o.odin.newWindow = (ULONG)this; 455 456 DWORD dwOSWinStyle; 457 458 OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle); 459 460 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, 461 dwOSWinStyle,(char *)windowNameA, 462 (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP), 463 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 464 0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle()); 465 if(OS2Hwnd == 0) { 466 dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError())); 467 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 468 return FALSE; 469 } 470 OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE); 471 SetLastError(0); 472 return TRUE; 473 } 474 //****************************************************************************** 475 //****************************************************************************** 476 BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2) 477 { 478 CREATESTRUCTA *cs = tmpcs; //pointer to CREATESTRUCT used in CreateWindowExA method 479 POINT maxSize, maxPos, minTrack, maxTrack; 480 481 OS2Hwnd = hwndOS2; 482 483 fNoSizeMsg = TRUE; 484 485 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 486 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd)); 487 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 488 return FALSE; 489 } 490 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) { 491 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd)); 492 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 493 return FALSE; 494 } 495 496 if (HOOK_IsHooked( WH_CBT )) 497 { 428 498 CBT_CREATEWNDA cbtc; 429 499 LRESULT ret; … … 431 501 cbtc.lpcs = cs; 432 502 cbtc.hwndInsertAfter = hwndLinkAfter; 433 ret = HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc); 503 ret = (isUnicode) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc) 504 : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc); 434 505 if(ret) 435 506 { … … 438 509 return FALSE; 439 510 } 440 } 441 442 /* Correct the window style */ 443 if (!(cs->style & WS_CHILD)) 444 { 445 dwStyle |= WS_CLIPSIBLINGS; 446 if (!(cs->style & WS_POPUP)) 447 { 448 dwStyle |= WS_CAPTION; 449 flags |= WIN_NEED_SIZE; 450 } 451 } 452 if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME; 453 454 if (cs->style & WS_HSCROLL) 455 { 511 //todo: if hook changes parent, we need to do so too!!!!!!!!!! 512 } 513 514 if (cs->style & WS_HSCROLL) 515 { 456 516 horzScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO)); 457 517 horzScrollInfo->MinVal = horzScrollInfo->CurVal = horzScrollInfo->Page = 0; 458 518 horzScrollInfo->MaxVal = 100; 459 519 horzScrollInfo->flags = ESB_ENABLE_BOTH; 460 }461 462 if (cs->style & WS_VSCROLL)463 {520 } 521 522 if (cs->style & WS_VSCROLL) 523 { 464 524 vertScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO)); 465 525 vertScrollInfo->MinVal = vertScrollInfo->CurVal = vertScrollInfo->Page = 0; 466 526 vertScrollInfo->MaxVal = 100; 467 527 vertScrollInfo->flags = ESB_ENABLE_BOTH; 468 } 469 470 if(HIWORD(cs->lpszName)) 471 { 472 if (!isUnicode) 473 { 474 wndNameLength = strlen(cs->lpszName); 475 windowNameA = (LPSTR)_smalloc(wndNameLength+1); 476 strcpy(windowNameA,cs->lpszName); 477 windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR)); 478 lstrcpyAtoW(windowNameW,windowNameA); 479 windowNameA[wndNameLength] = 0; 480 windowNameW[wndNameLength] = 0; 481 } 482 else 483 { 484 wndNameLength = lstrlenW((LPWSTR)cs->lpszName); 485 windowNameA = (LPSTR)_smalloc(wndNameLength+1); 486 lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName); 487 windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR)); 488 lstrcpyW(windowNameW,(LPWSTR)cs->lpszName); 489 windowNameA[wndNameLength] = 0; 490 windowNameW[wndNameLength] = 0; 491 } 492 } 493 494 //copy pointer of CREATESTRUCT for usage in MsgCreate method 495 tmpcs = cs; 496 497 //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it 498 TEB *teb = GetThreadTEB(); 499 500 if(teb == NULL) { 501 dprintf(("Window creation failed - teb == NULL")); //this is VERY bad 502 ExitProcess(666); 503 return FALSE; 504 } 505 506 teb->o.odin.newWindow = (ULONG)this; 507 508 DWORD dwOSWinStyle; 509 510 OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle); 511 512 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, 513 dwOSWinStyle,(char *)windowNameA, 514 (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP), 515 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 516 0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle()); 517 if(OS2Hwnd == 0) { 518 dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError())); 519 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 520 return FALSE; 521 } 522 OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE); 523 SetLastError(0); 524 return TRUE; 525 } 526 //****************************************************************************** 527 //****************************************************************************** 528 BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2) 529 { 530 CREATESTRUCTA *cs = tmpcs; //pointer to CREATESTRUCT used in CreateWindowExA method 531 POINT maxSize, maxPos, minTrack, maxTrack; 532 533 OS2Hwnd = hwndOS2; 534 535 fNoSizeMsg = TRUE; 536 537 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 538 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd)); 539 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 540 return FALSE; 541 } 542 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) { 543 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd)); 544 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 545 return FALSE; 546 } 528 } 529 530 if(HIWORD(cs->lpszName)) 531 { 532 if (!isUnicode) 533 { 534 wndNameLength = strlen(cs->lpszName); 535 windowNameA = (LPSTR)_smalloc(wndNameLength+1); 536 strcpy(windowNameA,cs->lpszName); 537 windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR)); 538 lstrcpyAtoW(windowNameW,windowNameA); 539 windowNameA[wndNameLength] = 0; 540 windowNameW[wndNameLength] = 0; 541 } 542 else 543 { 544 wndNameLength = lstrlenW((LPWSTR)cs->lpszName); 545 windowNameA = (LPSTR)_smalloc(wndNameLength+1); 546 lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName); 547 windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR)); 548 lstrcpyW(windowNameW,(LPWSTR)cs->lpszName); 549 windowNameA[wndNameLength] = 0; 550 windowNameW[wndNameLength] = 0; 551 } 552 } 553 547 554 548 555 //SvL: This completely messes up MS Word 97 (no button bar, no menu) … … 573 580 #endif 574 581 575 fakeWinBase.hwndThis = OS2Hwnd; 576 fakeWinBase.pWindowClass = windowClass; 577 578 //Set icon from window or class 579 if (hIcon) 580 OSLibWinSetIcon(OS2Hwnd,hIcon); 581 else if (windowClass->getIcon()) 582 OSLibWinSetIcon(OS2Hwnd,windowClass->getIcon()); 583 584 /* Get class or window DC if needed */ 585 if(windowClass->getStyle() & CS_OWNDC) { 582 fakeWinBase.hwndThis = OS2Hwnd; 583 fakeWinBase.pWindowClass = windowClass; 584 585 //Set icon from window or class 586 if (hIcon) 587 OSLibWinSetIcon(OS2Hwnd,hIcon); 588 else 589 if (windowClass->getIcon()) 590 OSLibWinSetIcon(OS2Hwnd,windowClass->getIcon()); 591 592 /* Get class or window DC if needed */ 593 if(windowClass->getStyle() & CS_OWNDC) { 586 594 dprintf(("Class with CS_OWNDC style")); 587 595 ownDC = GetDCEx(getWindowHandle(), NULL, DCX_USESTYLE); 588 }589 else590 if (windowClass->getStyle() & CS_PARENTDC) {596 } 597 else 598 if (windowClass->getStyle() & CS_PARENTDC) { 591 599 fParentDC = TRUE; 592 600 ownDC = 0; 593 }594 else595 if (windowClass->getStyle() & CS_CLASSDC) {601 } 602 else 603 if (windowClass->getStyle() & CS_CLASSDC) { 596 604 dprintf(("WARNING: Class with CS_CLASSDC style!")); 597 605 ownDC = 0; 598 }599 /* Set the window menu */600 if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )601 {606 } 607 /* Set the window menu */ 608 if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION ) 609 { 602 610 if (cs->hMenu) { 603 611 ::SetMenu(getWindowHandle(), cs->hMenu); … … 612 620 } 613 621 } 614 }615 else616 {622 } 623 else 624 { 617 625 setWindowId((DWORD)cs->hMenu); 618 }619 hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0;620 621 /* Send the WM_GETMINMAXINFO message and fix the size if needed */622 if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))623 {624 GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);626 } 627 hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0; 628 629 /* Send the WM_GETMINMAXINFO message and fix the size if needed */ 630 if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD))) 631 { 632 GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack); 625 633 if (maxSize.x < cs->cx) cs->cx = maxSize.x; 626 634 if (maxSize.y < cs->cy) cs->cy = maxSize.y; 627 635 if (cs->cx < minTrack.x) cs->cx = minTrack.x; 628 636 if (cs->cy < minTrack.y) cs->cy = minTrack.y; 629 }630 631 if(cs->style & WS_CHILD)632 {637 } 638 639 if(cs->style & WS_CHILD) 640 { 633 641 if(cs->cx < 0) cs->cx = 0; 634 642 if(cs->cy < 0) cs->cy = 0; 635 }636 else637 {643 } 644 else 645 { 638 646 if (cs->cx <= 0) cs->cx = 1; 639 647 if (cs->cy <= 0) cs->cy = 1; 640 }641 642 //set client & window rectangles from CreateWindowEx CREATESTRUCT643 rectWindow.left = cs->x;644 rectWindow.right = cs->x+cs->cx;645 rectWindow.top = cs->y;646 rectWindow.bottom = cs->y+cs->cy;647 rectClient = rectWindow;648 OffsetRect(&rectClient, -rectClient.left, -rectClient.top);649 650 /* Send the WM_CREATE message651 * Perhaps we shouldn't allow width/height changes as well.652 * See p327 in "Internals".653 */654 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;655 656 //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE657 fCreated = TRUE;658 659 if(fTaskList) {660 hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);661 }662 663 //cs is ascii version of create structure. so use SendInternalMessageA664 if(SendInternalMessageA(WM_NCCREATE,0,(LPARAM)cs))665 {648 } 649 650 //set client & window rectangles from CreateWindowEx CREATESTRUCT 651 rectWindow.left = cs->x; 652 rectWindow.right = cs->x+cs->cx; 653 rectWindow.top = cs->y; 654 rectWindow.bottom = cs->y+cs->cy; 655 rectClient = rectWindow; 656 OffsetRect(&rectClient, -rectClient.left, -rectClient.top); 657 658 /* Send the WM_CREATE message 659 * Perhaps we shouldn't allow width/height changes as well. 660 * See p327 in "Internals". 661 */ 662 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top; 663 664 //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE 665 fCreated = TRUE; 666 667 if(fTaskList) { 668 hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0); 669 } 670 671 //cs is ascii version of create structure. so use SendInternalMessageA 672 if(SendInternalMessageA(WM_NCCREATE,0,(LPARAM)cs)) 673 { 666 674 RECT tmpRect; 667 675 … … 722 730 return TRUE; 723 731 } 724 }725 dprintf(("Window creation FAILED (NCCREATE cancelled creation)"));726 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error732 } 733 dprintf(("Window creation FAILED (NCCREATE cancelled creation)")); 734 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 727 735 end: 728 return FALSE;736 return FALSE; 729 737 } 730 738 //****************************************************************************** … … 2367 2375 { 2368 2376 MsgFormatFrame(NULL); 2369 if(RECT_WIDTH(rectClient) != RECT_WIDTH(*oldClientRect) || 2370 RECT_HEIGHT(rectClient) != RECT_HEIGHT(*oldClientRect)) 2377 if(RECT_WIDTH(rectClient) != RECT_WIDTH(*oldClientRect) || 2378 RECT_HEIGHT(rectClient) != RECT_HEIGHT(*oldClientRect)) 2371 2379 { 2372 2380 wpos->flags &= ~SWP_NOSIZE; … … 2824 2832 { 2825 2833 case GW_HWNDFIRST: 2826 if(getParent()) { 2827 window = (Win32BaseWindow *)getParent(); 2828 hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP); 2829 window = GetWindowFromOS2Handle(hwndRelated); 2830 if(window) { 2834 if(getParent()) 2835 { 2836 window = (Win32BaseWindow *)getParent(); 2837 hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP); 2838 window = GetWindowFromOS2Handle(hwndRelated); 2839 if(window) { 2831 2840 hwndRelated = window->getWindowHandle(); 2832 2833 2834 } 2835 else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop2841 } 2842 else hwndRelated = 0; 2843 } 2844 else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop 2836 2845 break; 2837 2846 2838 2847 case GW_HWNDLAST: 2839 2848 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_BOTTOM); 2840 window = GetWindowFromOS2Handle(hwndRelated);2841 if(window) {2849 window = GetWindowFromOS2Handle(hwndRelated); 2850 if(window) { 2842 2851 hwndRelated = window->getWindowHandle(); 2843 2852 } 2844 else hwndRelated = 0;2853 else hwndRelated = 0; 2845 2854 break; 2846 2855 2847 2856 case GW_HWNDNEXT: 2848 2857 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_NEXT); 2849 window = GetWindowFromOS2Handle(hwndRelated);2850 if(window) {2858 window = GetWindowFromOS2Handle(hwndRelated); 2859 if(window) { 2851 2860 hwndRelated = window->getWindowHandle(); 2852 2861 } 2853 else hwndRelated = 0;2862 else hwndRelated = 0; 2854 2863 break; 2855 2864 2856 2865 case GW_HWNDPREV: 2857 2866 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_PREV); 2858 window = GetWindowFromOS2Handle(hwndRelated);2859 if(window) {2867 window = GetWindowFromOS2Handle(hwndRelated); 2868 if(window) { 2860 2869 hwndRelated = window->getWindowHandle(); 2861 2870 } 2862 else hwndRelated = 0;2871 else hwndRelated = 0; 2863 2872 break; 2864 2873 … … 2871 2880 case GW_CHILD: 2872 2881 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP); 2873 window = GetWindowFromOS2Handle(hwndRelated);2874 if(window) {2882 window = GetWindowFromOS2Handle(hwndRelated); 2883 if(window) { 2875 2884 hwndRelated = window->getWindowHandle(); 2876 2885 } 2877 else hwndRelated = 0;2886 else hwndRelated = 0; 2878 2887 break; 2879 2888 } … … 2983 2992 BOOL rc; 2984 2993 2994 dprintf(("Win32BaseWindow::EnableWindow %x %d", getWindowHandle(), fEnable)); 2985 2995 //return true if previous state was disabled, else false (sdk docs) 2986 2996 rc = (getStyle() & WS_DISABLED) != 0; -
trunk/src/user32/win32wmdiclient.cpp
r4463 r4825 1 /* $Id: win32wmdiclient.cpp,v 1.3 0 2000-10-09 17:26:54sandervl Exp $ */1 /* $Id: win32wmdiclient.cpp,v 1.31 2000-12-17 15:04:12 sandervl Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 541 541 HMENU oldFrameMenu = ::GetMenu(hwndFrame); 542 542 543 if (hmenuFrame && !IsMenu(hmenuFrame)) 544 { 545 dprintf(("Win32MDIClientWindow::setMDIMenu: hmenuFrame is not a menu handle\n")); 546 return 0L; 547 } 548 549 if (hmenuWindow && !IsMenu(hmenuWindow)) 550 { 551 dprintf(("Win32MDIClientWindow::setMDIMenu: hmenuWindow is not a menu handle\n")); 552 return 0L; 553 } 554 543 555 if( maximizedChild && hmenuFrame && hmenuFrame!=oldFrameMenu ) 544 556 restoreFrameMenu(maximizedChild); … … 556 568 if( nActiveChildren ) 557 569 { 558 INT j = i - nActiveChildren + 1; 559 char buffer[100]; 560 UINT id,state; 570 INT j; 571 LPWSTR buffer = NULL; 572 MENUITEMINFOW mii; 573 INT nbWindowsMenuItems; /* num of documents shown + "More Windows..." if present */ 574 575 if (nActiveChildren <= MDI_MOREWINDOWSLIMIT) 576 nbWindowsMenuItems = nActiveChildren; 577 else 578 nbWindowsMenuItems = MDI_MOREWINDOWSLIMIT + 1; 579 580 j = i - nbWindowsMenuItems + 1; 561 581 562 582 for( ; i >= j ; i-- ) 563 583 { 564 id = GetMenuItemID(hWindowMenu,i ); 565 state = GetMenuState(hWindowMenu,i,MF_BYPOSITION); 566 567 GetMenuStringA(hWindowMenu, i, buffer, 100, MF_BYPOSITION); 568 569 DeleteMenu(hWindowMenu, i , MF_BYPOSITION); 570 InsertMenuA(hmenuWindow, pos, MF_BYPOSITION | MF_STRING, 571 id, buffer); 572 CheckMenuItem(hmenuWindow ,pos , MF_BYPOSITION | (state & MF_CHECKED)); 584 memset(&mii, 0, sizeof(mii)); 585 mii.cbSize = sizeof(mii); 586 mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE 587 | MIIM_SUBMENU | MIIM_TYPE | MIIM_BITMAP; 588 589 GetMenuItemInfoW(hWindowMenu, i, TRUE, &mii); 590 if(mii.cch) { /* Menu is MFT_STRING */ 591 mii.cch++; /* add room for '\0' */ 592 buffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 593 mii.cch * sizeof(WCHAR)); 594 mii.dwTypeData = buffer; 595 GetMenuItemInfoW(hWindowMenu, i, TRUE, &mii); 596 } 597 DeleteMenu(hWindowMenu, i, MF_BYPOSITION); 598 InsertMenuItemW(hmenuWindow, pos, TRUE, &mii); 599 if(buffer) { 600 HeapFree(GetProcessHeap(), 0, buffer); 601 buffer = NULL; 602 } 573 603 } 574 604 } … … 580 610 } 581 611 582 if ( hmenuFrame && hmenuFrame!=oldFrameMenu)612 if (hmenuFrame) 583 613 { 584 614 ::SetMenu(hwndFrame, hmenuFrame); 585 615 586 if (maximizedChild) 587 augmentFrameMenu(maximizedChild); 588 589 return oldFrameMenu; 616 if( hmenuFrame!=oldFrameMenu ) 617 { 618 if (maximizedChild) 619 augmentFrameMenu(maximizedChild); 620 621 return oldFrameMenu; 622 } 623 } 624 else 625 { 626 INT nItems = GetMenuItemCount(oldFrameMenu) - 1; 627 UINT iId = GetMenuItemID(oldFrameMenu,nItems) ; 628 629 if( !(iId == SC_RESTORE || iId == SC_CLOSE) ) 630 { 631 /* SetMenu() may already have been called, meaning that this window 632 * already has its menu. But they may have done a SetMenu() on 633 * an MDI window, and called MDISetMenu() after the fact, meaning 634 * that the "if" to this "else" wouldn't catch the need to 635 * augment the frame menu. 636 */ 637 if( maximizedChild ) 638 augmentFrameMenu(maximizedChild); 639 } 590 640 } 591 641 return 0; -
trunk/src/user32/windlg.cpp
r4421 r4825 1 /* $Id: windlg.cpp,v 1.1 8 2000-10-04 19:35:31sandervl Exp $ */1 /* $Id: windlg.cpp,v 1.19 2000-12-17 15:04:13 sandervl Exp $ */ 2 2 /* 3 3 * Win32 dialog apis for OS/2 … … 41 41 HANDLE hrsrc = FindResourceA( hInst, lpszTemplate, RT_DIALOGA ); 42 42 43 if (!hrsrc) 44 return 0; 43 if (!hrsrc) { 44 dprintf(("WARNING: CreateDialogParamA: Dialog %x not found!!", lpszTemplate)); 45 return 0; 46 } 45 47 46 48 return CreateDialogIndirectParamA(hInst, (LPCDLGTEMPLATEA)LoadResource(hInst, hrsrc), … … 55 57 HANDLE hrsrc = FindResourceW( hInst, lpszTemplate, RT_DIALOGW ); 56 58 57 if (!hrsrc) 58 return 0; 59 59 if (!hrsrc) { 60 dprintf(("WARNING: CreateDialogParamW: Dialog %x not found!!", lpszTemplate)); 61 return 0; 62 } 60 63 return CreateDialogIndirectParamW(hInst, (LPCDLGTEMPLATEW)LoadResource(hInst, hrsrc), 61 64 hwndOwner, dlgproc, lParamInit); -
trunk/src/user32/window.cpp
r4585 r4825 1 /* $Id: window.cpp,v 1.8 4 2000-11-11 18:39:31sandervl Exp $ */1 /* $Id: window.cpp,v 1.85 2000-12-17 15:04:13 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 1391 1391 } 1392 1392 1393 1394 1393 // get first child 1395 1394 hWnd = GetWindow (hwndParent, GW_CHILD); 1396 1395 1397 while (hWnd != NULL) {1398 1396 while (hWnd != NULL) 1397 { 1399 1398 // do I need to skip this window? 1400 1399 if (((uFlags & CWP_SKIPINVISIBLE) && … … 1404 1403 ((uFlags & CWP_SKIPTRANSPARENT) && 1405 1404 (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT))) 1406 1407 1405 { 1408 1406 hWnd = GetWindow (hWnd, GW_HWNDNEXT); … … 1421 1419 return hWnd; 1422 1420 } 1423 1424 1421 // the point is in the parentwindow but the parentwindow has no child 1425 1422 // at this coordinate 1426 1423 dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent)); 1427 1424 return hwndParent; 1428 1425 } … … 1447 1444 HWND WIN32API WindowFromPoint( POINT point) 1448 1445 { 1446 #if 0 1447 INT hittest = HTERROR; 1448 HWND retvalue = 0; 1449 HWND hwnd = GetDesktopWindow(); 1450 DWORD dwStyle; 1451 RECT rectWindow, rectClient; 1452 Win32BaseWindow *window; 1453 1454 dprintf(("WindowFromPoint (%d,%d)", point.x, point.y)); 1455 1456 while(hwnd) 1457 { 1458 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 1459 1460 /* If point is in window, and window is visible, and it */ 1461 /* is enabled (or it's a top-level window), then explore */ 1462 /* its children. Otherwise, go to the next window. */ 1463 dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 1464 1465 if ((dwStyle & WS_VISIBLE) && (!(dwStyle & WS_DISABLED) || 1466 ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD))) 1467 { 1468 GetWindowRect(hwnd, &rectWindow); 1469 if(PtInRect(&rectWindow, point) == TRUE) 1470 { 1471 /* If window is minimized or disabled, return at once */ 1472 if(dwStyle & WS_MINIMIZE) 1473 { 1474 break; 1475 } 1476 if(dwStyle & WS_DISABLED) 1477 { 1478 break; 1479 } 1480 retvalue = hwnd; 1481 1482 GetClientRect(hwnd, &rectClient); 1483 InflateRect(&rectClient, rectWindow.left, rectWindow.top); 1484 1485 /* If point is not in client area, ignore the children */ 1486 if(PtInRect(&rectClient, point) == FALSE) { 1487 break; 1488 } 1489 if(window->getFirstChild()) { 1490 hwnd = ((Win32BaseWindow *)window->getFirstChild())->getWindowHandle(); 1491 } 1492 else break; 1493 } 1494 else 1495 { 1496 if(window->getNextChild()) { 1497 hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle(); 1498 } 1499 else hwnd = 0; 1500 } 1501 } 1502 else 1503 { 1504 if(window->getNextChild()) { 1505 hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle(); 1506 } 1507 else hwnd = 0; 1508 } 1509 } 1510 1511 dprintf(("WindowFromPoint (%d,%d) -> %x", point.x, point.y, hwnd)); 1512 return retvalue; 1513 #else 1449 1514 HWND hwndOS2, hwnd; 1450 1515 POINT wPoint; … … 1464 1529 dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2)); 1465 1530 return windowDesktop->getWindowHandle(); 1531 #endif 1466 1532 } 1467 1533 //****************************************************************************** -
trunk/src/user32/winicon.cpp
r4689 r4825 1 /* $Id: winicon.cpp,v 1.1 8 2000-11-24 13:16:26sandervl Exp $ */1 /* $Id: winicon.cpp,v 1.19 2000-12-17 15:04:14 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Icon Code for OS/2 … … 597 597 if (DoStretch) 598 598 { 599 //TODO: rearrange mask if and & xor mask present!!!!!600 if(cbSize - size - colorsize - bwsize == bwsize)601 {602 dprintf(("TODO: rearrange mask because and & xor mask present!!!!!"));603 }604 599 if ((hAndBits = CreateBitmap(width, height, 1, 1, NULL))) 605 600 {
Note:
See TracChangeset
for help on using the changeset viewer.