Changeset 10316 for trunk/src/user32
- Timestamp:
- Nov 12, 2003, 3:13:26 PM (22 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/USER32.DEF
r10256 r10316 1 ; $Id: USER32.DEF,v 1.8 1 2003-10-02 10:35:59sandervl Exp $1 ; $Id: USER32.DEF,v 1.82 2003-11-12 14:10:18 sandervl Exp $ 2 2 3 3 LIBRARY USER32 INITINSTANCE TERMINSTANCE … … 642 642 SetWinEventHook = _SetWinEventHook@28 @608 643 643 644 GetAncestor = _GetAncestor@8 @609 645 GetWindowModuleFileNameA = _GetWindowModuleFileNameA@12 @610 646 644 647 ;------------ 645 648 ; Windows 98 -
trunk/src/user32/dbgwrap.cpp
r10190 r10316 698 698 DEBUGWRAP0(GetForegroundWindow) 699 699 DEBUGWRAP4(GetLastActivePopup) 700 DEBUGWRAP12(GetWindowModuleFileNameA) 700 701 DEBUGWRAP8(GetNextQueueWindow) 701 702 DEBUGWRAP4(GetParent) 702 703 DEBUGWRAP4(GetTopWindow) 703 704 DEBUGWRAP8(GetWindow) 705 DEBUGWRAP8(GetAncestor) 704 706 DEBUGWRAP4(GetWindowContextHelpId) 705 707 DEBUGWRAP8(GetWindowRect) … … 754 756 DEBUGWRAP4(GetDC) 755 757 DEBUGWRAP12(GetDCEx) 756 DEBUGWRAP12(FillRect)757 DEBUGWRAP12(FrameRect)758 758 DEBUGWRAP4(GetWindowDC) 759 759 DEBUGWRAP8(ReleaseDC) … … 764 764 DEBUGWRAP12(InvalidateRect) 765 765 DEBUGWRAP12(InvalidateRgn) 766 DEBUGWRAP8(InvertRect)767 766 DEBUGWRAP8(ValidateRect) 768 767 DEBUGWRAP8(ValidateRgn) -
trunk/src/user32/dc.cpp
r10093 r10316 1 /* $Id: dc.cpp,v 1.12 1 2003-05-15 13:12:52sandervl Exp $ */1 /* $Id: dc.cpp,v 1.122 2003-11-12 14:10:18 sandervl Exp $ */ 2 2 3 3 /* … … 594 594 HDC hdc; 595 595 HPS hps; 596 HRGN hrgnUpdate , hrgnOld, hrgnClip, hrgnCombined;596 HRGN hrgnUpdate; 597 597 RECTL rectl = { 1, 1, 2, 2 }; 598 pDCData pHps = NULLHANDLE; 598 599 599 600 hwnd = wnd->getOS2WindowHandle(); … … 602 603 hrgnUpdate = GpiCreateRegion (hps, 1, &rectl); 603 604 WinQueryUpdateRegion (hwnd, hrgnUpdate); 604 hrgnClip = GpiQueryClipRegion (hps);605 606 if (hrgnClip == NULLHANDLE)607 {608 GpiSetClipRegion (hps, hrgnUpdate, &hrgnOld);609 }610 else611 {612 hrgnCombined = GpiCreateRegion (hps, 1, &rectl);613 GpiCombineRegion (hps, hrgnCombined, hrgnClip, hrgnUpdate, CRGN_AND);614 GpiSetClipRegion (hps, hrgnCombined, &hrgnOld);615 GpiDestroyRegion (hps, hrgnUpdate);616 GpiDestroyRegion (hps, hrgnClip);617 }618 if (hrgnOld != NULLHANDLE)619 GpiDestroyRegion (hps, hrgnOld);620 605 621 606 hdc = HPSToHDC (hwnd, hps, NULL, NULL); 607 608 pHps = (pDCData)GpiQueryDCData(hps); 609 GdiSetVisRgn(pHps, hrgnUpdate); 622 610 623 611 erased = wnd->MsgEraseBackGround (hdc); … … 676 664 return (HDC)0; 677 665 } 678 // bIcon = (IsIconic(hwnd) && GetClassLongA(hWnd, GCL_HICON_W));679 666 bIcon = IsIconic(hwnd); 680 667 … … 725 712 } 726 713 727 HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectl); 728 GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip); 714 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint) 715 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip)); 716 wnd->SaveClipRegion(pHps->hrgnWin32Clip); 717 wnd->SaveVisRegion(pHps->hrgnWinVis); 718 719 //clear visible and clip regions 720 pHps->hrgnWin32Clip = NULLHANDLE; 721 pHps->hrgnWinVis = NULLHANDLE; 722 723 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectl); 724 GdiSetVisRgn(pHps, hrgnVis); 729 725 730 726 selectClientArea(wnd, pHps); 731 727 732 //save old clip region (restored for CS_OWNDC windows in EndPaint)733 wnd->SetClipRegion(hrgnOldClip);734 728 if(bIcon) { 735 729 lComplexity = RGN_RECT; … … 742 736 743 737 //Query update region 744 HRGN hrgn Clip= GpiCreateRegion(pHps->hps, 1, &rectlClip);745 WinQueryUpdateRegion(hwndClient, hrgn Clip);746 WinValidateRegion(hwndClient, hrgn Clip, FALSE);747 748 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgn Clip);738 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectlClip); 739 WinQueryUpdateRegion(hwndClient, hrgnVis); 740 WinValidateRegion(hwndClient, hrgnVis, FALSE); 741 742 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgnVis); 749 743 750 744 #ifdef DEBUG … … 754 748 #endif 755 749 750 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint) 751 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip)); 752 wnd->SaveClipRegion(pHps->hrgnWin32Clip); 753 wnd->SaveVisRegion(pHps->hrgnWinVis); 754 755 //clear visible and clip regions 756 pHps->hrgnWin32Clip = NULLHANDLE; 757 pHps->hrgnWinVis = NULLHANDLE; 758 756 759 //set clip region 757 lComplexity = G piSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);758 759 if(lComplexity == RGN_NULL) {760 lComplexity = GdiSetVisRgn(pHps, hrgnVis); 761 762 if(lComplexity == NULLREGION_W) { 760 763 dprintf (("BeginPaint %x: EMPTY update rectangle (vis=%d/%d show=%d/%d", hWnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()))); 761 764 } … … 769 772 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectlClip.xLeft, rectlClip.yBottom, rectlClip.xRight, rectlClip.yTop)); 770 773 #endif 771 //save old clip region (restored for CS_OWNDC windows in EndPaint)772 wnd->SetClipRegion(hrgnOldClip);773 774 } 774 775 … … 783 784 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE); 784 785 785 if((wnd->needsEraseBkgnd() || wnd-> IsVisibleRegionChanged()) && lComplexity != RGN_NULL) {786 wnd->setEraseBkgnd(FALSE);787 wnd->SetVisibleRegionChanged(FALSE);788 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0);786 if((wnd->needsEraseBkgnd() || wnd->hasPMUpdateRegionChanged()) && lComplexity != RGN_NULL) { 787 wnd->setEraseBkgnd(FALSE); 788 wnd->SetPMUpdateRegionChanged(FALSE); 789 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0); 789 790 } 790 791 else lpps->fErase = TRUE; … … 817 818 { 818 819 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP; 819 HRGN hrgnOld;820 820 pDCData pHps; 821 821 … … 832 832 if (pHps && (pHps->hdcType == TYPE_3)) 833 833 { 834 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld); 835 wnd->SetClipRegion(0); 836 if(hrgnOld) { 837 GpiDestroyRegion(pHps->hps, hrgnOld); 838 } 834 //restore previous visible and clip regions 835 pHps->hrgnWin32Clip = NULLHANDLE; 836 pHps->hrgnWinVis = NULLHANDLE; 837 838 GdiSetVisRgn(pHps, wnd->GetVisRegion()); 839 GdiCombineVisRgnClipRgn(pHps, wnd->GetClipRegion(), RGN_AND_W); 840 841 wnd->SaveClipRegion(0); 842 wnd->SaveVisRegion(0); 843 839 844 pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails 840 845 ReleaseDC(hwnd, pPaint->hdc); … … 879 884 if(pHps && pHps->psType == MICRO_CACHED) { 880 885 removeClientArea(wnd, pHps); 881 if(pHps->hrgnVis) { 882 GreDestroyRegion(pHps->hps, pHps->hrgnVis); 883 pHps->hrgnVis = 0; 886 if(pHps->hrgnWinVis) { 887 GreDestroyRegion(pHps->hps, pHps->hrgnWinVis); 888 pHps->hrgnWinVis = 0; 889 } 890 if(pHps->hrgnWin32Clip) { 891 GreDestroyRegion(pHps->hps, pHps->hrgnWin32Clip); 892 pHps->hrgnWin32Clip = 0; 884 893 } 885 894 } … … 912 921 } 913 922 //****************************************************************************** 914 // This implementation of GetDCEx supports 923 // This implementation of GetDCEx supports: 924 // 915 925 // DCX_WINDOW 916 926 // DCX_CACHE … … 922 932 // DCX_PARENTCLIP 923 933 // 934 // Not supported: 935 // 936 // DCX_NORESETATTRS_W 937 // DCX_INTERSECTUPDATE_W 938 // DCX_LOCKWINDOWUPDATE_W 939 // DCX_VALIDATE_W 940 // DCX_EXCLUDEUPDATE_W 941 // 924 942 //TODO: WM_SETREDRAW affects drawingAllowed flag!! 925 943 //****************************************************************************** … … 935 953 BOOL creatingOwnDC = FALSE; 936 954 PS_Type psType; 955 956 if(flags & (DCX_NORESETATTRS_W | DCX_INTERSECTUPDATE_W | DCX_LOCKWINDOWUPDATE_W | DCX_VALIDATE_W | DCX_EXCLUDEUPDATE_W)) { 957 dprintf(("ERROR: GetDCEx: unsupported flags %x!!", flags)); 958 DebugInt3(); 959 } 937 960 938 961 if(hwnd == 0) { … … 1066 1089 success = TRUE; 1067 1090 if (flags & DCX_EXCLUDERGN_W) 1068 { 1069 #if 0 //CB: todo 1070 long height; 1071 1072 BytesNeeded = GetRegionData (hrgn, 0, NULL); 1073 RgnData = (PRGNDATA_W)_alloca (BytesNeeded); 1074 if (RgnData == NULL) 1075 goto error; 1076 GetRegionData (hrgn, BytesNeeded, RgnData); 1077 1078 i = RgnData->rdh.nCount; 1079 pr = (PRECT)(RgnData->Buffer); 1080 1081 if (flags & DCX_WINDOW_W) 1082 height = wnd->getWindowHeight(); 1083 else height = wnd->getClientHeight(); 1084 1085 for (; (i > 0) && success; i--, pr++) { 1086 LONG y = pr->yBottom; 1087 1088 pr->yBottom = height - pr->yTop; 1089 pr->yTop = height - y; 1090 success &= GpiExcludeClipRectangle (pHps->hps, pr); 1091 } 1092 #endif 1091 {//exclude specified region from visible region 1092 success = (GdiCombineVisRgn(pHps, hrgn, RGN_DIFF_W) != ERROR_W); 1093 1093 } 1094 1094 else //DCX_INTERSECTRGN_W 1095 { 1096 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx 1097 // with a region that covers the entire window (RealPlayer 7 Update 1) 1098 // Using SelectClipRgn here doesn't make any difference. 1099 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) { 1100 dprintf(("ExtSelectClipRgn failed!!")); 1101 } 1095 {//intersect visible region with specified region 1096 success = (GdiCombineVisRgn(pHps, hrgn, RGN_AND_W) != ERROR_W); 1102 1097 } 1103 1098 if (!success) … … 1292 1287 //already (partly) invalidated 1293 1288 if (!WinQueryUpdateRect (hwnd, NULL)) { 1289 dprintf(("RDW_INVALIDATE: no update rectangle, disable %x WM_ERASEBKGND", wnd->getWindowHandle())); 1294 1290 wnd->setEraseBkgnd(FALSE); 1295 1291 } … … 1332 1328 else if (redraw & RDW_VALIDATE_W) 1333 1329 { 1334 if (redraw & RDW_NOERASE_W) 1330 if (redraw & RDW_NOERASE_W) { 1331 dprintf(("RDW_NOERASE: disable %x WM_ERASEBKGND", wnd->getWindowHandle())); 1335 1332 wnd->setEraseBkgnd(FALSE); 1336 1333 } 1337 1334 if (WinQueryUpdateRect (hwnd, NULL)) 1338 1335 { -
trunk/src/user32/dc.h
r5685 r10316 1 /* $Id: dc.h,v 1.1 7 2001-05-11 08:39:42sandervl Exp $ */1 /* $Id: dc.h,v 1.18 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 /* 3 3 * public dc functions … … 22 22 BOOL GetOS2UpdateRect(Win32BaseWindow *window,LPRECT pRect); 23 23 24 int WIN32API GetUpdateRgnFrame(HWND hwnd, HRGN hrgn); 25 24 26 #ifdef DEBUG 25 27 void dprintfOrigin(HDC hdc); … … 30 32 #ifdef INCLUDED_BY_DC 31 33 /*********************/ 32 typedef struct33 {34 HDC hdc;35 BOOL fErase;36 RECT rcPaint;37 BOOL fRestore;38 BOOL IncUpdate;39 BYTE rgbReserved[32];40 } PAINTSTRUCT_W, *PPAINTSTRUCT_W, *LPPAINTSTRUCT_W;41 42 #define PS_SOLID_W 0x0000000043 #define PS_DASH_W 0x0000000144 #define PS_DOT_W 0x0000000245 #define PS_DASHDOT_W 0x0000000346 #define PS_DASHDOTDOT_W 0x0000000447 #define PS_NULL_W 0x0000000548 #define PS_INSIDEFRAME_W 0x0000000649 #define PS_USERSTYLE_W 0x0000000750 #define PS_ALTERNATE_W 0x0000000851 #define PS_STYLE_MASK_W 0x0000000f52 53 typedef struct54 {55 UINT lopnStyle;56 POINT lopnWidth;57 ULONG lopnColor;58 } LOGPEN_W, *LPLOGPEN_W;59 60 typedef struct tagEXTLOGPEN61 {62 DWORD elpPenStyle;63 DWORD elpWidth;64 DWORD elpBrushStyle;65 DWORD elpColor;66 DWORD elpNumEntries;67 DWORD elpStyleEntry[1];68 } EXTLOGPEN_W, *PEXTLOGPEN_W, *NPEXTLOGPEN_W, *LPEXTLOGPEN_W;69 70 typedef struct71 {72 UINT lbStyle;73 ULONG lbColor;74 INT lbHatch;75 } LOGBRUSH_W, *LPLOGBRUSH_W;76 34 77 35 typedef struct _penobject … … 90 48 } tPenObject, *pPenObject; 91 49 92 /* DC Graphics Mode */93 #define GM_COMPATIBLE_W 194 #define GM_ADVANCED_W 295 96 #define DCX_WINDOW_W 0x00000001L97 #define DCX_CACHE_W 0x00000002L98 #define DCX_NORESETATTRS_W 0x00000004L99 #define DCX_CLIPCHILDREN_W 0x00000008L100 #define DCX_CLIPSIBLINGS_W 0x00000010L101 #define DCX_PARENTCLIP_W 0x00000020L102 #define DCX_EXCLUDERGN_W 0x00000040L103 #define DCX_INTERSECTRGN_W 0x00000080L104 #define DCX_EXCLUDEUPDATE_W 0x00000100L105 #define DCX_INTERSECTUPDATE_W 0x00000200L106 #define DCX_LOCKWINDOWUPDATE_W 0x00000400L107 #define DCX_USESTYLE_W 0x00010000L108 #define DCX_VALIDATE_W 0x00200000L109 110 #define RDW_INVALIDATE_W 0x0001111 #define RDW_INTERNALPAINT_W 0x0002112 #define RDW_ERASE_W 0x0004113 #define RDW_VALIDATE_W 0x0008114 #define RDW_NOINTERNALPAINT_W 0x0010115 #define RDW_NOERASE_W 0x0020116 #define RDW_NOCHILDREN_W 0x0040117 #define RDW_ALLCHILDREN_W 0x0080118 #define RDW_UPDATENOW_W 0x0100119 #define RDW_ERASENOW_W 0x0200120 #define RDW_FRAME_W 0x0400121 #define RDW_NOFRAME_W 0x0800122 /* Xform FLAGS */123 #define MWT_IDENTITY_W 1124 #define MWT_LEFTMULTIPLY_W 2125 #define MWT_RIGHTMULTIPLY_W 3126 127 /* Mapping Modes */128 #define MM_TEXT_W 1129 #define MM_LOMETRIC_W 2130 #define MM_HIMETRIC_W 3131 #define MM_LOENGLISH_W 4132 #define MM_HIENGLISH_W 5133 #define MM_TWIPS_W 6134 #define MM_ISOTROPIC_W 7135 #define MM_ANISOTROPIC_W 8136 137 #define RGN_OR_W 2138 139 /* Window scrolling */140 #define SW_SCROLLCHILDREN_W 0x0001141 #define SW_INVALIDATE_W 0x0002142 #define SW_ERASE_W 0x0004143 #define SW_SMOOTHSCROLL_W 0x0010144 50 145 51 /*********************/ -
trunk/src/user32/dcrgn.cpp
r9933 r10316 1 /* $Id: dcrgn.cpp,v 1. 8 2003-03-22 20:27:11sandervl Exp $ */1 /* $Id: dcrgn.cpp,v 1.9 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 3 3 /* … … 42 42 #include "dbglocal.h" 43 43 44 #ifdef DEBUG 45 //#define dprintfRegion(a,b,c) if(DbgEnabledLvl2USER32[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c) 46 //#define dprintfRegion(a,b,c) dprintfRegion1(a,b,c) 47 48 static void dprintfRegion(HWND hWnd, HRGN hrgnClip) 49 { 50 RGNRECT rgnRect = {0, 16, 0, RECTDIR_LFRT_TOPBOT}; 51 RECTL rectRegion[16]; 52 APIRET rc; 53 HDC hdc; 54 55 hdc = GetDCEx(hWnd, NULL, DCX_CACHE_W|DCX_USESTYLE_W); 56 dprintf(("dprintfRegion %x %x", hWnd, hdc)); 57 rc = GpiQueryRegionRects(hdc, hrgnClip, NULL, &rgnRect, &rectRegion[0]); 58 for(int i=0;i<rgnRect.crcReturned;i++) { 59 dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop)); 60 } 61 ReleaseDC(hWnd, hdc); 62 } 63 #else 64 #define dprintfRegion(b,c) 65 #endif 66 44 67 //****************************************************************************** 45 68 //****************************************************************************** … … 134 157 if(lComplexity != RGN_NULL) 135 158 { 159 dprintfRegion(hwnd, hrgn); 136 160 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle())) 137 161 { … … 142 166 } 143 167 if(erase) sendEraseBkgnd(wnd); 168 } 169 RELEASE_WNDOBJ(wnd); 170 return lComplexity; 171 } 172 //****************************************************************************** 173 //TODO: Seems to return region in window coordinates instead of client coordinates 174 //****************************************************************************** 175 int WIN32API GetUpdateRgnFrame(HWND hwnd, HRGN hrgn) 176 { 177 LONG lComplexity; 178 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 179 180 hrgn = ObjWinToOS2Region(hrgn); 181 if(!wnd || !hrgn) 182 { 183 dprintf(("WARNING: GetUpdateRgnFrame %x %x invalid handle", hwnd, hrgn)); 184 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 185 if(wnd) RELEASE_WNDOBJ(wnd); 186 return ERROR_W; 187 } 188 lComplexity = WinQueryUpdateRegion(wnd->getOS2FrameWindowHandle(), hrgn); 189 if(lComplexity == RGN_ERROR) { 190 dprintf(("WARNING: GetUpdateRgnFrame %x %x RGN_ERROR", hwnd, hrgn)); 191 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 192 RELEASE_WNDOBJ(wnd); 193 return ERROR_W; 194 } 195 196 if(lComplexity != RGN_NULL) 197 { 198 dprintfRegion(hwnd, hrgn); 199 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2FrameWindowHandle())) 200 { 201 dprintf(("WARNING: GetUpdateRgnFrame %x %x; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn)); 202 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 203 RELEASE_WNDOBJ(wnd); 204 return ERROR_W; 205 } 144 206 } 145 207 RELEASE_WNDOBJ(wnd); -
trunk/src/user32/inituser32.cpp
r10284 r10316 1 /* $Id: inituser32.cpp,v 1.1 6 2003-10-22 12:43:13sandervl Exp $ */1 /* $Id: inituser32.cpp,v 1.17 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 /* 3 3 * USER32 DLL entry point … … 71 71 extern INT __cdecl wsnprintfA(LPSTR,UINT,LPCSTR,...); 72 72 73 static char PMKBDHK_MODULE[16] = STD_PMKBDHK_MODULE;74 75 static BOOL pmkbdhk_installed = FALSE;76 static HMODULE hmodPMKBDHK;77 78 static PFN_HOOKINIT pfnHookInit = NULL;79 static PFN_HOOKTERM pfnHookTerm = NULL;80 81 // defined initialized in pmwindow.cpp: InitPM()82 extern HAB hab;83 84 //******************************************************************************85 //******************************************************************************86 void WIN32API SetCustomPMHookDll(LPSTR pszKbdDllName)87 {88 strcpy(PMKBDHK_MODULE, pszKbdDllName);89 }90 //******************************************************************************91 //******************************************************************************92 void pmkbdhk_initialize(HAB _hab)93 {94 APIRET rc;95 96 if ((pmkbdhk_installed == FALSE) && PMKBDHK_MODULE[0])97 {98 CHAR szBuf[260];99 100 // load the DLL101 rc = DosLoadModule(szBuf,102 sizeof(szBuf),103 PMKBDHK_MODULE,104 &hmodPMKBDHK);105 if (NO_ERROR != rc)106 {107 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed rc=%d\n",108 _hab,109 rc));110 111 return;112 }113 114 // get the entry points115 rc = DosQueryProcAddr(hmodPMKBDHK,116 0,117 PMKBDHK_HOOK_INIT,118 (PFN*)&pfnHookInit);119 if (NO_ERROR == rc)120 rc = DosQueryProcAddr(hmodPMKBDHK,121 0,122 PMKBDHK_HOOK_TERM,123 (PFN*)&pfnHookTerm);124 125 if (NO_ERROR != rc)126 {127 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed importing functions, rc=%d\n",128 _hab,129 rc));130 131 // free the DLL again132 DosFreeModule(hmodPMKBDHK);133 hmodPMKBDHK = NULLHANDLE;134 135 return;136 }137 138 // now finally call the initializer function139 if(pfnHookInit(_hab, WIN32_STDCLASS) == FALSE) DebugInt3();140 141 // OK, hook is armed142 pmkbdhk_installed = TRUE;143 }144 }145 //******************************************************************************146 //******************************************************************************147 void pmkbdhk_terminate(void)148 {149 if (pmkbdhk_installed == TRUE)150 {151 // call the terminator function152 pfnHookTerm();153 154 // OK, hook is disarmed155 pmkbdhk_installed = FALSE;156 }157 158 // unload the dll159 if (NULLHANDLE != hmodPMKBDHK)160 {161 APIRET rc = DosFreeModule(hmodPMKBDHK);162 if (NO_ERROR != rc)163 {164 dprintf(("USER32: pmkbdhk_terminate() failed rc=%d\n",165 rc));166 167 hmodPMKBDHK = NULLHANDLE;168 }169 }170 }171 73 //****************************************************************************** 172 74 #define FONTSDIRECTORY "Fonts" … … 261 163 return 0UL; 262 164 263 // try to install the keyboard hook264 pmkbdhk_initialize(hab);265 266 165 InitializeWindowHandles(); 267 166 … … 298 197 { 299 198 dprintf(("user32 exit\n")); 300 301 // try to unistall the keyboard hook302 pmkbdhk_terminate();303 199 304 200 //SvL: Causes PM hangs on some (a lot?) machines. Reason unknown. -
trunk/src/user32/pmwindow.cpp
r10285 r10316 1 /* $Id: pmwindow.cpp,v 1.22 3 2003-10-22 12:43:51sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.224 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 59 59 #include "menu.h" 60 60 #include "user32api.h" 61 #include <kbdhook.h> 61 62 62 63 #define DBG_LOCALLOG DBG_pmwindow 63 64 #include "dbglocal.h" 64 65 66 65 67 #define ODIN_SetExceptionHandler(a) 66 68 #define ODIN_UnsetExceptionHandler(a) 67 68 69 69 70 // Notification that focus change has completed (UNDOCUMENTED) … … 84 85 BOOL fDragDropDisabled = FALSE; 85 86 86 const char WIN32_CDCLASS[] = "Win32CDWindowClass";87 char WIN32_STDCLASS[255] = "Win32WindowClass";87 const char WIN32_CDCLASS[] = ODIN_WIN32_CDCLASS; 88 char WIN32_STDCLASS[255] = ODIN_WIN32_STDCLASS; 88 89 89 90 #define PMMENU_MINBUTTON 0 … … 190 191 SetThreadMessageQueue(hmq); 191 192 193 //initialize keyboard hook for first thread 194 hookInit(hab); 195 192 196 BOOL rc = WinSetCp(hmq, GetDisplayCodepage()); 193 197 dprintf(("InitPM: WinSetCP was %sOK", rc ? "" : "not ")); … … 255 259 // query the font height to find out whether we have small or large fonts 256 260 DevQueryCaps(hdc, CAPS_GRAPHICS_CHAR_HEIGHT, 1, (PLONG)&CapsCharHeight); 261 dprintf(("CAPS_GRAPHICS_CHAR_HEIGHT = %d", CapsCharHeight)); 262 if(CapsCharHeight > 16) { 263 CapsCharHeight = 16; 264 } 265 266 #ifdef DEBUG 267 ULONG temp; 268 DevQueryCaps(hdc, CAPS_GRAPHICS_CHAR_WIDTH, 1, (PLONG)&temp); 269 dprintf(("CAPS_GRAPHICS_CHAR_WIDTH = %d", temp)); 270 DevQueryCaps(hdc, CAPS_CHAR_HEIGHT, 1, (PLONG)&temp); 271 dprintf(("CAPS_CHAR_HEIGTH = %d", temp)); 272 DevQueryCaps(hdc, CAPS_CHAR_WIDTH, 1, (PLONG)&temp); 273 dprintf(("CAPS_CHAR_WIDTH = %d", temp)); 274 DevQueryCaps(hdc, CAPS_SMALL_CHAR_HEIGHT, 1, (PLONG)&temp); 275 dprintf(("CAPS_SMALL_CHAR_HEIGTH = %d", temp)); 276 DevQueryCaps(hdc, CAPS_SMALL_CHAR_WIDTH, 1, (PLONG)&temp); 277 dprintf(("CAPS_SMALL_CHAR_WIDTH = %d", temp)); 278 DevQueryCaps(hdc, CAPS_VERTICAL_FONT_RES, 1,(PLONG)&temp); 279 dprintf(("CAPS_VERTICAL_FONT_RES = %d", temp)); 280 DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 1,(PLONG)&temp); 281 dprintf(("CAPS_HORIZONTAL_FONT_RES = %d", temp)); 282 #endif 257 283 258 284 DevCloseDC(hdc); 259 285 260 dprintf(("InitPM: Desktop (%d,%d) bpp %d ", ScreenWidth, ScreenHeight, ScreenBitsPerPel));286 dprintf(("InitPM: Desktop (%d,%d) bpp %d font size %d", ScreenWidth, ScreenHeight, ScreenBitsPerPel, CapsCharHeight)); 261 287 return TRUE; 262 288 } /* End of main */ … … 638 664 639 665 case WM_SHOW: 666 { 640 667 dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1)); 641 668 win32wnd->MsgShow((ULONG)mp1); 642 break; 669 670 //if a child window is hidden, then the update region of the 671 //parent changes and a WM_ERASEBKGND is required during the next 672 //BeginPaint call. 673 if((ULONG)mp1 == FALSE) 674 { 675 Win32BaseWindow *parent = win32wnd->getParent(); 676 if(parent) { 677 dprintf(("PM Update region changed for parent %x", win32wnd->getWindowHandle())); 678 parent->SetPMUpdateRegionChanged(TRUE); 679 } 680 } 681 break; 682 } 643 683 644 684 case WM_ACTIVATE: … … 658 698 { 659 699 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp1))); 660 win32wnd->Set VisibleRegionChanged(TRUE);700 win32wnd->SetPMUpdateRegionChanged(TRUE); 661 701 goto RunDefWndProc; 662 702 } … … 1267 1307 case WM_PAINT: 1268 1308 { 1269 RECTL rectl; 1309 RECTL rectl; 1310 HRGN hrgn; 1311 1312 hrgn = CreateRectRgn(0, 0, 0, 0); 1313 GetUpdateRgnFrame(win32wnd->getWindowHandle(), hrgn); 1270 1314 1271 1315 HPS hps = WinBeginPaint(hwnd, NULL, &rectl); … … 1285 1329 1286 1330 mapOS2ToWin32Rect(win32wnd->getWindowHeight(), (PRECTLOS2)&rectl, &rectUpdate); 1287 win32wnd->MsgNCPaint(&rectUpdate );1331 win32wnd->MsgNCPaint(&rectUpdate, hrgn); 1288 1332 } 1289 1333 } 1290 1334 WinEndPaint(hps); 1335 1336 DeleteObject(hrgn); 1291 1337 break; 1292 1338 } … … 1599 1645 if ((pswp->fl & SWP_MAXIMIZE) && (win32wnd->getExStyle() & WS_EX_MDICHILD_W)) 1600 1646 { 1601 SendMessageA(win32wnd->getWindowHandle(), WM_SYSCOMMAND_W, SC_MAXIMIZE_W, 0);1602 goto PosChangedEnd;1647 SendMessageA(win32wnd->getWindowHandle(), WM_SYSCOMMAND_W, SC_MAXIMIZE_W, 0); 1648 goto PosChangedEnd; 1603 1649 } 1604 1650 … … 2478 2524 //****************************************************************************** 2479 2525 //****************************************************************************** 2526 char *WIN32API QueryCustomStdClassName() 2527 { 2528 return WIN32_STDCLASS; 2529 } 2530 //****************************************************************************** 2531 //****************************************************************************** 2480 2532 2481 2533 #ifdef DEBUG -
trunk/src/user32/user32.cpp
r10275 r10316 1 /* $Id: user32.cpp,v 1.1 29 2003-10-20 17:17:23sandervl Exp $ */1 /* $Id: user32.cpp,v 1.130 2003-11-12 14:10:20 sandervl Exp $ */ 2 2 3 3 /* … … 1144 1144 /* Filled Shape Functions */ 1145 1145 1146 /* Last COLOR id */ 1147 #define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION 1148 1149 int WIN32API FillRect(HDC hDC, const RECT * lprc, HBRUSH hbr) 1150 { 1151 //SvL: brush 0 means current selected brush (verified in NT4) 1152 if(hbr == 0) { 1153 hbr = GetCurrentObject(hDC, OBJ_BRUSH); 1154 } 1155 else 1156 if (hbr <= (HBRUSH) (COLOR_MAX + 1)) { 1157 hbr = GetSysColorBrush( (INT) hbr - 1 ); 1158 } 1159 dprintf(("USER32: FillRect %x (%d,%d)(%d,%d) brush %X", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom, hbr)); 1160 return O32_FillRect(hDC,lprc,hbr); 1161 } 1162 //****************************************************************************** 1163 //****************************************************************************** 1164 int WIN32API FrameRect( HDC hDC, const RECT * lprc, HBRUSH hbr) 1165 { 1166 dprintf(("USER32: FrameRect %x (%d,%d)(%d,%d) brush %x", hDC, lprc->top, lprc->left, lprc->bottom, lprc->right, hbr)); 1167 return O32_FrameRect(hDC,lprc,hbr); 1168 } 1169 //****************************************************************************** 1170 //****************************************************************************** 1171 BOOL WIN32API InvertRect( HDC hDC, const RECT * lprc) 1172 { 1173 if(lprc) { 1174 dprintf(("USER32: InvertRect %x (%d,%d)(%d,%d)", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom)); 1175 } 1176 else dprintf(("USER32: InvertRect %x NULL", hDC)); 1177 return O32_InvertRect(hDC,lprc); 1178 } 1146 1179 1147 1180 1148 /* System Information Functions */ -
trunk/src/user32/user32api.h
r9791 r10316 1 /* $Id: user32api.h,v 1. 2 2003-02-13 10:12:25sandervl Exp $ */1 /* $Id: user32api.h,v 1.3 2003-11-12 14:10:20 sandervl Exp $ */ 2 2 //Internal user32 functions 3 3 4 4 #ifndef __USER32API_H_ 5 5 #define __USER32API_H_ 6 7 HWND WINAPI GetAncestor( HWND hwnd, UINT type );8 6 9 7 //Notify that focus has changed (necessary for SetFocus(0) handling) -
trunk/src/user32/user32dbg.def
r10256 r10316 1 ; $Id: user32dbg.def,v 1.1 4 2003-10-02 10:36:00 sandervl Exp $1 ; $Id: user32dbg.def,v 1.15 2003-11-12 14:10:20 sandervl Exp $ 2 2 3 3 LIBRARY USER32 INITINSTANCE TERMINSTANCE … … 237 237 ExcludeUpdateRgn = _DbgExcludeUpdateRgn@8 @194 238 238 ExitWindowsEx = _DbgExitWindowsEx@8 @195 239 FillRect = _ DbgFillRect@12@196239 FillRect = _FillRect@12 @196 240 240 FindWindowA = _DbgFindWindowA@8 @197 241 241 FindWindowExA = _DbgFindWindowExA@16 @198 … … 243 243 FindWindowW = _DbgFindWindowW@8 @200 244 244 FlashWindow = _DbgFlashWindow@8 @201 245 FrameRect = _ DbgFrameRect@12@202245 FrameRect = _FrameRect@12 @202 246 246 FreeDDElParam = _DbgFreeDDElParam@8 @203 247 247 GetActiveWindow = _DbgGetActiveWindow@0 @204 … … 374 374 InvalidateRect = _DbgInvalidateRect@12 @328 375 375 InvalidateRgn = _DbgInvalidateRgn@12 @329 376 InvertRect = _ DbgInvertRect@8@330376 InvertRect = _InvertRect@8 @330 377 377 IsCharAlphaA = _IsCharAlphaA@4 @331 378 378 IsCharAlphaNumericA = _IsCharAlphaNumericA@4 @332 … … 642 642 SetWinEventHook = _DbgSetWinEventHook@28 @608 643 643 644 GetAncestor = _DbgGetAncestor@8 @609 645 GetWindowModuleFileNameA = _DbgGetWindowModuleFileNameA@12 @610 646 644 647 ;------------ 645 648 ; Windows 98 -
trunk/src/user32/win32wbase.cpp
r10275 r10316 1 /* $Id: win32wbase.cpp,v 1.3 79 2003-10-20 17:17:23sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.380 2003-11-12 14:10:20 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 117 117 fComingToTop = FALSE; 118 118 fMinMaxChange = FALSE; 119 f VisibleRegionChanged = FALSE;119 fPMUpdateRegionChanged = FALSE; 120 120 fEraseBkgndFlag = TRUE; 121 121 fIsDragDropActive= FALSE; … … 178 178 hWindowRegion = 0; 179 179 hClipRegion = 0; 180 hVisRegion = 0; 180 181 hUpdateRegion = 0; 181 182 … … 1219 1220 HDC hdcErase = hdc; 1220 1221 1221 if (hdcErase == 0) 1222 hdcErase = GetDC(getWindowHandle()); 1222 if (hdcErase == 0) { 1223 DebugInt3(); 1224 return 0; 1225 } 1223 1226 1224 1227 if(IsWindowIconic()) … … 1226 1229 else 1227 1230 rc = SendMessageA(getWindowHandle(),WM_ERASEBKGND, hdcErase, 0); 1228 if (hdc == 0) 1229 ReleaseDC(getWindowHandle(), hdcErase); 1231 1230 1232 return (rc); 1231 1233 } … … 1250 1252 } 1251 1253 //****************************************************************************** 1252 //TODO: Should use update region, not rectangle 1253 //****************************************************************************** 1254 ULONG Win32BaseWindow::MsgNCPaint(PRECT pUpdateRect) 1255 { 1256 HRGN hrgn; 1254 //****************************************************************************** 1255 ULONG Win32BaseWindow::MsgNCPaint(PRECT pUpdateRect, HRGN hrgnUpdate) 1256 { 1257 1257 ULONG rc; 1258 1258 RECT client = rectClient; … … 1267 1267 } 1268 1268 1269 dprintf(("MsgNCPaint (%d,%d)(%d,%d)", pUpdateRect->left, pUpdateRect->top, pUpdateRect->right, pUpdateRect->bottom)); 1270 hrgn = CreateRectRgnIndirect(pUpdateRect); 1271 1272 rc = SendMessageA(getWindowHandle(),WM_NCPAINT, hrgn, 0); 1269 rc = SendMessageA(getWindowHandle(),WM_NCPAINT, hrgnUpdate, 0); 1273 1270 //Send WM_PAINTICON here if minimized, because client window will 1274 1271 //not receive a (valid) WM_PAINT message … … 1277 1274 rc = SendMessageA(getWindowHandle(),WM_PAINTICON, 1, 0); 1278 1275 } 1279 1280 DeleteObject(hrgn);1281 1276 1282 1277 return rc; … … 2919 2914 } 2920 2915 //****************************************************************************** 2921 //Note: does not set last error if no parent (verified in NT4, SP6) 2916 // Win32BaseWindow::GetParent 2917 // 2918 // If the window is a child window, then return the parent window handle. 2919 // If it's a popup window, then return the owner 2920 // 2921 // Returns window handle of parent or owner window 2922 // 2923 // Note: does not set last error if no parent (verified in NT4, SP6) 2922 2924 //****************************************************************************** 2923 2925 HWND Win32BaseWindow::GetParent() -
trunk/src/user32/win32wbase.h
r10190 r10316 1 /* $Id: win32wbase.h,v 1.15 5 2003-07-31 15:56:47sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.156 2003-11-12 14:10:21 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 136 136 ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE); 137 137 ULONG MsgEraseBackGround(HDC hdc); 138 ULONG MsgNCPaint(PRECT pUpdateRect );138 ULONG MsgNCPaint(PRECT pUpdateRect, HRGN hrgnUpdate); 139 139 ULONG MsgFormatFrame(WINDOWPOS *lpWndPos); 140 140 ULONG DispatchMsgA(MSG *msg); … … 231 231 //Save old clip region for CS_OWNDC windows (in BeginPaint) 232 232 HRGN GetClipRegion() { return hClipRegion; }; 233 void SetClipRegion(HRGN hRegion) { hClipRegion = hRegion; }; 233 HRGN GetVisRegion() { return hVisRegion; }; 234 void SaveClipRegion(HRGN hrgnClip) { hClipRegion = hrgnClip; }; 235 void SaveVisRegion(HRGN hrgnVis) { hVisRegion = hrgnVis; }; 234 236 235 237 void saveAndValidateUpdateRegion(); … … 286 288 BOOL IsMixMaxStateChanging() { return fMinMaxChange; }; 287 289 288 void SetVisibleRegionChanged(BOOL changed) { fVisibleRegionChanged = changed; };289 BOOL IsVisibleRegionChanged() { return fVisibleRegionChanged; };290 290 BOOL setVisibleRgnNotifyProc(VISRGN_NOTIFY_PROC lpNotifyProc, DWORD dwUserData); 291 291 void callVisibleRgnNotifyProc(BOOL fDrawingAllowed); … … 415 415 fCXDefault:1, 416 416 fParentDC:1, 417 fComingToTop:1,417 fComingToTop:1, 418 418 isUnicode:1, 419 419 fMinMaxChange:1, //set when switching between min/max/restored state 420 f VisibleRegionChanged:1, //set when visible regionhas changed -> erase background must be sent during next BeginPaint420 fPMUpdateRegionChanged:1, //set when PM update has changed -> erase background must be sent during next BeginPaint 421 421 fEraseBkgndFlag:1, 422 422 fIsDragDropActive:1, … … 426 426 ULONG state; 427 427 HRGN hWindowRegion; 428 HRGN hClipRegion ;428 HRGN hClipRegion, hVisRegion; 429 429 HRGN hUpdateRegion; 430 430 … … 533 533 VOID setEraseBkgnd (BOOL erase) { fEraseBkgndFlag = erase; } 534 534 BOOL needsEraseBkgnd() { return fEraseBkgndFlag; } 535 536 void SetPMUpdateRegionChanged(BOOL changed) { fPMUpdateRegionChanged = changed; }; 537 BOOL hasPMUpdateRegionChanged() { return fPMUpdateRegionChanged; }; 535 538 }; 536 539 -
trunk/src/user32/win32wmisc.h
r9598 r10316 1 /* $Id: win32wmisc.h,v 1. 2 2003-01-03 16:35:58sandervl Exp $ */1 /* $Id: win32wmisc.h,v 1.3 2003-11-12 14:10:21 sandervl Exp $ */ 2 2 /* 3 3 * Misc. functions for window management … … 32 32 INT NC_HandleNCHitTest( HWND hwnd, POINT pt); 33 33 34 HWND WINAPI GetAncestor( HWND hwnd, UINT type );35 36 34 #ifdef __cplusplus 37 35 } -
trunk/src/user32/window.cpp
r10145 r10316 1 /* $Id: window.cpp,v 1.13 6 2003-06-25 17:02:04sandervl Exp $ */1 /* $Id: window.cpp,v 1.137 2003-11-12 14:10:21 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 44 44 #include <winuser32.h> 45 45 #include "hook.h" 46 #include <wprocess.h> 46 47 47 48 #define DBG_LOCALLOG DBG_window … … 711 712 { 712 713 HWND hwndAncestor = 0; 714 Win32BaseWindow *window; 715 716 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 717 if(!window) { 718 dprintf(("GetAncestor, window %x not found", hwnd)); 719 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 720 return FALSE; 721 } 713 722 714 723 if (type == GA_PARENT) … … 719 728 } 720 729 //else no child -> no parent (GetParent returns owner otherwise!) 721 return hwndAncestor; 722 } 723 dprintf(("Unsupported type %d", type)); 724 return 0; 730 } 731 else 732 if (type == GA_ROOT) 733 { 734 hwndAncestor = window->GetTopParent(); 735 } 736 else 737 if (type == GA_ROOTOWNER) 738 { 739 if(hwnd != GetDesktopWindow()) 740 { 741 hwndAncestor = hwnd; 742 for(;;) 743 { 744 HWND parent = GetParent( hwndAncestor ); 745 if (!parent) break; 746 hwndAncestor = parent; 747 } 748 } 749 } 750 else dprintf(("Unsupported type %d", type)); 751 752 RELEASE_WNDOBJ(window); 753 return hwndAncestor; 725 754 } 726 755 //****************************************************************************** … … 760 789 return 0; 761 790 } 791 fIgnoreKeystrokes = TRUE; 762 792 SendMessageA(lastFocus_W, WM_KILLFOCUS, 0, 0); 763 764 fIgnoreKeystrokes = TRUE;765 793 766 794 return lastFocus_W; … … 2151 2179 } 2152 2180 //****************************************************************************** 2181 //The GetWindowModuleFileName function retrieves the full path and file name of 2182 //the module associated with the specified window handle. 2183 //****************************************************************************** 2184 UINT WIN32API GetWindowModuleFileNameA(HWND hwnd, LPTSTR lpszFileName, UINT cchFileNameMax) 2185 { 2186 WNDPROC lpfnWindowProc; 2187 2188 if (!IsWindow(hwnd)) { 2189 dprintf(("warning: GetWindowModuleFileName: window %x not found!", hwnd)); 2190 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 2191 return 0; 2192 } 2193 lpfnWindowProc = (WNDPROC)GetWindowLongA(hwnd, GWL_WNDPROC); 2194 return GetProcModuleFileNameA((ULONG)lpfnWindowProc, lpszFileName, cchFileNameMax); 2195 } 2196 //****************************************************************************** 2153 2197 //****************************************************************************** 2154 2198
Note:
See TracChangeset
for help on using the changeset viewer.