- Timestamp:
- Jul 18, 1999, 4:39:35 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/defwndproc.cpp
r300 r328 1 /* $Id: defwndproc.cpp,v 1. 1 1999-07-14 08:35:34 sandervl Exp $ */1 /* $Id: defwndproc.cpp,v 1.2 1999-07-18 14:39:34 sandervl Exp $ */ 2 2 3 3 /* … … 25 25 //// WriteLog("*DWP*"); 26 26 #endif 27 switch(Msg) { 28 case WM_SETREDRAW: //Open32 does not set the visible flag 29 if(wParam) 30 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE); 31 else SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE); 32 27 switch(Msg) 28 { 29 case WM_SETREDRAW: //Open32 does not set the visible flag 30 if(wParam) 31 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE); 32 else SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE); 33 34 return 0; //TODO 35 36 case WM_NCCREATE: 37 return(TRUE); 38 39 case WM_CTLCOLORMSGBOX: 40 case WM_CTLCOLOREDIT: 41 case WM_CTLCOLORLISTBOX: 42 case WM_CTLCOLORBTN: 43 case WM_CTLCOLORDLG: 44 case WM_CTLCOLORSTATIC: 45 case WM_CTLCOLORSCROLLBAR: 46 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); 47 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 48 return GetSysColorBrush(COLOR_BTNFACE); 49 50 case WM_PARENTNOTIFY: 51 return 0; 52 53 case WM_MOUSEACTIVATE: 54 { 55 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 56 DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE); 57 dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam)))); 58 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) ) 59 { 60 LRESULT rc = SendMessageA(GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam ); 61 if(rc) return rc; 62 } 63 return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE; 64 } 65 case WM_SETCURSOR: 66 { 67 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 68 DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE); 69 dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam)))); 70 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) ) 71 { 72 LRESULT rc = SendMessageA(GetParent(hwnd), WM_SETCURSOR, wParam, lParam); 73 if(rc) return rc; 74 } 75 return 1; 76 } 77 case WM_MOUSEMOVE: 78 return 0; 79 80 case WM_ERASEBKGND: 81 case WM_ICONERASEBKGND: 82 return 0; 83 84 case WM_NCLBUTTONDOWN: 85 case WM_NCLBUTTONUP: 86 case WM_NCLBUTTONDBLCLK: 87 case WM_NCRBUTTONUP: 88 case WM_NCRBUTTONDOWN: 89 case WM_NCRBUTTONDBLCLK: 90 case WM_NCMBUTTONDOWN: 91 case WM_NCMBUTTONUP: 92 case WM_NCMBUTTONDBLCLK: 93 return 0; //TODO: Send WM_SYSCOMMAND if required 94 95 case WM_NCHITTEST: //TODO: 96 return 0; 97 98 default: 99 return 1; 100 } 101 } 102 //****************************************************************************** 103 //NOTE: Unicode msg translation! 104 //****************************************************************************** 105 LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) 106 { 107 #ifdef DEBUG 108 //// WriteLog("*DWPW*"); 109 #endif 110 switch(Msg) { 111 case WM_SETREDRAW: //Open32 does not set the visible flag 112 if(wParam) 113 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE); 114 else 115 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE); 33 116 return O32_DefWindowProc(hwnd, Msg, wParam, lParam); 34 case WM_NCCREATE://SvL: YAFMO (yet another feature missing in Open32) 35 return(TRUE); 36 case WM_CTLCOLORMSGBOX: 37 case WM_CTLCOLOREDIT: 38 case WM_CTLCOLORLISTBOX: 39 case WM_CTLCOLORBTN: 40 case WM_CTLCOLORDLG: 41 case WM_CTLCOLORSTATIC: 42 case WM_CTLCOLORSCROLLBAR: 43 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); 44 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 45 return GetSysColorBrush(COLOR_BTNFACE); 46 47 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 48 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 49 return 0; 50 51 case WM_MOUSEACTIVATE: 52 { 53 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 54 DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE); 55 dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam)))); 56 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) ) 57 { 58 LRESULT rc = SendMessageA(GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam ); 59 if(rc) return rc; 60 } 61 return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE; 62 } 63 case WM_SETCURSOR: 64 { 65 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 66 DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE); 67 dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam)))); 68 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) ) 69 { 70 LRESULT rc = SendMessageA(GetParent(hwnd), WM_SETCURSOR, wParam, lParam); 71 if(rc) return rc; 72 } 73 return O32_DefWindowProc(hwnd, Msg, wParam, lParam); 74 } 117 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing) 118 return(TRUE); 119 case WM_CTLCOLORMSGBOX: 120 case WM_CTLCOLOREDIT: 121 case WM_CTLCOLORLISTBOX: 122 case WM_CTLCOLORBTN: 123 case WM_CTLCOLORDLG: 124 case WM_CTLCOLORSTATIC: 125 case WM_CTLCOLORSCROLLBAR: 126 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); 127 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 128 return GetSysColorBrush(COLOR_BTNFACE); 129 130 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 131 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 132 return 0; 133 75 134 default: 76 135 return O32_DefWindowProc(hwnd, Msg, wParam, lParam); … … 78 137 } 79 138 //****************************************************************************** 139 //****************************************************************************** 140 LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) 141 { 142 #ifdef DEBUG 143 //// WriteLog("*DDP*"); 144 #endif 145 switch(Msg) { 146 case WM_SETREDRAW: //Open32 does not set the visible flag 147 if(wParam) 148 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE); 149 else 150 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE); 151 return O32_DefDlgProc(hwnd, Msg, wParam, lParam); 152 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing) 153 return(TRUE); 154 case WM_CTLCOLORMSGBOX: 155 case WM_CTLCOLOREDIT: 156 case WM_CTLCOLORLISTBOX: 157 case WM_CTLCOLORBTN: 158 case WM_CTLCOLORDLG: 159 case WM_CTLCOLORSTATIC: 160 case WM_CTLCOLORSCROLLBAR: 161 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); 162 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 163 return GetSysColorBrush(COLOR_BTNFACE); 164 165 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 166 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 167 return 0; 168 169 default: 170 return O32_DefDlgProc(hwnd, Msg, wParam, lParam); 171 } 172 } 173 //****************************************************************************** 80 174 //NOTE: Unicode msg translation! 81 175 //****************************************************************************** 82 LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) 83 { 84 #ifdef DEBUG 85 //// WriteLog("*DWPW*"); 86 #endif 87 switch(Msg) { 88 case WM_SETREDRAW: //Open32 does not set the visible flag 89 if(wParam) 90 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE); 91 else 92 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE); 93 return O32_DefWindowProc(hwnd, Msg, wParam, lParam); 94 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing) 95 return(TRUE); 96 case WM_CTLCOLORMSGBOX: 97 case WM_CTLCOLOREDIT: 98 case WM_CTLCOLORLISTBOX: 99 case WM_CTLCOLORBTN: 100 case WM_CTLCOLORDLG: 101 case WM_CTLCOLORSTATIC: 102 case WM_CTLCOLORSCROLLBAR: 103 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); 104 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 105 return GetSysColorBrush(COLOR_BTNFACE); 106 107 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 108 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 109 return 0; 110 111 default: 112 return O32_DefWindowProc(hwnd, Msg, wParam, lParam); 113 } 114 } 115 //****************************************************************************** 116 //****************************************************************************** 117 LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) 118 { 119 #ifdef DEBUG 120 //// WriteLog("*DDP*"); 176 LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) 177 { 178 #ifdef DEBUG 179 //// WriteLog("*DDPW*"); 121 180 #endif 122 181 switch(Msg) { … … 140 199 return GetSysColorBrush(COLOR_BTNFACE); 141 200 142 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 143 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 144 return 0; 145 146 default: 147 return O32_DefDlgProc(hwnd, Msg, wParam, lParam); 148 } 149 } 150 //****************************************************************************** 151 //NOTE: Unicode msg translation! 152 //****************************************************************************** 153 LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) 154 { 155 #ifdef DEBUG 156 //// WriteLog("*DDPW*"); 157 #endif 158 switch(Msg) { 159 case WM_SETREDRAW: //Open32 does not set the visible flag 160 if(wParam) 161 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE); 162 else 163 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE); 164 return O32_DefDlgProc(hwnd, Msg, wParam, lParam); 165 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing) 166 return(TRUE); 167 case WM_CTLCOLORMSGBOX: 168 case WM_CTLCOLOREDIT: 169 case WM_CTLCOLORLISTBOX: 170 case WM_CTLCOLORBTN: 171 case WM_CTLCOLORDLG: 172 case WM_CTLCOLORSTATIC: 173 case WM_CTLCOLORSCROLLBAR: 174 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); 175 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 176 return GetSysColorBrush(COLOR_BTNFACE); 177 178 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 179 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 180 return 0; 201 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 202 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 203 return 0; 181 204 182 205 default: … … 211 234 return GetSysColorBrush(COLOR_BTNFACE); 212 235 213 214 215 236 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 237 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame)); 238 return 0; 216 239 217 240 default: … … 247 270 return GetSysColorBrush(COLOR_BTNFACE); 248 271 249 250 251 272 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 273 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame)); 274 return 0; 252 275 253 276 default: … … 282 305 return GetSysColorBrush(COLOR_BTNFACE); 283 306 284 285 286 307 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 308 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 309 return 0; 287 310 288 311 default: … … 318 341 return GetSysColorBrush(COLOR_BTNFACE); 319 342 320 321 322 343 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!! 344 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd)); 345 return 0; 323 346 324 347 default: -
trunk/src/user32/new/oslibgdi.cpp
r325 r328 1 /* $Id: oslibgdi.cpp,v 1. 1 1999-07-18 10:39:51sandervl Exp $ */1 /* $Id: oslibgdi.cpp,v 1.2 1999-07-18 14:39:35 sandervl Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 26 26 PRECTL pWinRect = (PRECTL)pRectl; 27 27 ULONG tmp; 28 28 29 29 tmp = pWinRect->yBottom; 30 30 pWinRect->yBottom = pWinRect->yTop; … … 74 74 HWND hwndParent; 75 75 RECTLOS2 rectParent = {0}; 76 76 77 77 hwndParent = WinQueryWindow(hwndChild, QW_PARENT); 78 78 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); … … 110 110 // 111 111 // Parameters: 112 // hwndChild: 112 // hwndChild: Child window handle 113 113 // rectChild: OS/2 child window RECTL 114 114 // 115 115 // Returns: 116 116 // rectChild: Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed) 117 // TRUE: 118 // FALSE: 117 // TRUE: Success 118 // FALSE: Failures 119 119 //****************************************************************************** 120 120 BOOL MapOS2ToWin32Rectl(HWND hwndChild, PRECTLOS2 rectChild, PRECT rectWin32) … … 142 142 // Returns: 143 143 // rectChild: Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed) 144 // TRUE: 145 // FALSE: 144 // TRUE: Success 145 // FALSE: Failures 146 146 //****************************************************************************** 147 147 BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectParent, PRECTLOS2 rectChild, PRECT rectWin32) … … 162 162 // rectChild: OS/2 Child window RECTL (OUT) 163 163 // Returns: 164 // TRUE: 165 // FALSE: 164 // TRUE: Success 165 // FALSE: Failures 166 166 //****************************************************************************** 167 167 BOOL MapWin32ToOS2Rectl(HWND hwndChild, PRECT rectWin32, PRECTLOS2 rectChild) … … 188 188 // rectChild: OS/2 Child window RECTL (OUT) 189 189 // Returns: 190 // TRUE: 191 // FALSE: 190 // TRUE: Success 191 // FALSE: Failures 192 192 //****************************************************************************** 193 193 BOOL MapWin32ToOS2Rectl(PRECTLOS2 rectParent, PRECT rectWin32, PRECTLOS2 rectChild) -
trunk/src/user32/new/oslibwin.cpp
r327 r328 1 /* $Id: oslibwin.cpp,v 1.1 1 1999-07-18 13:57:47 cbratschiExp $ */1 /* $Id: oslibwin.cpp,v 1.12 1999-07-18 14:39:35 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 256 256 //****************************************************************************** 257 257 //****************************************************************************** 258 BOOL OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect) 259 { 260 return WinQueryUpdateRect(hwnd, (PRECTL)pRect); 261 //CB: caller must convert rect 258 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect) 259 { 260 BOOL rc; 261 RECTLOS2 rectl; 262 263 rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl); 264 if(rc) { 265 MapOS2ToWin32Rectl(hwnd, &rectl, pRect); 266 } 267 return rc; 262 268 } 263 269 //****************************************************************************** -
trunk/src/user32/new/oslibwin.h
r327 r328 1 /* $Id: oslibwin.h,v 1.1 0 1999-07-18 13:57:47 cbratschiExp $ */1 /* $Id: oslibwin.h,v 1.11 1999-07-18 14:39:35 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 184 184 185 185 BOOL OSLibWinDestroyWindow(HWND hwnd); 186 BOOL OSLibWinQueryUpdateRect(HWND hwnd, P OSRECTL pRect); //must be RECTL pointer!186 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect); 187 187 BOOL OSLibWinIsIconic(HWND hwnd); 188 188 BOOL OSLibWinSetActiveWindow(HWND hwnd); -
trunk/src/user32/new/pmwindow.cpp
r325 r328 1 /* $Id: pmwindow.cpp,v 1. 8 1999-07-18 10:39:51sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.9 1999-07-18 14:39:35 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 39 39 hmq = WinCreateMsgQueue(hab, 0); 40 40 41 if(!hab || !hmq) 41 if(!hab || !hmq) 42 42 { 43 43 UINT error; … … 46 46 if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS) 47 47 { 48 49 50 51 } 52 48 dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq)); 49 dprintf((" Error = %x",error)); 50 return(FALSE); 51 } 52 else 53 53 { 54 55 56 57 58 59 60 54 if(!hab) { 55 hab = WinQueryAnchorBlock(HWND_DESKTOP); 56 dprintf(("WinQueryAnchorBlock returned %x", hab)); 57 } 58 if(!hmq) { 59 hmq = HMQ_CURRENT; 60 } 61 61 } 62 62 } … … 69 69 (PSZ)WIN32_STDCLASS, /* Window class name */ 70 70 (PFNWP)Win32WindowProc, /* Address of window procedure */ 71 CS_SIZEREDRAW , /* Class style */71 CS_SIZEREDRAW | CS_MOVENOTIFY | CS_HITTEST, 72 72 8)) { 73 73 dprintf(("WinRegisterClass Win32Window failed")); … … 101 101 //internal messages 102 102 case WM_WIN32_POSTMESSAGEA: 103 postmsg = (POSTMSG_PACKET *)mp1;104 if(postmsg == NULL) {105 106 107 }108 win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);109 free(postmsg);110 break;111 103 postmsg = (POSTMSG_PACKET *)mp1; 104 if(postmsg == NULL) { 105 dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!")); 106 break; 107 } 108 win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam); 109 free(postmsg); 110 break; 111 112 112 case WM_WIN32_POSTMESSAGEW: 113 postmsg = (POSTMSG_PACKET *)mp1;114 if(postmsg == NULL) {115 116 117 }118 win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);119 free(postmsg);120 break;113 postmsg = (POSTMSG_PACKET *)mp1; 114 if(postmsg == NULL) { 115 dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!")); 116 break; 117 } 118 win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam); 119 free(postmsg); 120 break; 121 121 122 122 //OS/2 msgs 123 123 case WM_CREATE: 124 124 //Processing is done in after WinCreateWindow returns 125 dprintf(("OS2: WM_CREATE %x", hwnd));126 RestoreOS2TIB();127 return (MRESULT)FALSE;125 dprintf(("OS2: WM_CREATE %x", hwnd)); 126 RestoreOS2TIB(); 127 return (MRESULT)FALSE; 128 128 129 129 case WM_QUIT: 130 dprintf(("OS2: WM_QUIT %x", hwnd));130 dprintf(("OS2: WM_QUIT %x", hwnd)); 131 131 if(win32wnd->MsgQuit()) { 132 132 goto RunDefWndProc; … … 135 135 136 136 case WM_CLOSE: 137 dprintf(("OS2: WM_CLOSE %x", hwnd));137 dprintf(("OS2: WM_CLOSE %x", hwnd)); 138 138 if(win32wnd->MsgClose()) { 139 139 goto RunDefWndProc; … … 142 142 143 143 case WM_DESTROY: 144 dprintf(("OS2: WM_DESTROY %x", hwnd));144 dprintf(("OS2: WM_DESTROY %x", hwnd)); 145 145 if(win32wnd->MsgDestroy()) { 146 146 goto RunDefWndProc; … … 149 149 150 150 case WM_ENABLE: 151 dprintf(("OS2: WM_ENABLE %x", hwnd));151 dprintf(("OS2: WM_ENABLE %x", hwnd)); 152 152 if(win32wnd->MsgEnable((ULONG)mp1)) { 153 153 goto RunDefWndProc; … … 156 156 157 157 case WM_SHOW: 158 dprintf(("OS2: WM_SHOW %x", hwnd));158 dprintf(("OS2: WM_SHOW %x", hwnd)); 159 159 if(win32wnd->MsgShow((ULONG)mp1)) { 160 160 goto RunDefWndProc; … … 165 165 { 166 166 RECTLOS2 rectChild; 167 ULONG x Parent, yParent;168 169 dprintf(("OS2: WM_MOVE %x", hwnd));170 171 WinQueryWindowRect(hwnd, (PRECTL)&rectChild);167 ULONG x, y; 168 169 dprintf(("OS2: WM_MOVE %x", hwnd)); 170 171 WinQueryWindowRect(hwnd, (PRECTL)&rectChild); 172 172 173 173 //Calculate position relative to parent window (real window or desktop) 174 x Parent= rectChild.xLeft;175 y Parent= MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);176 177 if(win32wnd->MsgMove(xParent, yParent)) {178 174 x = rectChild.xLeft; 175 y = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom); 176 177 if(win32wnd->MsgMove(x, y)) { 178 goto RunDefWndProc; 179 179 } 180 180 break; … … 183 183 case WM_WINDOWPOSCHANGED: 184 184 { 185 break;185 dprintf(("OS2: WM_WINDOWPOSCHANGED %x", hwnd)); 186 186 } 187 187 188 188 case WM_ADJUSTWINDOWPOS: 189 189 { 190 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));191 // 192 goto RunDefWndProc; 193 // 190 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd)); 191 // if(win32wnd->MsgWindowPosChanging(0, 0)) { 192 goto RunDefWndProc; 193 // } 194 194 break; 195 195 } … … 199 199 HPS hps; 200 200 201 dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));201 dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd)); 202 202 hps = WinGetPS(hwnd); 203 if( win32wnd->MsgEraseBackGround((ULONG)hps))203 if(!win32wnd->MsgEraseBackGround((ULONG)hps)) 204 204 { 205 205 /* … … 217 217 SWP swp; 218 218 219 dprintf(("OS2: WM_SIZE %x", hwnd));219 dprintf(("OS2: WM_SIZE %x", hwnd)); 220 220 rc = WinQueryWindowPos(hwnd, &swp); 221 221 if(rc == FALSE) { … … 236 236 HWND hwndActivate = (HWND)mp1; 237 237 238 dprintf(("OS2: WM_ACTIVATE %x", hwnd));238 dprintf(("OS2: WM_ACTIVATE %x", hwnd)); 239 239 if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 240 240 //another (non-win32) application's window … … 248 248 } 249 249 case WM_FOCUSCHANGE: 250 break; 250 dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd)); 251 goto RunDefWndProc; 251 252 252 253 case WM_SETFOCUS: … … 254 255 HWND hwndFocus = (HWND)mp1; 255 256 256 dprintf(("OS2: WM_SETFOCUS %x", hwnd));257 dprintf(("OS2: WM_SETFOCUS %x", hwnd)); 257 258 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 258 259 //another (non-win32) application's window … … 273 274 //************************************************************************** 274 275 case WM_BUTTON1DOWN: 275 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 276 dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd)); 277 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 276 278 goto RunDefWndProc; 277 279 } 278 280 break; 279 281 case WM_BUTTON1UP: 280 if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 282 dprintf(("OS2: WM_BUTTON1UP %x", hwnd)); 283 if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 281 284 goto RunDefWndProc; 282 285 } 283 286 break; 284 287 case WM_BUTTON1DBLCLK: 285 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {288 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 286 289 goto RunDefWndProc; 287 290 } 288 291 break; 289 292 case WM_BUTTON2DOWN: 290 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {293 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 291 294 goto RunDefWndProc; 292 295 } 293 296 break; 294 297 case WM_BUTTON2UP: 295 if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {298 if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 296 299 goto RunDefWndProc; 297 300 } 298 301 break; 299 302 case WM_BUTTON2DBLCLK: 300 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 301 goto RunDefWndProc; 302 } 303 break; 303 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 304 goto RunDefWndProc; 305 } 306 break; 307 case WM_BUTTON3DOWN: 308 if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 309 goto RunDefWndProc; 310 } 311 break; 312 case WM_BUTTON3UP: 313 if(win32wnd->MsgButton(BUTTON_MIDDLEUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 314 goto RunDefWndProc; 315 } 316 break; 317 case WM_BUTTON3DBLCLK: 318 if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 319 goto RunDefWndProc; 320 } 321 break; 322 304 323 case WM_BUTTON2MOTIONSTART: 305 324 case WM_BUTTON2MOTIONEND: … … 308 327 case WM_BUTTON1MOTIONEND: 309 328 case WM_BUTTON1CLICK: 310 case WM_BUTTON3DOWN:311 case WM_BUTTON3UP:312 case WM_BUTTON3DBLCLK:313 329 case WM_BUTTON3MOTIONSTART: 314 330 case WM_BUTTON3MOTIONEND: 315 331 case WM_BUTTON3CLICK: 316 break;332 goto RunDefWndProc; 317 333 318 334 case WM_MOUSEMOVE: 319 break; 335 { 336 ULONG keystate = 0; 337 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1)) 338 keystate |= WMMOVE_LBUTTON; 339 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2)) 340 keystate |= WMMOVE_MBUTTON; 341 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3)) 342 keystate |= WMMOVE_RBUTTON; 343 if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT)) 344 keystate |= WMMOVE_SHIFT; 345 if(WinGetKeyState(HWND_DESKTOP, VK_CTRL)) 346 keystate |= WMMOVE_CTRL; 347 348 if(!win32wnd->MsgMouseMove(keystate, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 349 goto RunDefWndProc; 350 } 351 break; 352 } 320 353 321 354 //************************************************************************** … … 323 356 //************************************************************************** 324 357 case WM_VSCROLL: 325 break;326 358 case WM_HSCROLL: 327 break;328 359 329 360 case WM_CONTROL: 330 break;331 361 332 362 case WM_COMMAND: 333 363 case WM_SYSCOMMAND: 334 break;335 364 336 365 case WM_CHAR: 337 break;338 366 339 367 case WM_INITMENU: … … 341 369 case WM_MENUEND: 342 370 case WM_NEXTMENU: 343 break;344 371 345 372 case WM_TIMER: 346 break;347 373 goto RunDefWndProc; 374 348 375 case WM_SETWINDOWPARAMS: 349 376 { 350 377 WNDPARAMS *wndParams = (WNDPARAMS *)mp1; 351 378 352 dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));353 if(wndParams->fsStatus & WPM_TEXT) {354 355 356 357 }358 goto RunDefWndProc;379 dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd)); 380 if(wndParams->fsStatus & WPM_TEXT) { 381 if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) { 382 goto RunDefWndProc; 383 } 384 } 385 goto RunDefWndProc; 359 386 } 360 387 361 388 case WM_PAINT: 362 dprintf(("OS2: WM_PAINT %x", hwnd));389 dprintf(("OS2: WM_PAINT %x", hwnd)); 363 390 if(win32wnd->MsgPaint(0, 0)) { 364 391 goto RunDefWndProc; … … 366 393 break; 367 394 395 case WM_HITTEST: 396 if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) { 397 goto RunDefWndProc; 398 } 399 break; 400 368 401 case WM_SYSCOLORCHANGE: 369 402 case WM_SYSVALUECHANGED: 370 break;371 372 403 case WM_CALCVALIDRECTS: 373 404 case WM_QUERYWINDOWPARAMS: 374 case WM_HITTEST:375 405 case WM_SETSELECTION: 376 406 case WM_PPAINT: … … 391 421 case WM_SAVEAPPLICATION: 392 422 case WM_SEMANTICEVENT: 393 break;394 423 default: 395 dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));424 dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 396 425 RestoreOS2TIB(); 397 426 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); -
trunk/src/user32/new/win32wnd.cpp
r327 r328 1 /* $Id: win32wnd.cpp,v 1.1 0 1999-07-18 13:57:48 cbratschiExp $ */1 /* $Id: win32wnd.cpp,v 1.11 1999-07-18 14:39:35 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 95 95 flags = 0; 96 96 isIcon = FALSE; 97 lastHitTestVal = 0; 97 98 owner = NULL; 98 99 windowClass = 0; … … 128 129 dprintf(("Bad parent %04x\n", cs->hwndParent )); 129 130 SetLastError(ERROR_INVALID_PARAMETER); 130 131 return FALSE; 131 132 } 132 133 /* Make sure parent is valid */ … … 231 232 if ((cs->style & WS_CHILD) && cs->hwndParent) 232 233 { 233 234 SetParent(cs->hwndParent); 234 235 } 235 236 else … … 240 241 else 241 242 { 242 243 owner = GetWindowFromHandle(cs->hwndParent); 243 244 if(owner == NULL) 244 245 { … … 263 264 if (HOOK_IsHooked( WH_CBT )) 264 265 { 265 266 CBT_CREATEWNDA cbtc; 266 267 LRESULT ret; 267 268 268 269 269 cbtc.lpcs = cs; 270 cbtc.hwndInsertAfter = hwndLinkAfter; 270 271 ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc) 271 272 : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc); 272 273 if (ret) 273 274 275 274 { 275 TRACE_(win)("CBT-hook returned 0\n"); 276 wndPtr->pDriver->pFinalize(wndPtr); 276 277 retvalue = 0; 277 278 goto end; 278 279 } 279 280 } 280 281 #endif … … 337 338 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName, 338 339 (owner) ? owner->getOS2WindowHandle() : 0, 339 340 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 340 341 &OS2HwndFrame); 341 342 … … 354 355 #if 0 355 356 if(OS2Hwnd != OS2HwndFrame) { 356 357 358 359 360 361 362 363 357 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 358 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame)); 359 return FALSE; 360 } 361 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) { 362 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame)); 363 return FALSE; 364 } 364 365 } 365 366 #endif … … 389 390 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, 390 391 maxPos.y - rectWindow.top); 391 392 dprintf(("Sending WM_CREATE")); 392 393 if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 ) 393 394 { 394 395 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top, 395 396 397 396 rectClient.right-rectClient.left, 397 rectClient.bottom-rectClient.top, 398 SWP_NOACTIVATE); 398 399 399 400 if (cs->style & WS_VISIBLE) ShowWindow( sw ); … … 405 406 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); 406 407 #endif 407 408 return TRUE; 408 409 } 409 410 } … … 429 430 if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd)) 430 431 { 431 432 433 434 435 436 437 438 439 440 441 442 443 432 if( dwStyle & WS_MINIMIZE ) 433 { 434 if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) ) 435 return (SWP_NOSIZE | SWP_NOMOVE); 436 swpFlags |= SWP_NOCOPYBITS; 437 } 438 switch( cmd ) 439 { 440 case SW_MINIMIZE: 441 if( dwStyle & WS_MAXIMIZE) 442 { 443 flags |= WIN_RESTORE_MAX; 444 dwStyle &= ~WS_MAXIMIZE; 444 445 } 445 446 else 446 447 447 flags &= ~WIN_RESTORE_MAX; 448 dwStyle |= WS_MINIMIZE; 448 449 449 450 #if 0 450 451 452 451 if( flags & WIN_NATIVE ) 452 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) ) 453 swpFlags |= MINMAX_NOSWP; 453 454 #endif 454 455 455 456 457 458 459 460 461 462 456 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos ); 457 458 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y, 459 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 460 swpFlags |= SWP_NOCOPYBITS; 461 break; 462 463 case SW_MAXIMIZE: 463 464 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); 464 465 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL ); 465 466 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); 466 467 467 468 469 470 471 472 473 474 475 468 if( dwStyle & WS_MINIMIZE ) 469 { 470 if( flags & WIN_NATIVE ) 471 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 472 swpFlags |= MINMAX_NOSWP; 473 474 WINPOS_ShowIconTitle( wndPtr, FALSE ); 475 dwStyle &= ~WS_MINIMIZE; 476 } 476 477 dwStyle |= WS_MAXIMIZE; 477 478 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 479 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, 480 size.x, size.y ); 481 break; 482 483 case SW_RESTORE: 484 if( dwStyle & WS_MINIMIZE ) 485 { 486 if( flags & WIN_NATIVE ) 487 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 488 swpFlags |= MINMAX_NOSWP; 489 490 dwStyle &= ~WS_MINIMIZE; 491 WINPOS_ShowIconTitle( wndPtr, FALSE ); 492 493 if( flags & WIN_RESTORE_MAX) 494 { 495 /* Restore to maximized position */ 495 496 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); 496 497 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL); 497 498 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 499 dwStyle |= WS_MAXIMIZE; 500 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y ); 501 break; 502 } 503 } 504 else 505 if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1); 506 else dwStyle &= ~WS_MAXIMIZE; 507 508 /* Restore to normal position */ 509 510 *lpRect = lpPos->rectNormal; 511 lpRect->right -= lpRect->left; 512 lpRect->bottom -= lpRect->top; 513 514 break; 515 } 515 516 } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE; 516 517 return swpFlags; … … 611 612 { 612 613 winposCopy = *winpos; 613 614 615 614 params.rgrc[1] = *oldWindowRect; 615 params.rgrc[2] = *oldClientRect; 616 params.lppos = &winposCopy; 616 617 } 617 618 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, … … 665 666 //****************************************************************************** 666 667 ULONG Win32Window::MsgMove(ULONG xParent, ULONG yParent) 667 { 668 return 0; 668 { 669 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)xParent, (USHORT)yParent)); 670 } 671 //****************************************************************************** 672 //****************************************************************************** 673 ULONG Win32Window::MsgHitTest(ULONG x, ULONG y) 674 { 675 lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y)); 676 return 1; //TODO: May need to change this 669 677 } 670 678 //****************************************************************************** … … 709 717 { 710 718 ULONG win32msg; 719 ULONG win32ncmsg; 711 720 712 721 switch(msg) { 713 722 case BUTTON_LEFTDOWN: 714 723 win32msg = WM_LBUTTONDOWN; 724 win32ncmsg = WM_NCLBUTTONDOWN; 715 725 break; 716 726 case BUTTON_LEFTUP: 717 727 win32msg = WM_LBUTTONUP; 728 win32ncmsg = WM_NCLBUTTONUP; 718 729 break; 719 730 case BUTTON_LEFTDBLCLICK: 720 731 win32msg = WM_LBUTTONDBLCLK; 732 win32ncmsg = WM_NCLBUTTONDBLCLK; 721 733 break; 722 734 case BUTTON_RIGHTUP: 723 735 win32msg = WM_RBUTTONUP; 736 win32ncmsg = WM_NCRBUTTONUP; 724 737 break; 725 738 case BUTTON_RIGHTDOWN: 726 739 win32msg = WM_RBUTTONDOWN; 740 win32ncmsg = WM_NCRBUTTONDOWN; 727 741 break; 728 742 case BUTTON_RIGHTDBLCLICK: 729 743 win32msg = WM_RBUTTONDBLCLK; 744 win32ncmsg = WM_NCRBUTTONDBLCLK; 745 break; 746 case BUTTON_MIDDLEUP: 747 win32msg = WM_MBUTTONUP; 748 win32ncmsg = WM_NCMBUTTONUP; 749 break; 750 case BUTTON_MIDDLEDOWN: 751 win32msg = WM_MBUTTONDOWN; 752 win32ncmsg = WM_NCMBUTTONDOWN; 753 break; 754 case BUTTON_MIDDLEDBLCLICK: 755 win32msg = WM_MBUTTONDBLCLK; 756 win32ncmsg = WM_NCMBUTTONDBLCLK; 730 757 break; 731 758 default: … … 733 760 return 1; 734 761 } 735 return SendInternalMessageA(win32msg, 0, MAKELONG(x, MapOS2ToWin32Y(OS2Hwnd, y))); 762 SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(x, y)); //TODO: 763 return SendInternalMessageA(win32msg, 0, MAKELONG(x, y)); 764 } 765 //****************************************************************************** 766 //****************************************************************************** 767 ULONG Win32Window::MsgMouseMove(ULONG keystate, ULONG x, ULONG y) 768 { 769 ULONG winstate = 0; 770 771 if(keystate & WMMOVE_LBUTTON) 772 winstate |= MK_LBUTTON; 773 if(keystate & WMMOVE_RBUTTON) 774 winstate |= MK_RBUTTON; 775 if(keystate & WMMOVE_MBUTTON) 776 winstate |= MK_MBUTTON; 777 if(keystate & WMMOVE_SHIFT) 778 winstate |= MK_SHIFT; 779 if(keystate & WMMOVE_CTRL) 780 winstate |= MK_CONTROL; 781 782 return SendInternalMessageA(WM_MOUSEMOVE, keystate, MAKELONG(x, y)); 736 783 } 737 784 //****************************************************************************** … … 745 792 ULONG Win32Window::MsgEraseBackGround(ULONG hps) 746 793 { 747 return SendInternalMessageA(WM_ERASEBKGND, hps, 0); 794 if(isIcon) { 795 return SendInternalMessageA(WM_ICONERASEBKGND, hps, 0); 796 } 797 else return SendInternalMessageA(WM_ERASEBKGND, hps, 0); 748 798 } 749 799 //****************************************************************************** … … 752 802 { 753 803 if(isUnicode) { 754 804 return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz); 755 805 } 756 806 else return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz); … … 843 893 { 844 894 if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE) 845 846 895 dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 847 896 … … 929 978 postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET)); 930 979 if(postmsg == NULL) { 931 932 980 dprintf(("Win32Window::PostMessageA: malloc returned NULL!!")); 981 return 0; 933 982 } 934 983 postmsg->Msg = msg; … … 945 994 postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET)); 946 995 if(postmsg == NULL) { 947 948 996 dprintf(("Win32Window::PostMessageW: malloc returned NULL!!")); 997 return 0; 949 998 } 950 999 postmsg->Msg = msg; … … 987 1036 if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR) 988 1037 { 989 990 991 992 993 1038 OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate); 1039 if(OS2HwndMenu == 0) { 1040 dprintf(("Win32Window::SetMenu OS2HwndMenu == 0")); 1041 return FALSE; 1042 } 994 1043 } 995 1044 dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu)); … … 1005 1054 switch(nCmdShow) 1006 1055 { 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1056 case SW_SHOW: 1057 case SW_SHOWDEFAULT: //todo 1058 showstate = SWPOS_SHOW | SWPOS_ACTIVATE; 1059 break; 1060 case SW_HIDE: 1061 showstate = SWPOS_HIDE; 1062 break; 1063 case SW_RESTORE: 1064 showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE; 1065 break; 1066 case SW_MINIMIZE: 1067 showstate = SWPOS_MINIMIZE; 1068 break; 1069 case SW_SHOWMAXIMIZED: 1070 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 1071 break; 1072 case SW_SHOWMINIMIZED: 1073 showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 1074 break; 1075 case SW_SHOWMINNOACTIVE: 1076 showstate = SWPOS_MINIMIZE | SWPOS_SHOW; 1077 break; 1078 case SW_SHOWNA: 1079 showstate = SWPOS_SHOW; 1080 break; 1081 case SW_SHOWNOACTIVATE: 1082 showstate = SWPOS_SHOW; 1083 break; 1084 case SW_SHOWNORMAL: 1085 showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW; 1086 break; 1038 1087 } 1039 1088 return OSLibWinShowWindow(OS2HwndFrame, showstate); … … 1047 1096 1048 1097 switch(hwndInsertAfter) { 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1098 case HWND_BOTTOM: 1099 hwndInsertAfter = HWNDOS_BOTTOM; 1100 break; 1101 case HWND_TOPMOST: //TODO: 1102 case HWND_NOTOPMOST: //TODO: 1103 case HWND_TOP: 1104 hwndInsertAfter = HWNDOS_TOP; 1105 break; 1106 default: 1107 window = GetWindowFromHandle(hwndInsertAfter); 1108 if(window) { 1109 hwndInsertAfter = window->getOS2WindowHandle(); 1110 } 1111 else { 1112 dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter)); 1113 hwndInsertAfter = 0; 1114 } 1115 break; 1067 1116 1068 1117 } 1069 1118 setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER; 1070 1119 if(fuFlags & SWP_DRAWFRAME) 1071 1120 setstate |= 0; //TODO 1072 1121 if(fuFlags & SWP_FRAMECHANGED) 1073 1122 setstate |= 0; //TODO 1074 1123 if(fuFlags & SWP_HIDEWINDOW) 1075 1124 setstate &= ~SWPOS_ZORDER; 1076 1125 if(fuFlags & SWP_NOACTIVATE) 1077 1126 setstate &= ~SWPOS_ACTIVATE; 1078 1127 if(fuFlags & SWP_NOCOPYBITS) 1079 setstate |= 0;//TODO1128 setstate |= 0; //TODO 1080 1129 if(fuFlags & SWP_NOMOVE) 1081 1130 setstate &= ~SWPOS_MOVE; 1082 1131 if(fuFlags & SWP_NOSIZE) 1083 1132 setstate &= ~SWPOS_SIZE; 1084 1133 if(fuFlags & SWP_NOREDRAW) 1085 1134 setstate |= SWPOS_NOREDRAW; 1086 1135 if(fuFlags & SWP_NOZORDER) 1087 1136 setstate &= ~SWPOS_ZORDER; 1088 1137 if(fuFlags & SWP_SHOWWINDOW) 1089 1138 setstate |= SWPOS_SHOW; 1090 1139 1091 1140 return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate); … … 1103 1152 { 1104 1153 if(getParent()) { 1105 1154 return getParent()->getWindowHandle(); 1106 1155 } 1107 1156 else return 0; … … 1120 1169 1121 1170 if(hwndNewParent == 0) {//desktop window = parent 1122 1171 setParent(NULL); 1123 1172 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 1124 1173 return oldhwnd; … … 1139 1188 { 1140 1189 if(getParent()) { 1141 1190 return getParent()->getWindowHandle() == hwndParent; 1142 1191 } 1143 1192 else return 0; … … 1156 1205 BOOL Win32Window::UpdateWindow() 1157 1206 { 1158 OSRECTLrect;1207 RECT rect; 1159 1208 1160 1209 if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect)) 1161 1210 {//update region not empty 1162 1211 SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0); 1163 1212 } 1164 1213 return TRUE; … … 1183 1232 switch(uCmd) 1184 1233 { 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1234 case GW_CHILD: 1235 getcmd = QWOS_TOP; 1236 break; 1237 case GW_HWNDFIRST: 1238 if(getParent()) { 1239 getcmd = QWOS_TOP; //top of child windows 1240 } 1241 else getcmd = QWOS_TOP; //TODO 1242 break; 1243 case GW_HWNDLAST: 1244 if(getParent()) { 1245 getcmd = QWOS_BOTTOM; //bottom of child windows 1246 } 1247 else getcmd = QWOS_BOTTOM; //TODO 1248 break; 1249 case GW_HWNDNEXT: 1250 getcmd = QWOS_NEXT; 1251 break; 1252 case GW_HWNDPREV: 1253 getcmd = QWOS_PREV; 1254 break; 1255 case GW_OWNER: 1256 if(owner) { 1257 return owner->getWindowHandle(); 1258 } 1259 else return 0; 1211 1260 } 1212 1261 hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd); 1213 1262 if(hwndRelated) 1214 1263 { 1215 1216 1217 1218 1219 1220 1264 win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR); 1265 magic = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC); 1266 if(CheckMagicDword(magic) && win32wnd) 1267 { 1268 return win32wnd->getWindowHandle(); 1269 } 1221 1270 } 1222 1271 return 0; … … 1255 1304 if(CheckMagicDword(magic) && win32wnd) 1256 1305 { 1257 1306 return win32wnd->getWindowHandle(); 1258 1307 } 1259 1308 return hwndActive; … … 1325 1374 return oldval; 1326 1375 case GWL_HWNDPARENT: 1327 1376 return SetParent((HWND)value); 1328 1377 1329 1378 case GWL_ID: … … 1410 1459 1411 1460 if(HIWORD(hwnd) != 0x6800) { 1412 1461 return NULL; 1413 1462 } 1414 1463 1415 1464 if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) { 1416 1465 return window; 1417 1466 } 1418 1467 else return NULL; … … 1420 1469 //****************************************************************************** 1421 1470 //****************************************************************************** 1422 Win32Window *Win32Window::GetWindowFromOS2Handle(HWND hwnd)1423 {1424 ULONG winHandle;1425 Win32Window *window;1426 1427 //CB: returns index, not handle!1428 if(HMHandleTranslateToWin(hwnd,(PULONG)&winHandle) == NO_ERROR)1429 {1430 if (HMHandleTranslateToOS2(LOWORD(winHandle),(PULONG)&window) == NO_ERROR)1431 {1432 return window;1433 } else return NULL;1434 } else return NULL;1435 }1436 //******************************************************************************1437 //******************************************************************************1438 1471 GenericObject *Win32Window::windows = NULL; -
trunk/src/user32/new/win32wnd.h
r327 r328 1 /* $Id: win32wnd.h,v 1. 9 1999-07-18 13:57:48 cbratschiExp $ */1 /* $Id: win32wnd.h,v 1.10 1999-07-18 14:39:35 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 21 21 class Win32Window; 22 22 23 #define OFFSET_WIN32WNDPTR 24 #define OFFSET_WIN32PM_MAGIC 25 26 #define WIN32PM_MAGIC 27 #define CheckMagicDword(a) 23 #define OFFSET_WIN32WNDPTR 0 24 #define OFFSET_WIN32PM_MAGIC 4 25 26 #define WIN32PM_MAGIC 0x12345678 27 #define CheckMagicDword(a) (a==WIN32PM_MAGIC) 28 28 29 29 typedef struct { 30 USHORTcb;31 32 ULONG win32CreateStruct;//or dialog create dword30 USHORT cb; 31 Win32Window *win32wnd; 32 ULONG win32CreateStruct; //or dialog create dword 33 33 } CUSTOMWNDDATA; 34 34 35 35 typedef struct 36 36 { 37 ULONGMsg;38 ULONGwParam;39 ULONGlParam;37 ULONG Msg; 38 ULONG wParam; 39 ULONG lParam; 40 40 } POSTMSG_PACKET; 41 41 42 #define WM_WIN32_POSTMESSAGEA 43 #define WM_WIN32_POSTMESSAGEW 42 #define WM_WIN32_POSTMESSAGEA 0x4000 43 #define WM_WIN32_POSTMESSAGEW 0x4001 44 44 45 45 class Win32Window : private GenericObject, private ChildWindow 46 46 { 47 47 public: 48 DWORDmagic;49 50 51 48 DWORD magic; 49 50 Win32Window(DWORD objType); 51 Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode); 52 52 virtual ~Win32Window(); 53 53 54 54 virtual ULONG MsgCreate(HWND hwndOS2, ULONG initParam); 55 56 55 ULONG MsgQuit(); 56 ULONG MsgClose(); 57 57 ULONG MsgDestroy(); 58 ULONG MsgEnable(BOOL fEnable); 59 ULONG MsgShow(BOOL fShow); 60 ULONG MsgMove(ULONG xParent, ULONG yParent); 61 ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize); 58 ULONG MsgEnable(BOOL fEnable); 59 ULONG MsgShow(BOOL fShow); 60 ULONG MsgMove(ULONG x, ULONG y); 61 ULONG MsgHitTest(ULONG x, ULONG y); 62 ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize); 62 63 ULONG MsgActivate(BOOL fActivate, HWND hwnd); 63 64 65 66 ULONG MsgPaint(ULONG tmp1, ULONG tmp2);67 ULONG MsgEraseBackGround(ULONG hps);68 ULONG MsgSetText(LPSTR lpsz, LONG cch);69 70 virtual LONG SetWindowLongA(int index, ULONG value); 71 virtual ULONG GetWindowLongA(int index);72 virtual WORD SetWindowWord(int index, WORD value);73 virtual WORD GetWindowWord(int index);74 75 DWORD getStyle() { return dwStyle; }; 76 DWORD getExStyle() { return dwExStyle; };77 HWND getWindowHandle() { return Win32Hwnd; };78 HWND getOS2WindowHandle() { return OS2Hwnd; };79 Win32Window *getParent() { return (Win32Window *)ChildWindow::GetParent(); };80 void setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };81 64 ULONG MsgSetFocus(HWND hwnd); 65 ULONG MsgKillFocus(HWND hwnd); 66 ULONG MsgButton(ULONG msg, ULONG x, ULONG y); 67 ULONG MsgMouseMove(ULONG keystate, ULONG x, ULONG y); 68 ULONG MsgPaint(ULONG tmp1, ULONG tmp2); 69 ULONG MsgEraseBackGround(ULONG hps); 70 ULONG MsgSetText(LPSTR lpsz, LONG cch); 71 72 virtual LONG SetWindowLongA(int index, ULONG value); 73 virtual ULONG GetWindowLongA(int index); 74 virtual WORD SetWindowWord(int index, WORD value); 75 virtual WORD GetWindowWord(int index); 76 77 DWORD getStyle() { return dwStyle; }; 78 DWORD getExStyle() { return dwExStyle; }; 79 HWND getWindowHandle() { return Win32Hwnd; }; 80 HWND getOS2WindowHandle() { return OS2Hwnd; }; 81 Win32Window *getParent() { return (Win32Window *)ChildWindow::GetParent(); }; 82 void setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); }; 82 83 WNDPROC getWindowProc() { return win32wndproc; }; 83 84 void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; }; … … 85 86 void setWindowId(DWORD id) { windowId = id; }; 86 87 87 DWORD getFlags(){ return flags; };88 void setFlags(DWORD newflags){ flags = newflags; };89 90 91 92 93 94 95 96 97 98 99 100 88 DWORD getFlags() { return flags; }; 89 void setFlags(DWORD newflags) { flags = newflags; }; 90 91 BOOL SetMenu(ULONG hMenu); 92 BOOL ShowWindow(ULONG nCmdShow); 93 BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags); 94 BOOL DestroyWindow(); 95 HWND SetActiveWindow(); 96 HWND GetParent(); 97 HWND SetParent(HWND hwndNewParent); 98 BOOL IsChild(HWND hwndParent); 99 HWND GetTopWindow(); 100 BOOL UpdateWindow(); 101 BOOL IsIconic(); 101 102 HWND GetWindow(UINT uCmd); 102 103 103 BOOL EnableWindow(BOOL fEnable); 104 BOOL BringWindowToTop(); 104 105 static HWND GetActiveWindow(); 105 106 BOOL IsWindow(); 107 BOOL IsWindowEnabled(); 108 BOOL IsWindowVisible(); 109 110 BOOL GetWindowRect(PRECT pRect); 111 int GetWindowTextLengthA(); 112 int GetWindowTextA(LPSTR lpsz, int cch); 113 BOOL SetWindowTextA(LPCSTR lpsz); 106 BOOL IsWindow(); 107 BOOL IsWindowEnabled(); 108 BOOL IsWindowVisible(); 109 110 BOOL GetWindowRect(PRECT pRect); 111 int GetWindowTextLengthA(); 112 int GetWindowTextA(LPSTR lpsz, int cch); 113 BOOL SetWindowTextA(LPCSTR lpsz); 114 114 115 115 LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam); … … 125 125 126 126 static Win32Window *GetWindowFromHandle(HWND hwnd); 127 static Win32Window *GetWindowFromOS2Handle(HWND hwnd);128 127 129 128 protected: 130 129 LRESULT SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam); 131 130 LRESULT SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam); 132 133 134 HWNDOS2Hwnd;135 HWNDOS2HwndFrame;136 137 HWNDWin32Hwnd;138 139 140 intposx, posy, width, height;141 142 143 ULONG dwExStyle;//GWL_EXSTYLE144 ULONG dwStyle;//GWL_STYLE145 WNDPROC win32wndproc; 146 ULONG hInstance;//GWL_HINSTANCE131 void Init(); 132 133 HWND OS2Hwnd; 134 HWND OS2HwndFrame; 135 HWND OS2HwndMenu; 136 HWND Win32Hwnd; 137 BOOL isUnicode; 138 139 int posx, posy, width, height; 140 141 // values normally contained in the standard window words 142 ULONG dwExStyle; //GWL_EXSTYLE 143 ULONG dwStyle; //GWL_STYLE 144 WNDPROC win32wndproc; //GWL_WNDPROC 145 ULONG hInstance; //GWL_HINSTANCE 147 146 //Moved in ChildWindow class 148 ///// Win32Window *parent; 149 ULONG windowId;//GWL_ID150 ULONG userData;//GWL_USERDATA147 ///// Win32Window *parent; //GWL_HWNDPARENT 148 ULONG windowId; //GWL_ID 149 ULONG userData; //GWL_USERDATA 151 150 152 151 HWND hwndLinkAfter; 153 152 DWORD flags; 154 155 BOOL isIcon; 156 157 Win32Window *owner; 158 159 char *windowName; 160 ULONG wndNameLength; 161 162 char *windowText; 163 ULONG wndTextLength; 164 165 ULONG *userWindowLong; 166 ULONG nrUserWindowLong; 167 168 RECT rectWindow; 169 RECT rectClient; 153 DWORD lastHitTestVal; //Last value returned by WM_NCHITTEST handler 154 155 BOOL isIcon; 156 157 Win32Window *owner; 158 159 char *windowName; 160 ULONG wndNameLength; 161 162 char *windowText; 163 ULONG wndTextLength; 164 165 ULONG *userWindowLong; 166 ULONG nrUserWindowLong; 167 168 RECT rectWindow; 169 RECT rectClient; 170 170 171 171 Win32WndClass *windowClass; … … 175 175 private: 176 176 #ifndef OS2_INCLUDED 177 178 179 180 181 177 BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom); 178 179 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); 180 181 LONG SendNCCalcSize(BOOL calcValidRect, 182 182 RECT *newWindowRect, RECT *oldWindowRect, 183 183 RECT *oldClientRect, WINDOWPOS *winpos, … … 186 186 LRESULT SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam) 187 187 { 188 189 190 elsereturn SendInternalMessageA(msg, wParam, lParam);188 if(isUnicode) 189 return SendInternalMessageW(msg, wParam, lParam); 190 else return SendInternalMessageA(msg, wParam, lParam); 191 191 } 192 192 #endif … … 194 194 195 195 196 #define BUTTON_LEFTDOWN 0 197 #define BUTTON_LEFTUP 1 198 #define BUTTON_LEFTDBLCLICK 2 199 #define BUTTON_RIGHTUP 3 200 #define BUTTON_RIGHTDOWN 4 201 #define BUTTON_RIGHTDBLCLICK 5 196 #define BUTTON_LEFTDOWN 0 197 #define BUTTON_LEFTUP 1 198 #define BUTTON_LEFTDBLCLICK 2 199 #define BUTTON_RIGHTUP 3 200 #define BUTTON_RIGHTDOWN 4 201 #define BUTTON_RIGHTDBLCLICK 5 202 #define BUTTON_MIDDLEUP 6 203 #define BUTTON_MIDDLEDOWN 7 204 #define BUTTON_MIDDLEDBLCLICK 8 205 206 #define WMMOVE_LBUTTON 1 207 #define WMMOVE_MBUTTON 2 208 #define WMMOVE_RBUTTON 4 209 #define WMMOVE_CTRL 8 210 #define WMMOVE_SHIFT 16 211 202 212 203 213 #endif //__cplusplus -
trunk/src/user32/new/wingdi.cpp
r327 r328 1 /* $Id: wingdi.cpp,v 1. 2 1999-07-18 13:57:48 cbratschiExp $ */1 /* $Id: wingdi.cpp,v 1.3 1999-07-18 14:39:35 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window graphics apis for OS/2 … … 23 23 { 24 24 Win32Window *window; 25 OSRECTL rect;26 25 27 26 window = Win32Window::GetWindowFromHandle(hwnd); 28 27 if(!window) { 29 30 28 dprintf(("GetDC, window %x not found", hwnd)); 29 return 0; 31 30 } 32 31 dprintf(("BeginPaint %X\n", hwnd)); 33 if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), & rect) == FALSE)32 if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &lps->rcPaint) == FALSE) 34 33 { 35 36 34 dprintf(("BeginPaint, NO update rectl")); 35 return 0; 37 36 } 38 MapOS2ToWin32Rectl(window->getOS2WindowHandle(),(PRECTLOS2)&rect,&lps->rcPaint);39 37 lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), (PVOID)&lps->rcPaint); 40 38 … … 57 55 window = Win32Window::GetWindowFromHandle(hwnd); 58 56 if(!window) { 59 60 57 dprintf(("GetDC, window %x not found", hwnd)); 58 return 0; 61 59 } 62 60 dprintf(("GetDC %x", hwnd));
Note:
See TracChangeset
for help on using the changeset viewer.