Changeset 5685 for trunk/src/user32/oslibwin.cpp
- Timestamp:
- May 11, 2001, 10:39:46 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibwin.cpp
r5512 r5685 1 /* $Id: oslibwin.cpp,v 1.9 1 2001-04-15 17:05:29sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.92 2001-05-11 08:39:43 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 53 53 //****************************************************************************** 54 54 HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, 55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, 55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, 56 56 ULONG id, BOOL fTaskList,BOOL fShellPosition, 57 int classStyle )57 int classStyle, HWND *hwndFrame) 58 58 { 59 59 HWND hwndClient; 60 60 ULONG dwFrameStyle = 0; 61 61 62 if(pszName && *pszName == 0) {62 if(pszName && *pszName == 0) { 63 63 pszName = NULL; 64 }65 if(hwndParent == OSLIB_HWND_DESKTOP) {64 } 65 if(hwndParent == OSLIB_HWND_DESKTOP) { 66 66 hwndParent = HWND_DESKTOP; 67 }68 if(Owner == OSLIB_HWND_DESKTOP) {67 } 68 if(Owner == OSLIB_HWND_DESKTOP) { 69 69 Owner = HWND_DESKTOP; 70 } 71 72 if(classStyle & CS_SAVEBITS_W) dwWinStyle |= WS_SAVEBITS; 73 if(classStyle & CS_PARENTDC_W) dwWinStyle |= WS_PARENTCLIP; 74 75 dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP); 76 77 if(fTaskList) 78 { 79 dwFrameStyle |= FCF_NOMOVEWITHOWNER; 80 } 81 if (fShellPosition) dwFrameStyle |= FCF_SHELLPOSITION; 82 83 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0}; 84 FCData.flCreateFlags = dwFrameStyle; 85 86 dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x winstyle %x bottom %d", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle, dwWinStyle, fHWND_BOTTOM)); 87 88 return WinCreateWindow (hwndParent, 89 (hwndParent == HWND_DESKTOP) ? WIN32_STDFRAMECLASS : WIN32_STDCLASS, 90 pszName, dwWinStyle, 0, 0, 0, 0, 91 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP, 92 id, NULL, NULL); 70 } 71 72 if(classStyle & CS_SAVEBITS_W) dwWinStyle |= WS_SAVEBITS; 73 if(classStyle & CS_PARENTDC_W) dwWinStyle |= WS_PARENTCLIP; 74 75 dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP); 76 77 if(fTaskList) 78 { 79 dwFrameStyle |= FCF_NOMOVEWITHOWNER; 80 } 81 if (fShellPosition) dwFrameStyle |= FCF_SHELLPOSITION; 82 83 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0}; 84 FCData.flCreateFlags = dwFrameStyle; 85 86 dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x winstyle %x bottom %d", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle, dwWinStyle, fHWND_BOTTOM)); 87 88 //Must not use WS_CLIPCHILDREN style with frame window. Transparency won't work otherwise. 89 //Eg: dialog parent, groupbox; invalidate part of groupbox -> painting algorithm stops when it finds 90 // a window with WS_CLIPCHILDREN -> result: dialog window won't update groupbox background as groupbox only draws the border 91 *hwndFrame = WinCreateWindow(hwndParent, 92 WIN32_STDFRAMECLASS, 93 pszName, (dwWinStyle & ~WS_CLIPCHILDREN), 0, 0, 0, 0, 94 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP, 95 id, NULL, NULL); 96 hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS, 97 NULL, dwWinStyle | WS_VISIBLE, 0, 0, 0, 0, 98 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL); 99 return hwndClient; 93 100 } 94 101 //****************************************************************************** … … 294 301 rc = WinSetActiveWindow(HWND_DESKTOP, hwnd); 295 302 if(rc == FALSE) { 296 303 dprintf(("WinSetActiveWindow %x failure: %x", hwnd, OSLibWinGetLastError())); 297 304 } 298 305 return rc; … … 394 401 //****************************************************************************** 395 402 //****************************************************************************** 396 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, 397 int parentHeight, int clientOrgX, int clientOrgY, 398 HWND hwnd) 403 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, 404 int parentHeight, HWND hwnd) 399 405 { 400 406 HWND hWindow = pswp->hwnd; 401 407 HWND hWndInsertAfter = pswp->hwndInsertBehind; 402 long x = pswp->x - clientOrgX;403 long y = pswp->y + clientOrgY;408 long x = pswp->x; 409 long y = pswp->y; 404 410 long cx = pswp->cx; 405 411 long cy = pswp->cy; … … 467 473 //****************************************************************************** 468 474 //****************************************************************************** 469 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, 470 int parentHeight, int clientOrgX, int clientOrgY,HWND hFrame)475 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, 476 int parentHeight, HWND hFrame) 471 477 { 472 478 BOOL fCvt = FALSE; … … 474 480 HWND hWnd = pwpos->hwnd; 475 481 HWND hWndInsertAfter = pwpos->hwndInsertAfter; 476 long x = pwpos->x + clientOrgX;477 long y = pwpos->y + clientOrgY;482 long x = pwpos->x; 483 long y = pwpos->y; 478 484 long cx = pwpos->cx; 479 485 long cy = pwpos->cy; … … 546 552 } 547 553 //****************************************************************************** 548 //Position in screen coordinates 554 //****************************************************************************** 555 void OSLibWinSetClientPos(HWND hwnd, int x, int y, int cx, int cy, int parentHeight) 556 { 557 SWP swp; 558 BOOL rc; 559 560 swp.hwnd = hwnd; 561 swp.hwndInsertBehind = 0; 562 swp.x = x; 563 swp.y = parentHeight - y - cy; 564 swp.cx = cx; 565 swp.cy = cy; 566 swp.fl = SWP_MOVE | SWP_SIZE; 567 568 dprintf(("OSLibWinSetClientPos (%d,%d) (%d,%d) -> (%d,%d) (%d,%d)", x, y, x+cx, y+cy, swp.x, swp.y, swp.x+swp.cx, swp.y+swp.cy)); 569 570 rc = WinSetMultWindowPos(GetThreadHAB(), &swp, 1); 571 if(rc == FALSE) { 572 dprintf(("OSLibWinSetClientPos: WinSetMultWindowPos %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); 573 } 574 } 575 //****************************************************************************** 549 576 //****************************************************************************** 550 577 BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient) … … 716 743 //****************************************************************************** 717 744 //****************************************************************************** 718 void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, ULONG dwExStyle) 719 { 720 ULONG dwWinStyle = WinQueryWindowULong(hwnd, QWL_STYLE); 721 ULONG dwOldWinStyle = dwWinStyle; 722 723 if(dwStyle & WS_DISABLED_W) { 724 dwWinStyle |= WS_DISABLED; 725 } 726 else dwWinStyle &= ~WS_DISABLED; 727 728 if(dwStyle & WS_CLIPSIBLINGS_W) { 729 dwWinStyle |= WS_CLIPSIBLINGS; 730 } 731 else dwWinStyle &= ~WS_CLIPSIBLINGS; 732 733 if(dwStyle & WS_CLIPCHILDREN_W) { 734 dwWinStyle |= WS_CLIPCHILDREN; 735 } 736 else dwWinStyle &= ~WS_CLIPCHILDREN; 737 738 if(dwWinStyle != dwOldWinStyle) { 739 WinSetWindowULong(hwnd, QWL_STYLE, dwWinStyle); 740 } 745 void OSLibSetWindowStyle(HWND hwndFrame, HWND hwndClient, ULONG dwStyle, ULONG dwExStyle) 746 { 747 ULONG dwWinStyle; 748 ULONG dwOldWinStyle; 749 750 //client window: 751 dwWinStyle = WinQueryWindowULong(hwndClient, QWL_STYLE); 752 dwOldWinStyle = dwWinStyle; 753 754 if(dwStyle & WS_CLIPCHILDREN_W) { 755 dwWinStyle |= WS_CLIPCHILDREN; 756 } 757 else dwWinStyle &= ~WS_CLIPCHILDREN; 758 759 if(dwWinStyle != dwOldWinStyle) { 760 WinSetWindowULong(hwndClient, QWL_STYLE, dwWinStyle); 761 } 762 763 //Frame window 764 dwWinStyle = WinQueryWindowULong(hwndFrame, QWL_STYLE); 765 dwOldWinStyle = dwWinStyle; 766 if(dwStyle & WS_DISABLED_W) { 767 dwWinStyle |= WS_DISABLED; 768 } 769 else dwWinStyle &= ~WS_DISABLED; 770 771 if(dwStyle & WS_CLIPSIBLINGS_W) { 772 dwWinStyle |= WS_CLIPSIBLINGS; 773 } 774 else dwWinStyle &= ~WS_CLIPSIBLINGS; 775 776 if(dwWinStyle != dwOldWinStyle) { 777 WinSetWindowULong(hwndFrame, QWL_STYLE, dwWinStyle); 778 } 741 779 } 742 780 //****************************************************************************** … … 744 782 DWORD OSLibQueryWindowStyle(HWND hwnd) 745 783 { 746 return WinQueryWindowULong(hwnd, QWL_STYLE);784 return WinQueryWindowULong(hwnd, QWL_STYLE); 747 785 } 748 786 //****************************************************************************** … … 750 788 void OSLibWinSetVisibleRegionNotify(HWND hwnd, BOOL fNotify) 751 789 { 752 WinSetVisibleRegionNotify(hwnd, fNotify);790 WinSetVisibleRegionNotify(hwnd, fNotify); 753 791 } 754 792 //****************************************************************************** … … 756 794 HWND OSLibWinQueryCapture() 757 795 { 758 return WinQueryCapture(HWND_DESKTOP);796 return WinQueryCapture(HWND_DESKTOP); 759 797 } 760 798 //****************************************************************************** … … 762 800 BOOL OSLibWinSetCapture(HWND hwnd) 763 801 { 764 return WinSetCapture(HWND_DESKTOP, hwnd);802 return WinSetCapture(HWND_DESKTOP, hwnd); 765 803 } 766 804 //****************************************************************************** … … 768 806 BOOL OSLibWinRemoveFromTasklist(HANDLE hTaskList) 769 807 { 770 return (WinRemoveSwitchEntry(hTaskList)) ? FALSE : TRUE;808 return (WinRemoveSwitchEntry(hTaskList)) ? FALSE : TRUE; 771 809 } 772 810 //****************************************************************************** … … 774 812 HANDLE OSLibWinAddToTaskList(HWND hwndFrame, char *title, BOOL fVisible) 775 813 { 776 SWCNTRL swctrl;777 ULONG tid;778 779 swctrl.hwnd = hwndFrame;780 swctrl.hwndIcon = 0;781 swctrl.hprog = 0;782 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid);783 swctrl.idSession = 0;784 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE;785 swctrl.fbJump = SWL_JUMPABLE;786 swctrl.bProgType = PROG_PM;787 if(title) {788 789 790 }791 else {792 793 794 }795 return WinAddSwitchEntry(&swctrl);814 SWCNTRL swctrl; 815 ULONG tid; 816 817 swctrl.hwnd = hwndFrame; 818 swctrl.hwndIcon = 0; 819 swctrl.hprog = 0; 820 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid); 821 swctrl.idSession = 0; 822 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE; 823 swctrl.fbJump = SWL_JUMPABLE; 824 swctrl.bProgType = PROG_PM; 825 if(title) { 826 strncpy(swctrl.szSwtitle, title, MAXNAMEL+4); 827 swctrl.szSwtitle[MAXNAMEL+4-1] = 0; 828 } 829 else { 830 swctrl.szSwtitle[0] = 0; 831 swctrl.uchVisibility = SWL_INVISIBLE; 832 } 833 return WinAddSwitchEntry(&swctrl); 796 834 } 797 835 //****************************************************************************** … … 799 837 BOOL OSLibWinChangeTaskList(HANDLE hTaskList, HWND hwndFrame, char *title, BOOL fVisible) 800 838 { 801 SWCNTRL swctrl;802 ULONG tid;803 804 swctrl.hwnd = hwndFrame;805 swctrl.hwndIcon = 0;806 swctrl.hprog = 0;807 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid);808 swctrl.idSession = 0;809 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE;810 swctrl.fbJump = SWL_JUMPABLE;811 swctrl.bProgType = PROG_PM;812 if(title) {813 814 815 }816 else {817 818 819 }820 return (WinChangeSwitchEntry(hTaskList, &swctrl)) ? FALSE : TRUE;839 SWCNTRL swctrl; 840 ULONG tid; 841 842 swctrl.hwnd = hwndFrame; 843 swctrl.hwndIcon = 0; 844 swctrl.hprog = 0; 845 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid); 846 swctrl.idSession = 0; 847 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE; 848 swctrl.fbJump = SWL_JUMPABLE; 849 swctrl.bProgType = PROG_PM; 850 if(title) { 851 strncpy(swctrl.szSwtitle, title, MAXNAMEL+4); 852 swctrl.szSwtitle[MAXNAMEL+4-1] = 0; 853 } 854 else { 855 swctrl.szSwtitle[0] = 0; 856 swctrl.uchVisibility = SWL_INVISIBLE; 857 } 858 return (WinChangeSwitchEntry(hTaskList, &swctrl)) ? FALSE : TRUE; 821 859 } 822 860 //****************************************************************************** … … 824 862 BOOL OSLibWinLockWindowUpdate(HWND hwnd) 825 863 { 826 return WinLockWindowUpdate(HWND_DESKTOP, (HWND)hwnd);864 return WinLockWindowUpdate(HWND_DESKTOP, (HWND)hwnd); 827 865 } 828 866 //****************************************************************************** … … 830 868 ULONG OSLibGetScreenHeight() 831 869 { 832 return ScreenHeight;870 return ScreenHeight; 833 871 } 834 872 //****************************************************************************** … … 836 874 ULONG OSLibGetScreenWidth() 837 875 { 838 return ScreenWidth;876 return ScreenWidth; 839 877 } 840 878 //****************************************************************************** … … 845 883 { 846 884 SWP swp; 847 848 if(!WinGetMaxPosition(hwndOS2, &swp)) {849 850 851 }852 rect->left = swp.x;853 rect->right = swp.x + swp.cx;854 rect->top = ScreenHeight - (swp.y + swp.cy);855 rect->bottom = ScreenHeight - swp.y;856 return TRUE;885 886 if(!WinGetMaxPosition(hwndOS2, &swp)) { 887 dprintf(("WARNING: WinGetMaxPosition %x returned FALSE", hwndOS2)); 888 return FALSE; 889 } 890 rect->left = swp.x; 891 rect->right = swp.x + swp.cx; 892 rect->top = ScreenHeight - (swp.y + swp.cy); 893 rect->bottom = ScreenHeight - swp.y; 894 return TRUE; 857 895 } 858 896 //****************************************************************************** … … 860 898 BOOL OSLibWinShowPointer(BOOL fShow) 861 899 { 862 return WinShowPointer(HWND_DESKTOP, fShow);863 } 864 //****************************************************************************** 865 //****************************************************************************** 900 return WinShowPointer(HWND_DESKTOP, fShow); 901 } 902 //****************************************************************************** 903 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.