- Timestamp:
- Dec 24, 1999, 7:42:46 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/dc.cpp
r2076 r2200 1 /* $Id: dc.cpp,v 1.2 8 1999-12-14 19:13:18sandervl Exp $ */1 /* $Id: dc.cpp,v 1.29 1999-12-24 18:39:10 sandervl Exp $ */ 2 2 3 3 /* … … 1381 1381 //****************************************************************************** 1382 1382 //****************************************************************************** 1383 BOOL WIN32API ValidateRect( HWND hwnd, const RECT * lprc) 1384 { 1385 dprintf(("USER32: ValidateRect %x (%d,%d)(%d,%d)", hwnd, lprc->left, lprc->top, lprc->right, lprc->bottom)); 1386 return RedrawWindow( hwnd, lprc, 0, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0)); 1387 } 1388 //****************************************************************************** 1389 //****************************************************************************** 1390 BOOL WIN32API ValidateRgn( HWND hwnd, HRGN hrgn) 1391 { 1392 dprintf(("USER32: ValidateRgn %x %x", hwnd, hrgn)); 1393 return RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0)); 1394 } 1395 /***************************************************************************** 1396 * Name : int WIN32API GetWindowRgn 1397 * Purpose : The GetWindowRgn function obtains a copy of the window region of a window. 1398 * Parameters: HWND hWnd handle to window whose window region is to be obtained 1399 * HRGN hRgn handle to region that receives a copy of the window region 1400 * Variables : 1401 * Result : NULLREGION, SIMPLEREGION, COMPLEXREGION, ERROR 1402 * Remark : 1403 * Status : UNTESTED STUB 1404 * 1405 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1406 *****************************************************************************/ 1407 1408 int WIN32API GetWindowRgn (HWND hWnd, 1409 HRGN hRgn) 1410 { 1411 dprintf(("USER32:GetWindowRgn (%08xh,%08x) not implemented.\n", 1412 hWnd, 1413 hRgn)); 1414 //Attention: Win32 hwnd handle! 1415 1416 return (NULLREGION_W); 1417 } 1418 /***************************************************************************** 1419 * Name : int WIN32API SetWindowRgn 1420 * Purpose : The SetWindowRgn function sets the window region of a window. The 1421 * window region determines the area within the window where the 1422 * operating system permits drawing. The operating system does not 1423 * display any portion of a window that lies outside of the window region 1424 * Parameters: HWND hWnd handle to window whose window region is to be set 1425 * HRGN hRgn handle to region 1426 * BOOL bRedraw window redraw flag 1427 * Variables : 1428 * Result : If the function succeeds, the return value is non-zero. 1429 * If the function fails, the return value is zero. 1430 * Remark : 1431 * Status : UNTESTED STUB 1432 * 1433 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1434 *****************************************************************************/ 1435 1436 int WIN32API SetWindowRgn(HWND hWnd, 1437 HRGN hRgn, 1438 BOOL bRedraw) 1439 { 1440 dprintf(("USER32:SetWindowRgn (%08xh,%08xh,%u) not implemented.\n", 1441 hWnd, 1442 hRgn, 1443 bRedraw)); 1444 //Attention: Win32 hwnd handle! 1445 1446 return (0); 1447 } 1448 //****************************************************************************** 1449 //****************************************************************************** -
trunk/src/user32/oslibmsg.cpp
r1971 r2200 1 /* $Id: oslibmsg.cpp,v 1.1 4 1999-12-05 00:31:47sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.15 1999-12-24 18:39:10 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 9 9 * Project Odin Software License can be found in LICENSE.TXT 10 10 * 11 * TODO: Simply copy for now. Need to make a real translation 11 * TODO: Some messages that are sent to the frame window are directly passed on to the client 12 * -> Get/PeekMessage never gets them as we return a dummy message for non-client windows 13 * (i.e. menu WM_COMMAND messages) 14 * 12 15 * TODO: Filter translation isn't correct for posted messages 13 16 * … … 27 30 #include <wprocess.h> 28 31 #include "pmwindow.h" 32 #include "oslibwin.h" 29 33 30 34 typedef BOOL (EXPENTRY FNTRANS)(MSG *, QMSG *); … … 80 84 0x020a, 0x020a, // WM_???, WM_??? 81 85 WM_CHAR, WINWM_CHAR, 82 86 83 87 //TODO: Needs better translation! 84 88 WM_CHAR, WINWM_KEYDOWN, … … 92 96 QMSG *MsgThreadPtr = 0; 93 97 98 LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 99 94 100 //****************************************************************************** 95 101 //****************************************************************************** … … 108 114 void WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode) 109 115 { 110 int i; 111 112 memcpy(os2Msg, winMsg, sizeof(MSG)); 113 os2Msg->hwnd = Win32Window::Win32ToOS2Handle(winMsg->hwnd); 114 os2Msg->reserved = 0; 115 for(i=0;i<MAX_MSGTRANSTAB;i++) 116 { 117 if(MsgTransTab[i].msgWin32 == winMsg->message) 118 { 119 os2Msg->msg = MsgTransTab[i].msgOS2; 120 break; 121 } 122 } 123 } 124 //****************************************************************************** 125 //****************************************************************************** 126 void OS2ToWinMsgTranslate(QMSG *os2Msg, MSG *winMsg, BOOL isUnicode) 127 { 128 POSTMSG_PACKET *packet; 129 int i; 130 131 memcpy(winMsg, os2Msg, sizeof(MSG)); 132 winMsg->hwnd = Win32Window::OS2ToWin32Handle(os2Msg->hwnd); 133 134 if(os2Msg->msg == WIN32APP_POSTMSG) { 135 packet = (POSTMSG_PACKET *)os2Msg->mp2; 136 if(packet && (ULONG)os2Msg->mp1 == WIN32PM_MAGIC) { 137 winMsg->message = packet->Msg; 138 winMsg->wParam = packet->wParam; 139 winMsg->lParam = packet->lParam; 140 } 141 return; 142 } 143 for(i=0;i<MAX_MSGTRANSTAB;i++) 144 { 145 if(MsgTransTab[i].msgOS2 == os2Msg->msg) 146 { 147 winMsg->message = MsgTransTab[i].msgWin32; 148 break; 149 } 150 } 116 // memcpy(os2Msg, winMsg, sizeof(MSG)); 117 // os2Msg->hwnd = Win32Window::Win32ToOS2Handle(winMsg->hwnd); 118 // os2Msg->reserved = 0; 151 119 } 152 120 //****************************************************************************** … … 159 127 { 160 128 POSTMSG_PACKET *packet; 161 THDB *thdb;162 163 thdb = GetThreadTHDB();164 if(thdb) {165 thdb->fMsgTranslated = TRUE;166 }167 129 168 130 if(msg >= WINWM_USER) … … 192 154 LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode) 193 155 { 194 BOOL eaten = 0; 195 196 //TODO: What to do if app changed msg? (translate) 197 // WinToOS2MsgTranslate(msg, &qmsg, isUnicode); 198 199 //SvL: Some apps use PeeKMessage(remove) & DispatchMessage instead of 200 // GetMessage/DispatchMessage 201 if (MsgThreadPtr->msg == WM_TIMER) 202 eaten = TIMER_HandleTimer (MsgThreadPtr); 203 204 if(eaten) return 0; 205 206 return (LONG)WinDispatchMsg(GetThreadHAB(), MsgThreadPtr); 156 THDB *thdb; 157 QMSG os2msg; 158 LONG rc; 159 160 thdb = GetThreadTHDB(); 161 if(thdb == NULL) { 162 DebugInt3(); 163 return FALSE; 164 } 165 166 //TODO: What to do if app changed msg? (translate) 167 // WinToOS2MsgTranslate(msg, &qmsg, isUnicode); 168 169 if(msg->time == MsgThreadPtr->time || msg->hwnd == 0) { 170 memcpy(&os2msg, MsgThreadPtr, sizeof(QMSG)); 171 MsgThreadPtr->time = -1; 172 if(msg->hwnd) { 173 thdb->nrOfMsgs = 1; 174 thdb->msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg 175 memcpy(&thdb->msg, msg, sizeof(MSG)); 176 } 177 return (LONG)WinDispatchMsg(thdb->hab, &os2msg); 178 } 179 else {//is this allowed? 180 // dprintf(("WARNING: OSLibWinDispatchMsg: called with own message!")); 181 return SendMessageA(msg->hwnd, msg->message, msg->wParam, msg->lParam); 182 } 207 183 } 208 184 //****************************************************************************** … … 212 188 { 213 189 BOOL rc, eaten; 190 THDB *thdb; 191 192 thdb = GetThreadTHDB(); 193 if(thdb == NULL) { 194 DebugInt3(); 195 return FALSE; 196 } 197 198 if(thdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) { 199 thdb->fTranslated = FALSE; 200 memcpy(pMsg, &thdb->msgWCHAR, sizeof(MSG)); 201 MsgThreadPtr->msg = 0; 202 MsgThreadPtr->hwnd = 0; 203 return TRUE; 204 } 205 if(hwnd) { 206 do { 207 WinWaitMsg(thdb->hab, TranslateWinMsg(uMsgFilterMin), TranslateWinMsg(uMsgFilterMax)); 208 rc = OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, PM_REMOVE_W, isUnicode); 209 } 210 while(rc == FALSE); 211 } 212 else 213 { 214 do { 215 eaten = FALSE; 216 rc = WinGetMsg(thdb->hab, MsgThreadPtr, TranslateWinMsg(uMsgFilterMin), TranslateWinMsg(uMsgFilterMax), 0); 217 if (MsgThreadPtr->msg == WM_TIMER) 218 eaten = TIMER_HandleTimer (MsgThreadPtr); 219 } while (eaten); 220 } 221 OS2ToWinMsgTranslate((PVOID)thdb, MsgThreadPtr, pMsg, isUnicode); 222 return rc; 223 } 224 //****************************************************************************** 225 //****************************************************************************** 226 BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 227 DWORD fRemove, BOOL isUnicode) 228 { 229 BOOL rc, eaten; 230 THDB *thdb; 231 QMSG os2msg; 232 233 thdb = GetThreadTHDB(); 234 if(thdb == NULL) { 235 DebugInt3(); 236 return FALSE; 237 } 238 239 if(thdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) { 240 if(fRemove == PM_REMOVE_W) { 241 thdb->fTranslated = FALSE; 242 MsgThreadPtr->msg = 0; 243 MsgThreadPtr->hwnd = 0; 244 } 245 memcpy(pMsg, &thdb->msgWCHAR, sizeof(MSG)); 246 return TRUE; 247 } 214 248 215 249 do { 216 eaten = FALSE; 217 rc = WinGetMsg(GetThreadHAB(), MsgThreadPtr, TranslateWinMsg(uMsgFilterMin), TranslateWinMsg(uMsgFilterMax), 0); 218 if (MsgThreadPtr->msg == WM_TIMER) 219 eaten = TIMER_HandleTimer (MsgThreadPtr); 220 } while (eaten); 221 222 OS2ToWinMsgTranslate(MsgThreadPtr, pMsg, isUnicode); 250 eaten = FALSE; 251 rc = WinPeekMsg(thdb->hab, &os2msg, Win32BaseWindow::OS2ToWin32Handle(hwnd), TranslateWinMsg(uMsgFilterMin), 252 TranslateWinMsg(uMsgFilterMax), (fRemove == PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 253 254 if (rc && fRemove == PM_REMOVE_W && os2msg.msg == WM_TIMER) 255 eaten = TIMER_HandleTimer(&os2msg); 256 } 257 while (eaten && rc); 258 259 OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode); 260 //TODO: This is not safe! There's no guarantee this message will be dispatched and it might overwrite a previous message 261 if(fRemove == PM_REMOVE_W) { 262 memcpy(MsgThreadPtr, &os2msg, sizeof(QMSG)); 263 } 223 264 return rc; 224 265 } 225 266 //****************************************************************************** 226 267 //****************************************************************************** 227 BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,228 BOOL fRemove, BOOL isUnicode)229 {230 BOOL rc;231 232 rc = WinPeekMsg(GetThreadHAB(), MsgThreadPtr, hwnd, TranslateWinMsg(uMsgFilterMin),233 TranslateWinMsg(uMsgFilterMax), (fRemove == MSG_REMOVE) ? PM_REMOVE : PM_NOREMOVE);234 OS2ToWinMsgTranslate(MsgThreadPtr, pMsg, isUnicode);235 return rc;236 }237 //******************************************************************************238 //******************************************************************************239 268 ULONG OSLibWinQueryMsgTime() 240 269 { … … 252 281 ULONG OSLibWinQueryQueueStatus() 253 282 { 254 ULONG statusOS2, statusWin32 ;283 ULONG statusOS2, statusWin32 = 0; 255 284 256 285 statusOS2 = WinQueryQueueStatus(HWND_DESKTOP); 257 286 258 287 if(statusOS2 & QS_KEY) 259 260 if(statusOS2 & QS_MOUSEBUTTON) 261 288 statusWin32 |= QS_KEY_W; 289 if(statusOS2 & QS_MOUSEBUTTON) 290 statusWin32 |= QS_MOUSEBUTTON_W; 262 291 if(statusOS2 & QS_MOUSEMOVE) 263 264 if(statusOS2 & QS_TIMER) 265 266 if(statusOS2 & QS_PAINT) 267 268 if(statusOS2 & QS_POSTMSG) 269 270 if(statusOS2 & QS_SENDMSG) 271 292 statusWin32 |= QS_MOUSEMOVE_W; 293 if(statusOS2 & QS_TIMER) 294 statusWin32 |= QS_TIMER_W; 295 if(statusOS2 & QS_PAINT) 296 statusWin32 |= QS_PAINT_W; 297 if(statusOS2 & QS_POSTMSG) 298 statusWin32 |= QS_POSTMESSAGE_W; 299 if(statusOS2 & QS_SENDMSG) 300 statusWin32 |= QS_SENDMESSAGE_W; 272 301 273 302 return statusWin32; -
trunk/src/user32/oslibmsg.h
r1971 r2200 1 /* $Id: oslibmsg.h,v 1. 6 1999-12-05 00:31:47sandervl Exp $ */1 /* $Id: oslibmsg.h,v 1.7 1999-12-24 18:39:10 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 18 18 ULONG TranslateWinMsg(ULONG msg); 19 19 20 #define ODINMSG_NOEXTRAMSGS 0 21 #define ODINMSG_EXTRAMSGS 1 22 20 23 #ifdef OS2DEF_INCLUDED 21 void OS2ToWinMsgTranslate(QMSG *os2Msg, MSG *winMsg, BOOL isUnicode);24 BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fTranslateExtraMsgs = ODINMSG_EXTRAMSGS); 22 25 void WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode); 26 27 extern QMSG *MsgThreadPtr; 28 23 29 #endif 24 30 … … 26 32 UINT uMsgFilterMax, BOOL isUnicode = FALSE); 27 33 BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, 28 UINT uMsgFilterMax, BOOLfRemove, BOOL isUnicode = FALSE);34 UINT uMsgFilterMax, DWORD fRemove, BOOL isUnicode = FALSE); 29 35 void OSLibWinPostQuitMessage(ULONG nExitCode); 30 36 LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode = FALSE); 37 BOOL OSLibWinTranslateMessage(MSG *msg); 31 38 32 39 ULONG OSLibWinQueryMsgTime(); … … 37 44 LONG OSLibWinGetMessageTime(); 38 45 BOOL OSLibWinReplyMessage(ULONG result); 39 40 46 ULONG OSLibWinQueryQueueStatus(); 41 47 … … 94 100 #define WINWM_COPYDATA 0x004A 95 101 #define WINWM_CANCELJOURNAL 0x004B 102 #define WINWM_CONTEXTMENU 0x007b 103 #define WINWM_STYLECHANGING 0x007c 104 #define WINWM_STYLECHANGED 0x007d 105 #define WINWM_DISPLAYCHANGE 0x007e 106 #define WINWM_GETICON 0x007f 107 #define WINWM_SETICON 0x0080 96 108 #define WINWM_NCCREATE 0x0081 97 109 #define WINWM_NCDESTROY 0x0082 … … 129 141 #define WINWM_INITMENU 0x0116 130 142 #define WINWM_INITMENUPOPUP 0x0117 143 #define WINWM_SYSTIMER 0x0118 131 144 #define WINWM_MENUSELECT 0x011F 132 145 #define WINWM_MENUCHAR 0x0120 … … 187 200 #define WINWM_HOTKEY 0x0312 188 201 #define WINWM_DDE_FIRST 0x03E0 189 #define WINWM_DDE_INITIATE (W M_DDE_FIRST)190 #define WINWM_DDE_TERMINATE (W M_DDE_FIRST + 1)191 #define WINWM_DDE_ADVISE (W M_DDE_FIRST + 2)192 #define WINWM_DDE_UNADVISE (W M_DDE_FIRST + 3)193 #define WINWM_DDE_ACK (W M_DDE_FIRST + 4)194 #define WINWM_DDE_DATA (W M_DDE_FIRST + 5)195 #define WINWM_DDE_REQUEST (W M_DDE_FIRST + 6)196 #define WINWM_DDE_POKE (W M_DDE_FIRST + 7)197 #define WINWM_DDE_EXECUTE (W M_DDE_FIRST + 8)198 #define WINWM_DDE_LAST (W M_DDE_FIRST + 8)202 #define WINWM_DDE_INITIATE (WINWM_DDE_FIRST) 203 #define WINWM_DDE_TERMINATE (WINWM_DDE_FIRST + 1) 204 #define WINWM_DDE_ADVISE (WINWM_DDE_FIRST + 2) 205 #define WINWM_DDE_UNADVISE (WINWM_DDE_FIRST + 3) 206 #define WINWM_DDE_ACK (WINWM_DDE_FIRST + 4) 207 #define WINWM_DDE_DATA (WINWM_DDE_FIRST + 5) 208 #define WINWM_DDE_REQUEST (WINWM_DDE_FIRST + 6) 209 #define WINWM_DDE_POKE (WINWM_DDE_FIRST + 7) 210 #define WINWM_DDE_EXECUTE (WINWM_DDE_FIRST + 8) 211 #define WINWM_DDE_LAST (WINWM_DDE_FIRST + 8) 199 212 #define WINWM_USER 0x0400 200 213 -
trunk/src/user32/pmframe.cpp
r2140 r2200 1 /* $Id: pmframe.cpp,v 1.2 8 1999-12-19 17:46:24 cbratschiExp $ */1 /* $Id: pmframe.cpp,v 1.29 1999-12-24 18:39:10 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 26 26 27 27 #define PMFRAMELOG 28 29 #define GCL_STYLE_W (-26)30 #define CS_VREDRAW_W 0x000131 #define CS_HREDRAW_W 0x000232 28 33 29 //****************************************************************************** -
trunk/src/user32/pmwindow.cpp
r2189 r2200 1 /* $Id: pmwindow.cpp,v 1.6 8 1999-12-22 18:09:31 cbratschiExp $ */1 /* $Id: pmwindow.cpp,v 1.69 1999-12-24 18:39:10 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 17 17 #include <os2wrap.h> 18 18 #include <stdlib.h> 19 #include <string.h> 19 20 #include "win32type.h" 20 21 #include <winconst.h> … … 43 44 ULONG ScreenBitsPerPel = 0; 44 45 45 //Used for key translation while processing WM_CHAR message46 USHORT virtualKeyTable [66] = {47 0x00, // OS/2 VK Win32 VK, Entry 0 is not used48 0x01, // VK_BUTTON1 VK_LBUTTON49 0x02, // VK_BUTTON2 VK_RBUTTON50 0x04, // VK_BUTTON3 VK_MBUTTON51 0x03, // VK_BREAK VK_CANCEL52 0x08, // VK_BACKSPACE VK_BACK53 0x09, // VK_TAB VK_TAB54 0x00, // VK_BACKTAB No equivalent!55 0x0A, // VK_NEWLINE 0x0A (no VK_* def)56 0x10, // VK_SHIFT VK_SHIFT57 0x11, // VK_CTRL VK_CONTROL58 0x12, // VK_ALT VK_MENU, best match I guess59 0x12, // VK_ALTGRAF VK_MENU, best match I guess60 0x13, // VK_PAUSE VK_PAUSE61 0x14, // VK_CAPSLOCK VK_CAPITAL62 0x1B, // VK_ESC VK_ESCAPE63 0x20, // VK_SPACE VK_SPACE64 0x21, // VK_PAGEUP VK_PRIOR65 0x22, // VK_PAGEDOWN VK_NEXT66 0x23, // VK_END VK_END67 0x24, // VK_HOME VK_HOME68 0x25, // VK_LEFT VK_LEFT69 0x26, // VK_UP VK_UP70 0x27, // VK_RIGHT VK_RIGHT71 0x28, // VK_DOWN VK_DOWN72 0x2C, // VK_PRINTSCRN VK_SNAPSHOT73 0x2D, // VK_INSERT VK_INSERT74 0x2E, // VK_DELETE VK_DELETE75 0x91, // VK_SCRLLOCK VK_SCROLL76 0x90, // VK_NUMLOCK VK_NUMLOCK77 0x0D, // VK_ENTER VK_RETURN78 0x00, // VK_SYSRQ No equivalent!79 0x70, // VK_F1 VK_F180 0x71, // VK_F2 VK_F281 0x72, // VK_F3 VK_F382 0x73, // VK_F4 VK_F483 0x74, // VK_F5 VK_F584 0x75, // VK_F6 VK_F685 0x76, // VK_F7 VK_F786 0x77, // VK_F8 VK_F887 0x78, // VK_F9 VK_F988 0x79, // VK_F10 VK_F1089 0x7A, // VK_F11 VK_F1190 0x7B, // VK_F12 VK_F1291 0x7C, // VK_F13 VK_F1392 0x7D, // VK_F14 VK_F1493 0x7E, // VK_F15 VK_F1594 0x7F, // VK_F16 VK_F1695 0x80, // VK_F17 VK_F1796 0x81, // VK_F18 VK_F1897 0x82, // VK_F19 VK_F1998 0x83, // VK_F20 VK_F2099 0x84, // VK_F21 VK_F21100 0x85, // VK_F22 VK_F22101 0x86, // VK_F23 VK_F23102 0x87, // VK_F24 VK_F24103 0x00, // VK_ENDDRAG No equivalent!104 0x0C, // VK_CLEAR VK_CLEAR105 0xF9, // VK_EREOF VK_EREOF106 0xFD, // VK_PA1 VK_PA1107 0xF6, // VK_ATTN VK_ATTN108 0xF7, // VK_CRSEL VK_CRSEL109 0xF8, // VK_EXSEL VK_EXSEL110 0x00, // VK_COPY No equivalent!111 0x00, // VK_BLK1 No equivalent!112 0x00}; // VK_BLK2 No equivalent!113 46 114 47 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); … … 202 135 OSLIBPOINT point, ClientPoint; 203 136 Win32BaseWindow *win32wnd; 137 THDB *thdb; 204 138 APIRET rc; 139 MSG winMsg, *pWinMsg; 205 140 206 141 //Restore our FS selector 207 142 SetWin32TIB(); 208 143 144 thdb = GetThreadTHDB(); 209 145 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 210 146 211 if(msg != WM_CREATE && win32wnd == NULL) { 212 dprintf(("Invalid win32wnd pointer for window %x!!", hwnd)); 213 goto RunDefWndProc; 214 } 147 if(!thdb || (msg != WM_CREATE && win32wnd == NULL)) { 148 dprintf(("Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 149 goto RunDefWndProc; 150 } 151 152 if((thdb->msgstate & 1) == 0) 153 {//message that was sent directly to our window proc handler; translate it here 154 QMSG qmsg; 155 156 qmsg.msg = msg; 157 qmsg.hwnd = hwnd; 158 qmsg.mp1 = mp1; 159 qmsg.mp2 = mp2; 160 qmsg.time = WinQueryMsgTime(thdb->hab); 161 WinQueryMsgPos(thdb->hab, &qmsg.ptl); 162 qmsg.reserved = 0; 163 164 if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, ODINMSG_NOEXTRAMSGS) == FALSE) 165 {//message was not translated 166 memset(&winMsg, 0, sizeof(MSG)); 167 } 168 pWinMsg = &winMsg; 169 } 170 else { 171 pWinMsg = &thdb->msg; 172 thdb->msgstate++; 173 } 174 215 175 if(msg == WIN32APP_POSTMSG && (ULONG)mp1 == WIN32PM_MAGIC) { 216 176 //win32 app user message … … 222 182 case WM_CREATE: 223 183 { 224 THDB *thdb = GetThreadTHDB(); 225 226 if(thdb == NULL || thdb->newWindow == 0) 184 185 if(thdb->newWindow == 0) 227 186 goto createfail; 228 187 … … 230 189 dprintf(("OS2: WM_CREATE %x", hwnd)); 231 190 win32wnd = (Win32BaseWindow *)thdb->newWindow; 191 thdb->newWindow = 0; 232 192 233 193 if(win32wnd->MsgCreate(WinQueryWindow(hwnd, QW_PARENT), hwnd) == FALSE) … … 250 210 case WM_CLOSE: 251 211 dprintf(("OS2: WM_CLOSE %x", hwnd)); 252 // win32wnd->RemoveFakeOpen32();253 212 if(win32wnd->MsgClose()) { 254 213 goto RunDefWndProc; … … 280 239 case WM_ADJUSTWINDOWPOS: 281 240 { 282 PSWP pswp = (PSWP)mp1;283 284 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));241 // PSWP pswp = (PSWP)mp1; 242 243 // dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 285 244 goto RunDefWndProc; 286 245 } … … 341 300 #endif 342 301 343 #if 1344 302 case WM_WINDOWPOSCHANGED: 345 303 { 346 PSWP pswp = (PSWP)mp1; 347 SWP swpOld = *(pswp + 1); 348 WINDOWPOS wp; 349 HWND hParent = NULLHANDLE; 350 LONG yDelta = pswp->cy - swpOld.cy; 351 LONG xDelta = pswp->cx - swpOld.cx; 352 353 dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 354 355 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) goto RunDefWndProc; 356 357 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 358 if (win32wnd->isChild()) { 359 if(win32wnd->getParent()) { 360 hParent = win32wnd->getParent()->getOS2WindowHandle(); 361 } 362 else goto RunDefWndProc; //parent has just been destroyed 363 } 364 } 365 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, win32wnd->getOS2FrameWindowHandle()); 366 367 if (!win32wnd->CanReceiveSizeMsgs()) goto RunDefWndProc; 368 369 dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy)); 370 win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy); 371 372 wp.hwnd = win32wnd->getWindowHandle(); 373 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 374 { 375 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 376 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 377 } 378 379 PRECT lpRect = win32wnd->getWindowRect(); 380 //SvL: Only send it when the client has changed & the frame hasn't 381 // If the frame size/position has changed, pmframe.cpp will send 382 // this message 383 if(lpRect->right == wp.x+wp.cx && lpRect->bottom == wp.y+wp.cy) { 384 win32wnd->MsgPosChanged((LPARAM)&wp); 385 } 386 else win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy); 387 388 goto RunDefWndProc; 389 } 390 #endif 304 win32wnd->MsgPosChanged((LPARAM)&thdb->wp); 305 goto RunDefWndProc; 306 } 391 307 392 308 case WM_ACTIVATE: … … 412 328 } 413 329 414 case WM_SIZE:415 {416 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2)));417 break;418 }419 case WM_MINMAXFRAME:420 {421 dprintf(("OS2: WM_MINMAXFRAME"));422 break;423 }424 case WM_OWNERPOSCHANGE:425 {426 dprintf(("OS2: WM_OWNERPOSCHANGE"));427 goto RunDefWndProc;428 }429 430 case WM_CALCVALIDRECTS:431 {432 dprintf(("OS2: WM_CALCVALIDRECTS"));433 goto RunDefWndProc;434 }435 436 case WM_FOCUSCHANGE:437 dprintf(("OS2: WM_FOCUSCHANGE %x", win32wnd->getWindowHandle()));438 goto RunDefWndProc;439 440 330 case WM_SETFOCUS: 441 331 { … … 464 354 //************************************************************************** 465 355 case WM_BUTTON1DOWN: 466 dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));467 point.x = (*(POINTS *)&mp1).x;468 point.y = (*(POINTS *)&mp1).y;469 ClientPoint.x = point.x;470 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);471 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);472 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {473 goto RunDefWndProc;474 }475 break;476 477 356 case WM_BUTTON1UP: 478 dprintf(("OS2: WM_BUTTON1UP %x", hwnd));479 point.x = (*(POINTS *)&mp1).x;480 point.y = (*(POINTS *)&mp1).y;481 ClientPoint.x = point.x;482 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);483 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);484 if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {485 goto RunDefWndProc;486 }487 break;488 357 case WM_BUTTON1DBLCLK: 489 point.x = (*(POINTS *)&mp1).x;490 point.y = (*(POINTS *)&mp1).y;491 ClientPoint.x = point.x;492 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);493 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);494 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {495 goto RunDefWndProc;496 }497 break;498 358 case WM_BUTTON2DOWN: 499 point.x = (*(POINTS *)&mp1).x;500 point.y = (*(POINTS *)&mp1).y;501 ClientPoint.x = point.x;502 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);503 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);504 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {505 goto RunDefWndProc;506 }507 break;508 359 case WM_BUTTON2UP: 509 point.x = (*(POINTS *)&mp1).x;510 point.y = (*(POINTS *)&mp1).y;511 ClientPoint.x = point.x;512 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);513 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);514 if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {515 goto RunDefWndProc;516 }517 break;518 360 case WM_BUTTON2DBLCLK: 519 point.x = (*(POINTS *)&mp1).x;520 point.y = (*(POINTS *)&mp1).y;521 ClientPoint.x = point.x;522 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);523 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);524 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {525 goto RunDefWndProc;526 }527 break;528 361 case WM_BUTTON3DOWN: 529 point.x = (*(POINTS *)&mp1).x;530 point.y = (*(POINTS *)&mp1).y;531 ClientPoint.x = point.x;532 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);533 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);534 if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {535 goto RunDefWndProc;536 }537 break;538 362 case WM_BUTTON3UP: 539 point.x = (*(POINTS *)&mp1).x;540 point.y = (*(POINTS *)&mp1).y;541 ClientPoint.x = point.x;542 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);543 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);544 if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {545 goto RunDefWndProc;546 }547 break;548 363 case WM_BUTTON3DBLCLK: 549 point.x = (*(POINTS *)&mp1).x; 550 point.y = (*(POINTS *)&mp1).y; 551 ClientPoint.x = point.x; 552 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y); 553 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point); 554 if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) { 364 if(win32wnd->MsgButton(pWinMsg)) { 555 365 goto RunDefWndProc; 556 366 } … … 570 380 case WM_MOUSEMOVE: 571 381 { 572 ULONG keystate = 0;573 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)574 keystate |= WMMOVE_LBUTTON;575 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)576 keystate |= WMMOVE_MBUTTON;577 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)578 keystate |= WMMOVE_RBUTTON;579 if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)580 keystate |= WMMOVE_SHIFT;581 if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)582 keystate |= WMMOVE_CTRL;583 584 382 //OS/2 Window coordinates -> Win32 Window coordinates 585 win32wnd->MsgMouseMove( keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)));383 win32wnd->MsgMouseMove(pWinMsg); 586 384 break; 587 385 } 588 386 589 387 case WM_CONTROL: 590 591 388 case WM_COMMAND: 592 if(SHORT1FROMMP(mp2) == CMDSRC_MENU) { 593 win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0); 594 } 595 if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) { 596 win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0); 597 } 389 dprintf(("OS2: WM_COMMAND %x %x %x", hwnd, mp1, mp2)); 390 win32wnd->DispatchMsg(pWinMsg); 598 391 //todo controls + accelerators 599 392 break; … … 601 394 case WM_SYSCOMMAND: 602 395 { 603 ULONG x = 0, y = 0; 604 ULONG win32sc; 605 606 if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action 607 POINTL pointl; 608 WinQueryPointerPos(HWND_DESKTOP, &pointl); 609 x = pointl.x; 610 y = ScreenHeight - y; 611 } 612 switch(SHORT1FROMMP(mp1)) { 613 case SC_MOVE: 614 win32sc = SC_MOVE_W; 615 break; 616 case SC_CLOSE: 617 win32sc = SC_CLOSE_W; 618 break; 619 case SC_MAXIMIZE: 620 win32sc = SC_MAXIMIZE_W; 621 break; 622 case SC_MINIMIZE: 623 win32sc = SC_MINIMIZE_W; 624 break; 625 case SC_NEXTFRAME: 626 case SC_NEXTWINDOW: 627 win32sc = SC_NEXTWINDOW_W; 628 break; 629 case SC_RESTORE: 630 win32sc = SC_RESTORE_W; 631 break; 632 case SC_TASKMANAGER: 633 win32sc = SC_TASKLIST_W; 634 break; 635 default: 396 if(win32wnd->DispatchMsg(pWinMsg)) { 636 397 goto RunDefWndProc; 637 398 } 638 dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));639 if(win32wnd->MsgSysCommand(win32sc, x, y)) {640 goto RunDefWndProc;641 }642 399 break; 643 400 } 644 401 case WM_CHAR: 645 402 { 646 THDB *thdb; 647 ULONG repeatCount=0, virtualKey=0, keyFlags=0, scanCode=0; 648 ULONG flags = SHORT1FROMMP(mp1); 649 BOOL keyWasPressed, fTranslated = FALSE, fRunDefWndProc = FALSE; 650 651 char c; 652 653 repeatCount = CHAR3FROMMP(mp1); 654 scanCode = CHAR4FROMMP(mp1); 655 keyWasPressed = ((SHORT1FROMMP (mp1) & KC_PREVDOWN) == KC_PREVDOWN); 656 657 dprintf(("PM: WM_CHAR: %x %x %d %x", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), repeatCount, scanCode)); 658 dprintf(("PM: WM_CHAR: %x", flags)); 659 660 // vitali add begin 661 if ( ( SHORT1FROMMP(mp2) & 0x0FF ) == 0x0E0 ) 662 { 663 // an extended key ( arrows, ins, del and so on ) 664 // get "virtual" scancode from character code cause 665 // for "regular" keys they are equal 666 scanCode = ( SHORT1FROMMP(mp2) >> 8) & 0x0FF; 667 } 668 // vitali add end 669 670 // both WM_KEYUP & WM_KEYDOWN want a virtual key, find the right Win32 virtual key 671 // given the OS/2 virtual key and OS/2 character 672 673 //if (((SHORT1FROMMP (mp1) & KC_CHAR) == KC_CHAR) || 674 // ((SHORT1FROMMP (mp1) & KC_LONEKEY) == KC_LONEKEY)) 675 c = 0; 676 if ((SHORT1FROMMP (mp1) & 0xFF) != 0) 677 { 678 c = SHORT1FROMMP (mp2); 679 if ((c >= 'A') && (c <= 'Z')) { 680 virtualKey = c; 681 goto VirtualKeyFound; 682 } 683 if ((c >='a') && (c <= 'z')) { 684 virtualKey = c - 32; // make it uppercase 685 goto VirtualKeyFound; 686 } 687 if ((c >= '0') && (c <= '9')) { 688 virtualKey = c; 689 goto VirtualKeyFound; 690 } 691 } 692 693 // convert OS/2 virtual keys to Win32 virtual key 694 if (SHORT2FROMMP (mp2) <= VK_BLK2) 695 virtualKey = virtualKeyTable [SHORT2FROMMP (mp2)]; 696 697 VirtualKeyFound: 698 dprintf (("VIRTUALKEYFOUND:(%x)", virtualKey)); 699 700 if(!(SHORT1FROMMP(mp1) & KC_ALT)) 701 { 702 // 703 // the Alt key is not pressed 704 // 705 if ((flags & KC_KEYUP) == KC_KEYUP) { 706 // send WM_KEYUP message 707 708 if(win32wnd->MsgKeyUp (repeatCount, scanCode, virtualKey)) { 709 fRunDefWndProc = TRUE; 710 } 711 } 712 else { 713 // send WM_KEYDOWN message 714 if (win32wnd->MsgKeyDown (repeatCount, scanCode, 715 virtualKey, keyWasPressed)) 716 fRunDefWndProc = TRUE; 717 } 718 } 719 else { 720 // 721 // the Alt key is pressed 722 // 723 if ((flags & KC_KEYUP) == KC_KEYUP) { 724 // send WM_SYSKEYUP message 725 726 dprintf(("PMWINDOW_WM_SYSKEYUP: vkey:(%x)", virtualKey)); 727 if(win32wnd->MsgSysKeyUp (repeatCount, scanCode, virtualKey)) { 728 fRunDefWndProc = TRUE; 729 } 730 } 731 else { 732 // send WM_SYSKEYDOWN message 733 dprintf(("PMWINDOW_WM_SYSKEYDOWN: vkey:(%x)", virtualKey)); 734 if (win32wnd->MsgSysKeyDown (repeatCount, scanCode, virtualKey, keyWasPressed)) 735 fRunDefWndProc = TRUE; 736 } 737 } 738 739 thdb = GetThreadTHDB(); 740 if(thdb) { 741 fTranslated = thdb->fMsgTranslated; 742 thdb->fMsgTranslated = FALSE; //reset flag 743 } 744 //NOTE: These actually need to be posted so that the next message retrieved by GetMessage contains 745 // the newly generated WM_CHAR message. 746 if(fTranslated && !((flags & KC_KEYUP) == KC_KEYUP)) 747 {//TranslatedMessage was called before DispatchMessage, so send WM_CHAR messages 748 ULONG keyflags = 0, vkey = 0; 749 ULONG fl = SHORT1FROMMP(mp1); 750 ULONG chCode = SHORT1FROMMP(mp2); 751 752 if(!(fl & KC_CHAR)) { 753 //SvL: Test 754 break; 755 // goto RunDefWndProc; 756 } 757 if(fl & KC_VIRTUALKEY) { 758 if(virtualKey) 759 vkey = virtualKey; 760 else vkey = SHORT2FROMMP(mp2); 761 chCode = vkey; 762 } 763 if(fl & KC_KEYUP) { 764 keyflags |= KEY_UP; 765 } 766 if(fl & KC_ALT) { 767 keyflags |= KEY_ALTDOWN; 768 } 769 if(fl & KC_PREVDOWN) { 770 keyflags |= KEY_PREVDOWN; 771 } 772 if(fl & KC_DEADKEY) { 773 keyflags |= KEY_DEADKEY; 774 } 775 if(win32wnd->MsgChar(chCode, CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), virtualKey, keyflags)) { 776 //SvL: Test 777 // goto RunDefWndProc; 778 779 } 780 } 781 //SvL: Test 782 // if(fRunDefWndProc) goto RunDefWndProc; 403 win32wnd->DispatchMsg(pWinMsg); 783 404 break; 784 405 } 785 406 786 407 case WM_INITMENU: 787 win32wnd->MsgInitMenu((HWND)mp2); 788 break; 408 win32wnd->MsgInitMenu(pWinMsg); 409 break; 410 411 case WM_TIMER: 412 win32wnd->DispatchMsg(pWinMsg); 413 goto RunDefWndProc; 789 414 790 415 case WM_MENUSELECT: 791 416 case WM_MENUEND: 792 417 case WM_NEXTMENU: 793 goto RunDefWndProc;794 795 case WM_TIMER:796 if (mp2)797 {798 BOOL sys;799 ULONG id;800 801 dprintf(("OS2: WM_TIMER %x %d", hwnd, mp1));802 if (TIMER_GetTimerInfo(hwnd,(ULONG)mp1,&sys,&id))803 {804 if (sys)805 win32wnd->MsgSysTimer(id);806 else807 win32wnd->MsgTimer(id);808 }809 }810 418 goto RunDefWndProc; 811 419 … … 845 453 } 846 454 847 case WM_ERASEBACKGROUND:848 {849 dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));850 #if 1851 break;852 #else853 854 if (WinQueryUpdateRect (hwnd, NULL) && !win32wnd->isSupressErase()) {855 BOOL erased = sendEraseBkgnd (win32wnd);856 win32wnd->setEraseBkgnd (!erased, !erased);857 }858 859 break;860 #endif861 }862 863 455 case WM_PAINT: 864 { 865 dprintf(("OS2: WM_PAINT %x", hwnd)); 866 867 #if 0 868 if (WinQueryUpdateRect (hwnd, NULL)) { 869 if (!win32wnd->isSupressErase() && win32wnd->isEraseBkgnd()) { 870 BOOL erased = sendEraseBkgnd (win32wnd); 871 win32wnd->setEraseBkgnd (!erased, !erased); 872 } 873 } 874 875 win32wnd->setSupressErase (FALSE); 876 #endif 877 878 win32wnd->MsgPaint(0, 0); 879 880 //validate the update region, WM_PAINT has no return value 881 goto RunDefWndProc; 882 } 456 win32wnd->DispatchMsg(pWinMsg); 457 goto RunDefWndProc; 883 458 884 459 case WM_HITTEST: 885 // Only send this message if the window is enabled 886 if (WinIsWindowEnabled(hwnd)) 887 { 888 OSLIBPOINT pt; 889 dprintf(("USER32: WM_HITTEST (%d,%d)",(*(POINTS *)&mp1).x,(*(POINTS *)&mp1).y)); 890 pt.x = (*(POINTS *)&mp1).x; 891 pt.y = (*(POINTS *)&mp1).y; 892 MapOS2ToWin32Point( OSLIB_HWND_DESKTOP, hwnd, &pt); 893 if(win32wnd->MsgHitTest(pt.x, pt.y)) 460 // Only send this message if the window is enabled 461 if (WinIsWindowEnabled(hwnd)) 894 462 { 895 goto RunDefWndProc; 896 } 897 } else goto RunDefWndProc; 898 break; 463 if(win32wnd->MsgHitTest(pWinMsg)) { 464 goto RunDefWndProc; 465 } 466 } 467 else goto RunDefWndProc; 899 468 900 469 case WM_CONTEXTMENU: 901 { 902 POINTL pt; 903 904 dprintf(("OS2: WM_CONTEXTMENU %x", hwnd)); 905 pt.x = (*(POINTS *)&mp1).x; 906 pt.y = (*(POINTS *)&mp1).y; 907 WinMapWindowPoints(hwnd,HWND_DESKTOP,&pt,1); 908 pt.y = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN)-pt.y-1; 909 win32wnd->MsgContextMenu(pt.x,pt.y); 470 { 471 win32wnd->DispatchMsg(pWinMsg); 910 472 911 473 RestoreOS2TIB(); 912 474 return (MRESULT)TRUE; 913 } 475 } 476 477 case WM_ERASEBACKGROUND: 478 { 479 dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle())); 480 break; 481 } 482 483 case WM_SIZE: 484 { 485 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2))); 486 break; 487 } 488 case WM_MINMAXFRAME: 489 { 490 dprintf(("OS2: WM_MINMAXFRAME")); 491 break; 492 } 493 case WM_OWNERPOSCHANGE: 494 { 495 dprintf(("OS2: WM_OWNERPOSCHANGE")); 496 goto RunDefWndProc; 497 } 498 499 case WM_CALCVALIDRECTS: 500 { 501 dprintf(("OS2: WM_CALCVALIDRECTS")); 502 goto RunDefWndProc; 503 } 504 505 case WM_FOCUSCHANGE: 506 dprintf(("OS2: WM_FOCUSCHANGE %x", win32wnd->getWindowHandle())); 507 goto RunDefWndProc; 914 508 915 509 case WM_SYSCOLORCHANGE: … … 934 528 case WM_SEMANTICEVENT: 935 529 default: 936 //dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));530 //dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 937 531 RestoreOS2TIB(); 938 532 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); -
trunk/src/user32/user32.cpp
r2160 r2200 1 /* $Id: user32.cpp,v 1.6 2 1999-12-20 16:45:17 cbratschiExp $ */1 /* $Id: user32.cpp,v 1.63 1999-12-24 18:39:11 sandervl Exp $ */ 2 2 3 3 /* … … 129 129 BOOL WIN32API InflateRect( PRECT lprc, int dx, int dy) 130 130 { 131 dprintf (("USER32: InflateRect\n"));131 dprintf2(("USER32: InflateRect\n")); 132 132 if (!lprc) 133 133 { … … 1622 1622 //****************************************************************************** 1623 1623 /***************************************************************************** 1624 * Name : int WIN32API GetWindowRgn1625 * Purpose : The GetWindowRgn function obtains a copy of the window region of a window.1626 * Parameters: HWND hWnd handle to window whose window region is to be obtained1627 * HRGN hRgn handle to region that receives a copy of the window region1628 * Variables :1629 * Result : NULLREGION, SIMPLEREGION, COMPLEXREGION, ERROR1630 * Remark :1631 * Status : UNTESTED STUB1632 *1633 * Author : Patrick Haller [Thu, 1998/02/26 11:55]1634 *****************************************************************************/1635 1636 int WIN32API GetWindowRgn (HWND hWnd,1637 HRGN hRgn)1638 {1639 dprintf(("USER32:GetWindowRgn (%08xh,%08x) not implemented.\n",1640 hWnd,1641 hRgn));1642 //Attention: Win32 hwnd handle!1643 1644 return (NULLREGION);1645 }1646 //******************************************************************************1647 //******************************************************************************1648 #if 01649 BOOL WIN32API InvalidateRgn( HWND hWnd, HRGN hRgn, BOOL bErase)1650 {1651 #ifdef DEBUG1652 WriteLog("USER32: InvalidateRgn\n");1653 #endif1654 hWnd = Win32Window::Win32ToOS2Handle(hWnd);1655 1656 return O32_InvalidateRgn(hWnd,hRgn,bErase);1657 }1658 #endif1659 /*****************************************************************************1660 1624 * Name : BOOL WIN32API PaintDesktop 1661 1625 * Purpose : The PaintDesktop function fills the clipping region in the … … 1678 1642 return (FALSE); 1679 1643 } 1680 /*****************************************************************************1681 * Name : int WIN32API SetWindowRgn1682 * Purpose : The SetWindowRgn function sets the window region of a window. The1683 * window region determines the area within the window where the1684 * operating system permits drawing. The operating system does not1685 * display any portion of a window that lies outside of the window region1686 * Parameters: HWND hWnd handle to window whose window region is to be set1687 * HRGN hRgn handle to region1688 * BOOL bRedraw window redraw flag1689 * Variables :1690 * Result : If the function succeeds, the return value is non-zero.1691 * If the function fails, the return value is zero.1692 * Remark :1693 * Status : UNTESTED STUB1694 *1695 * Author : Patrick Haller [Thu, 1998/02/26 11:55]1696 *****************************************************************************/1697 1698 int WIN32API SetWindowRgn(HWND hWnd,1699 HRGN hRgn,1700 BOOL bRedraw)1701 {1702 dprintf(("USER32:SetWindowRgn (%08xh,%08xh,%u) not implemented.\n",1703 hWnd,1704 hRgn,1705 bRedraw));1706 //Attention: Win32 hwnd handle!1707 1708 return (0);1709 }1710 //******************************************************************************1711 //******************************************************************************1712 BOOL WIN32API ValidateRect( HWND hwnd, const RECT * lprc)1713 {1714 #ifdef DEBUG1715 WriteLog("USER32: ValidateRect\n");1716 #endif1717 hwnd = Win32Window::Win32ToOS2Handle(hwnd);1718 1719 return O32_ValidateRect(hwnd,lprc);1720 }1721 //******************************************************************************1722 //******************************************************************************1723 BOOL WIN32API ValidateRgn( HWND hwnd, HRGN hrgn)1724 {1725 #ifdef DEBUG1726 WriteLog("USER32: ValidateRgn\n");1727 #endif1728 hwnd = Win32Window::Win32ToOS2Handle(hwnd);1729 1730 return O32_ValidateRgn(hwnd,hrgn);1731 }1732 1644 1733 1645 /* Filled Shape Functions */ … … 1769 1681 return O32_GetKeyboardType(nTypeFlag); 1770 1682 } 1683 1684 /* Message and Message Queue Functions */ 1685 1686 1687 /* Device Context Functions */ 1688 1689 1690 /* Window Station and Desktop Functions */ 1771 1691 /***************************************************************************** 1772 1692 * Name : HDESK WIN32API GetThreadDesktop … … 1789 1709 return (NULL); 1790 1710 } 1791 1792 /* Message and Message Queue Functions */1793 1794 1795 /* Device Context Functions */1796 1797 1798 /* Window Station and Desktop Functions */1799 1711 1800 1712 /***************************************************************************** -
trunk/src/user32/win32dlg.cpp
r2084 r2200 1 /* $Id: win32dlg.cpp,v 1.3 7 1999-12-16 00:11:46sandervl Exp $ */1 /* $Id: win32dlg.cpp,v 1.38 1999-12-24 18:39:11 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 293 293 while (TRUE) 294 294 { 295 if (!OSLibWinPeekMsg(&msg,0,0,0, MSG_NOREMOVE))295 if (!OSLibWinPeekMsg(&msg,0,0,0,PM_NOREMOVE)) 296 296 { 297 297 if(!(getStyle() & DS_NOIDLEMSG)) … … 299 299 OSLibWinGetMsg(&msg,0,0,0); 300 300 } 301 else OSLibWinPeekMsg(&msg,0,0,0, MSG_REMOVE);301 else OSLibWinPeekMsg(&msg,0,0,0,PM_REMOVE); 302 302 303 303 if(msg.message == WM_QUIT) … … 319 319 // MSG_REMOVE, !(getStyle() & DS_NOIDLEMSG), NULL )) 320 320 // if(OSLibWinPeekMsg(&msg, topOwner->getOS2FrameWindowHandle(), 0, 0, MSG_REMOVE)) 321 if(OSLibWinPeekMsg(&msg, 0, 0, 0, MSG_REMOVE))321 if(OSLibWinPeekMsg(&msg, 0, 0, 0, PM_REMOVE)) 322 322 { 323 323 if(msg.message == WM_QUIT) { -
trunk/src/user32/win32wbase.cpp
r2145 r2200 1 /* $Id: win32wbase.cpp,v 1.11 6 1999-12-19 19:55:41sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.117 1999-12-24 18:39:12 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 778 778 { 779 779 if(SendInternalMessageA(WM_CLOSE, 0, 0) == 0) { 780 dprintf(("Win32BaseWindow::MsgClose, app handles msg"));780 dprintf(("Win32BaseWindow::MsgClose, app handles msg")); 781 781 return 0; //app handles this message 782 782 } … … 872 872 //****************************************************************************** 873 873 //****************************************************************************** 874 ULONG Win32BaseWindow::MsgMove(ULONG x, ULONG y)875 {876 dprintf(("MsgMove to (%d,%d)", x, y));877 if(fNoSizeMsg || (getParent() && getParent()->InMovingChildren()))878 return 1;879 880 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y));881 }882 //******************************************************************************883 //******************************************************************************884 874 #if 0 885 875 ULONG Win32BaseWindow::MsgMinMax() … … 888 878 } 889 879 #endif 890 //******************************************************************************891 //******************************************************************************892 ULONG Win32BaseWindow::MsgTimer(ULONG TimerID)893 {894 // TODO: call TIMERPROC if not NULL895 return SendInternalMessageA(WM_TIMER, TimerID, 0);896 }897 //******************************************************************************898 //******************************************************************************899 ULONG Win32BaseWindow::MsgSysTimer(ULONG TimerID)900 {901 // TODO: call TIMERPROC if not NULL902 return SendInternalMessageA(WM_SYSTIMER, TimerID, 0);903 }904 880 //****************************************************************************** 905 881 //****************************************************************************** … … 912 888 //****************************************************************************** 913 889 //****************************************************************************** 914 ULONG Win32BaseWindow::MsgCommand(ULONG cmd, ULONG Id, HWND hwnd) 915 { 916 switch(cmd) { 917 case CMD_MENU: 918 return SendInternalMessageA(WM_COMMAND, MAKELONG(Id, 0), 0); 919 case CMD_CONTROL: 920 return 0; //todo 921 case CMD_ACCELERATOR: 922 // this fit not really windows behavior. 923 // maybe TranslateAccelerator() is better 924 dprintf(("accelerator command")); 925 return SendInternalMessageA(WM_COMMAND, MAKELONG(Id, 0), 0); 926 } 927 return 0; 928 } 929 //****************************************************************************** 930 //****************************************************************************** 931 ULONG Win32BaseWindow::MsgHitTest(ULONG x, ULONG y) 932 { 933 lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y)); 934 dprintf(("MsgHitTest returned %x", lastHitTestVal)); 890 ULONG Win32BaseWindow::MsgHitTest(MSG *msg) 891 { 892 lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)msg->pt.x, (USHORT)msg->pt.y)); 893 dprintf2(("MsgHitTest returned %x", lastHitTestVal)); 935 894 return 1; //TODO: May need to change this 936 }937 //******************************************************************************938 //TODO: Send WM_NCCALCSIZE message here and correct size if necessary939 //******************************************************************************940 ULONG Win32BaseWindow::MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize)941 {942 WORD fwSizeType = 0;943 944 dwStyle &= ~(WS_MINIMIZE|WS_MAXIMIZE);945 if(fMinimize) {946 fwSizeType = SIZE_MINIMIZED;947 dwStyle |= WS_MINIMIZE;948 }949 else950 if(fMaximize) {951 fwSizeType = SIZE_MAXIMIZED;952 dwStyle |= WS_MAXIMIZE;953 }954 else fwSizeType = SIZE_RESTORED;955 956 return SendInternalMessageA(WM_SIZE, fwSizeType, MAKELONG((USHORT)width, (USHORT)height));957 895 } 958 896 //****************************************************************************** … … 981 919 } 982 920 return rc; 983 }984 //******************************************************************************985 //******************************************************************************986 ULONG Win32BaseWindow::MsgSysCommand(ULONG win32sc, ULONG x, ULONG y)987 {988 return SendInternalMessageA(WM_SYSCOMMAND, win32sc, MAKELONG((USHORT)x, (USHORT)y));989 921 } 990 922 //****************************************************************************** … … 1011 943 } 1012 944 //****************************************************************************** 1013 //TODO: virtual key & (possibly) scancode translation, extended keyboard bit & Unicode 1014 //****************************************************************************** 1015 ULONG Win32BaseWindow::MsgChar(ULONG cmd, ULONG repeatcnt, ULONG scancode, ULONG vkey, ULONG keyflags) 1016 { 1017 ULONG lParam = 0; 1018 1019 lParam = repeatcnt; 1020 lParam |= (scancode << 16); 1021 setExtendedKey(vkey, &lParam); 1022 1023 if(keyflags & KEY_ALTDOWN) 1024 lParam |= (1<<29); 1025 if(keyflags & KEY_PREVDOWN) 1026 lParam |= (1<<30); 1027 if(keyflags & KEY_UP) 1028 lParam |= (1<<31); 1029 if(keyflags & KEY_DEADKEY) { 1030 dprintf(("WM_DEADCHAR: %x %x %08x", OS2Hwnd, cmd, lParam)); 1031 return SendInternalMessageA(WM_DEADCHAR, cmd, lParam); 1032 } 1033 else { 1034 dprintf(("WM_CHAR: %x %x %08x", OS2Hwnd, cmd, lParam)); 1035 return SendInternalMessageA(WM_CHAR, cmd, lParam); 1036 } 1037 } 1038 //****************************************************************************** 1039 //****************************************************************************** 1040 ULONG Win32BaseWindow::MsgKeyUp (ULONG repeatCount, ULONG scancode, ULONG virtualKey) 1041 { 1042 ULONG lParam=0; 1043 1044 lParam = repeatCount & 0x0FFFF; // bit 0-15, repeatcount 1045 lParam |= (scancode & 0x0FF) << 16; // bit 16-23, scancode 1046 // bit 24, 1=extended key 1047 // bit 25-28, reserved 1048 lParam |= 0 << 29; // bit 29, key is released, always 0 for WM_KEYUP ?? <- conflict according to the MS docs 1049 lParam |= 1 << 30; // bit 30, previous state, always 1 for a WM_KEYUP message 1050 lParam |= 1 << 31; // bit 31, transition state, always 1 for WM_KEYUP 1051 1052 dprintf(("WM_KEYUP: vkey:(%x) param:(%x)", virtualKey, lParam)); 1053 1054 setExtendedKey(virtualKey, &lParam); 1055 return SendInternalMessageA (WM_KEYUP, virtualKey, lParam); 1056 } 1057 //****************************************************************************** 1058 //****************************************************************************** 1059 ULONG Win32BaseWindow::MsgKeyDown (ULONG repeatCount, ULONG scancode, ULONG virtualKey, BOOL keyWasPressed) 1060 { 1061 ULONG lParam=0; 1062 1063 lParam = repeatCount & 0x0FFFF; // bit 0-15, repeatcount 1064 lParam |= (scancode & 0x0FF) << 16; // bit 16-23, scancode 1065 // bit 24, 1=extended key 1066 // bit 25-28, reserved 1067 // bit 29, key is pressed, always 0 for WM_KEYDOWN ?? <- conflict according to the MS docs 1068 if (keyWasPressed) 1069 lParam |= 1 << 30; // bit 30, previous state, 1 means key was pressed 1070 // bit 31, transition state, always 0 for WM_KEYDOWN 1071 1072 setExtendedKey(virtualKey, &lParam); 1073 1074 dprintf(("WM_KEYDOWN: vkey:(%x) param:(%x)", virtualKey, lParam)); 1075 1076 return SendInternalMessageA (WM_KEYDOWN, virtualKey, lParam); 1077 } 1078 //****************************************************************************** 1079 //****************************************************************************** 1080 ULONG Win32BaseWindow::MsgSysKeyUp (ULONG repeatCount, ULONG scancode, ULONG virtualKey) 1081 { 1082 ULONG lParam=0; 1083 1084 lParam = repeatCount & 0x0FFFF; // bit 0-15,repeatcount 1085 lParam |= (scancode & 0x0FF) << 16; // bit 16-23, scancode 1086 // bit 24, 1=extended key 1087 // bit 25-28, reserved 1088 lParam |= 0 << 29; // bit 29, key is released, always 1 for WM_SYSKEYUP ?? <- conflict according to the MS docs 1089 lParam |= 1 << 30; // bit 30, previous state, always 1 for a WM_KEYUP message 1090 lParam |= 1 << 31; // bit 31, transition state, always 1 for WM_KEYUP 1091 1092 setExtendedKey(virtualKey, &lParam); 1093 dprintf(("WM_SYSKEYUP: vkey:(%x) param:(%x)", virtualKey, lParam)); 1094 1095 return SendInternalMessageA (WM_SYSKEYUP, virtualKey, lParam); 1096 } 1097 //****************************************************************************** 1098 //****************************************************************************** 1099 ULONG Win32BaseWindow::MsgSysKeyDown (ULONG repeatCount, ULONG scancode, ULONG virtualKey, BOOL keyWasPressed) 1100 { 1101 ULONG lParam=0; 1102 1103 lParam = repeatCount & 0x0FFFF; // bit 0-15, repeatcount 1104 lParam |= (scancode & 0x0FF) << 16; // bit 16-23, scancode 1105 // bit 24, 1=extended key 1106 // bit 25-28, reserved 1107 // bit 29, key is released, always 1 for WM_SYSKEYUP ?? <- conflict according to the MS docs 1108 if (keyWasPressed) 1109 lParam |= 1 << 30; // bit 30, previous state, 1 means key was pressed 1110 // bit 31, transition state, always 0 for WM_KEYDOWN 1111 1112 setExtendedKey(virtualKey, &lParam); 1113 dprintf(("WM_SYSKEYDOWN: vkey:(%x) param:(%x)", virtualKey, lParam)); 1114 1115 return SendInternalMessageA (WM_SYSKEYDOWN, virtualKey, lParam); 945 //****************************************************************************** 946 ULONG Win32BaseWindow::DispatchMsg(MSG *msg) 947 { 948 return SendInternalMessageA(msg->message, msg->wParam, msg->lParam); 1116 949 } 1117 950 //****************************************************************************** … … 1129 962 //****************************************************************************** 1130 963 //****************************************************************************** 1131 ULONG Win32BaseWindow::MsgButton(ULONG msg, ULONG ncx, ULONG ncy, ULONG clx, ULONG cly) 1132 { 1133 ULONG win32msg; 1134 ULONG win32ncmsg; 964 ULONG Win32BaseWindow::MsgButton(MSG *msg) 965 { 1135 966 BOOL fClick = FALSE; 1136 967 1137 if(ISMOUSE_CAPTURED()) { 1138 if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_BUTTON, ncx, ncy, msg)) 1139 return 0; 1140 } 1141 1142 dprintf(("MsgButton to (%d,%d)", ncx, ncy)); 1143 switch(msg) { 1144 case BUTTON_LEFTDOWN: 1145 win32msg = WM_LBUTTONDOWN; 1146 win32ncmsg = WM_NCLBUTTONDOWN; 968 dprintf(("MsgButton at (%d,%d)", msg->pt.x, msg->pt.y)); 969 switch(msg->message) { //TODO: double click also? 970 case WM_LBUTTONDBLCLK: 971 case WM_RBUTTONDBLCLK: 972 case WM_MBUTTONDBLCLK: 973 if (!(windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)) 974 { 975 msg->message = msg->message - (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); //dblclick -> down 976 MsgButton(msg); 977 return MsgButton(msg); 978 } 979 break; 980 case WM_LBUTTONDOWN: 981 case WM_RBUTTONDOWN: 982 case WM_MBUTTONDOWN: 1147 983 fClick = TRUE; 1148 984 break; 1149 case BUTTON_LEFTUP: 1150 win32msg = WM_LBUTTONUP; 1151 win32ncmsg = WM_NCLBUTTONUP; 1152 break; 1153 case BUTTON_LEFTDBLCLICK: 1154 if (windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS) 1155 { 1156 win32msg = WM_LBUTTONDBLCLK; 1157 win32ncmsg = WM_NCLBUTTONDBLCLK; 1158 } else 1159 { 1160 MsgButton(BUTTON_LEFTDOWN,ncx,ncy,clx,cly); 1161 return MsgButton(BUTTON_LEFTUP,ncx,ncy,clx,cly); 1162 } 1163 break; 1164 case BUTTON_RIGHTUP: 1165 win32msg = WM_RBUTTONUP; 1166 win32ncmsg = WM_NCRBUTTONUP; 1167 break; 1168 case BUTTON_RIGHTDOWN: 1169 win32msg = WM_RBUTTONDOWN; 1170 win32ncmsg = WM_NCRBUTTONDOWN; 1171 fClick = TRUE; 1172 break; 1173 case BUTTON_RIGHTDBLCLICK: 1174 if (windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS) 1175 { 1176 win32msg = WM_RBUTTONDBLCLK; 1177 win32ncmsg = WM_NCRBUTTONDBLCLK; 1178 } else 1179 { 1180 MsgButton(BUTTON_RIGHTDOWN,ncx,ncy,clx,cly); 1181 return MsgButton(BUTTON_RIGHTUP,ncx,ncy,clx,cly); 1182 } 1183 break; 1184 case BUTTON_MIDDLEUP: 1185 win32msg = WM_MBUTTONUP; 1186 win32ncmsg = WM_NCMBUTTONUP; 1187 break; 1188 case BUTTON_MIDDLEDOWN: 1189 win32msg = WM_MBUTTONDOWN; 1190 win32ncmsg = WM_NCMBUTTONDOWN; 1191 fClick = TRUE; 1192 break; 1193 case BUTTON_MIDDLEDBLCLICK: 1194 if (windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS) 1195 { 1196 win32msg = WM_MBUTTONDBLCLK; 1197 win32ncmsg = WM_NCMBUTTONDBLCLK; 1198 } else 1199 { 1200 MsgButton(BUTTON_MIDDLEDOWN,ncx,ncy,clx,cly); 1201 return MsgButton(BUTTON_MIDDLEUP,ncx,ncy,clx,cly); 1202 } 1203 break; 1204 default: 1205 dprintf(("Win32BaseWindow::Button: invalid msg!!!!")); 1206 return 1; 985 } 986 987 if(ISMOUSE_CAPTURED()) 988 { 989 if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_BUTTON, msg->pt.x, msg->pt.y)) 990 return 0; 1207 991 } 1208 992 … … 1224 1008 { 1225 1009 LONG ret = SendInternalMessageA(WM_MOUSEACTIVATE, hwndTop, 1226 MAKELONG( HTCLIENT, win32msg) );1010 MAKELONG( HTCLIENT, msg->message) ); 1227 1011 1228 1012 #if 0 … … 1238 1022 } 1239 1023 1240 SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, win32ncmsg)); 1241 1242 //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window 1243 if(lastHitTestVal != HTCLIENT) { 1244 return SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(ncx, ncy)); //TODO: 1245 } 1246 return SendInternalMessageA(win32msg, 0, MAKELONG(clx, cly)); 1247 } 1248 //****************************************************************************** 1249 //****************************************************************************** 1250 ULONG Win32BaseWindow::MsgMouseMove(ULONG keystate, ULONG x, ULONG y) 1251 { 1252 ULONG winstate = 0; 1253 ULONG setcursormsg = WM_MOUSEMOVE; 1254 1255 if(ISMOUSE_CAPTURED()) { 1256 POINT point = {x,y}; 1257 1258 MapWindowPoints(getWindowHandle(), HWND_DESKTOP, &point, 1); 1259 if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_MOVE, point.x, point.y, keystate)) 1260 return 0; 1261 } 1262 1263 if(keystate & WMMOVE_LBUTTON) 1264 winstate |= MK_LBUTTON; 1265 if(keystate & WMMOVE_RBUTTON) 1266 winstate |= MK_RBUTTON; 1267 if(keystate & WMMOVE_MBUTTON) 1268 winstate |= MK_MBUTTON; 1269 if(keystate & WMMOVE_SHIFT) 1270 winstate |= MK_SHIFT; 1271 if(keystate & WMMOVE_CTRL) 1272 winstate |= MK_CONTROL; 1273 1274 if(lastHitTestVal != HTCLIENT) { 1275 setcursormsg = WM_NCMOUSEMOVE; 1276 } 1277 //TODO: hiword should be 0 if window enters menu mode (SDK docs) 1278 SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, setcursormsg)); 1279 1280 //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window 1281 if(lastHitTestVal != HTCLIENT) { 1282 SendInternalMessageA(WM_NCMOUSEMOVE, lastHitTestVal, MAKELONG(x, y)); 1283 } 1284 return SendInternalMessageA(WM_MOUSEMOVE, winstate, MAKELONG(x, y)); 1285 } 1286 //****************************************************************************** 1287 //TODO: Depending on menu type, we should send WM_INITMENU or WM_INITPOPUPMENU 1288 //TODO: PM sends it for each submenu that gets activated; Windows only for the first 1289 // submenu; once the menu bar is active, moving the cursor doesn't generate other 1290 // WM_INITMENU msgs. Not really a problem, but might need to fix this later on. 1291 //****************************************************************************** 1292 void Win32BaseWindow::MsgInitMenu(HWND hMenu) 1293 { 1294 SendInternalMessageA(WM_INITMENU, (WPARAM)hMenu, 0); 1024 SendInternalMessageA(WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message)); 1025 1026 return SendInternalMessageA(msg->message, msg->wParam, msg->lParam); 1295 1027 } 1296 1028 //****************************************************************************** … … 1322 1054 O32_ReleaseDC(OS2Hwnd, hdcErase); 1323 1055 return (rc); 1056 } 1057 //****************************************************************************** 1058 //****************************************************************************** 1059 ULONG Win32BaseWindow::MsgMouseMove(MSG *msg) 1060 { 1061 if(ISMOUSE_CAPTURED()) { 1062 if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_MOVE, msg->pt.x, msg->pt.y)) 1063 return 0; 1064 } 1065 1066 //TODO: hiword should be 0 if window enters menu mode (SDK docs) 1067 SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message)); 1068 1069 //translated message == WM_(NC)MOUSEMOVE 1070 return SendInternalMessageA(msg->message, msg->wParam, msg->lParam); 1071 } 1072 //****************************************************************************** 1073 //TODO: Depending on menu type, we should send WM_INITMENU or WM_INITPOPUPMENU 1074 //TODO: PM sends it for each submenu that gets activated; Windows only for the first 1075 // submenu; once the menu bar is active, moving the cursor doesn't generate other 1076 // WM_INITMENU msgs. Not really a problem, but might need to fix this later on. 1077 //****************************************************************************** 1078 ULONG Win32BaseWindow::MsgInitMenu(MSG *msg) 1079 { 1080 return SendInternalMessageA(msg->message, msg->wParam, msg->lParam); 1081 } 1082 //****************************************************************************** 1083 //****************************************************************************** 1084 ULONG Win32BaseWindow::MsgNCPaint() 1085 { 1086 return SendInternalMessageA(WM_PAINT, 0, 0); 1324 1087 } 1325 1088 //****************************************************************************** … … 1604 1367 { 1605 1368 case WM_CLOSE: 1369 dprintf(("DefWindowProcA: WM_CLOSE %x", getWindowHandle())); 1606 1370 DestroyWindow(); 1607 1371 return 0; -
trunk/src/user32/win32wbase.h
r2140 r2200 1 /* $Id: win32wbase.h,v 1.5 5 1999-12-19 17:46:26 cbratschiExp $ */1 /* $Id: win32wbase.h,v 1.56 1999-12-24 18:39:12 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 71 71 ULONG MsgPosChanging(LPARAM lp); 72 72 ULONG MsgPosChanged(LPARAM lp); 73 ULONG MsgMove(ULONG x, ULONG y);74 ULONG MsgHitTest(ULONG x, ULONG y);75 ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);76 73 virtual ULONG MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd); 77 74 ULONG MsgSetFocus(HWND hwnd); 78 75 ULONG MsgKillFocus(HWND hwnd); 79 ULONG MsgTimer(ULONG TimerID);80 ULONG MsgSysTimer(ULONG TimerID);81 76 ULONG MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos); 82 ULONG MsgCommand(ULONG cmd, ULONG Id, HWND hwnd); 83 ULONG MsgSysCommand(ULONG win32sc, ULONG x, ULONG y); 84 ULONG MsgChar(ULONG cmd, ULONG repeatcnt, ULONG scancode, ULONG vkey, ULONG keyflags); 85 ULONG MsgKeyUp (ULONG repeatCount, ULONG scancode, ULONG virtualKey); 86 ULONG MsgKeyDown (ULONG repeatCount, ULONG scancode, ULONG virtualKey, BOOL keyWasPressed); 87 ULONG MsgSysKeyUp (ULONG repeatCount, ULONG scancode, ULONG virtualKey); 88 ULONG MsgSysKeyDown (ULONG repeatCount, ULONG scancode, ULONG virtualKey, BOOL keyWasPressed); 89 ULONG MsgButton(ULONG msg, ULONG ncx, ULONG ncy, ULONG clx, ULONG cly); 90 ULONG MsgMouseMove(ULONG keystate, ULONG x, ULONG y); 77 ULONG MsgButton(MSG *msg); 78 ULONG MsgMouseMove(MSG *msg); 91 79 ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE); 92 80 ULONG MsgEraseBackGround(HDC hdc); 81 ULONG MsgInitMenu(MSG *msg); 82 ULONG MsgHitTest(MSG *msg); 83 ULONG MsgNCPaint(); 84 ULONG DispatchMsg(MSG *msg); 85 93 86 ULONG MsgSetText(LPSTR lpsz, LONG cch); 94 87 ULONG MsgGetTextLength(); 95 88 char *MsgGetText(); 96 89 ULONG MsgContextMenu(ULONG x,ULONG y); 97 void MsgInitMenu(HWND hMenu);98 90 VOID updateWindowStyle(DWORD oldExStyle,DWORD oldStyle); 99 91 … … 366 358 else return SendInternalMessageA(msg, wParam, lParam); 367 359 } 360 #else 361 friend BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fTranslateExtraMsgs); 368 362 #endif 369 363 … … 394 388 }; 395 389 396 397 #define BUTTON_LEFTDOWN 0398 #define BUTTON_LEFTUP 1399 #define BUTTON_LEFTDBLCLICK 2400 #define BUTTON_RIGHTUP 3401 #define BUTTON_RIGHTDOWN 4402 #define BUTTON_RIGHTDBLCLICK 5403 #define BUTTON_MIDDLEUP 6404 #define BUTTON_MIDDLEDOWN 7405 #define BUTTON_MIDDLEDBLCLICK 8406 407 390 #define WMMOVE_LBUTTON 1 408 391 #define WMMOVE_MBUTTON 2 … … 411 394 #define WMMOVE_SHIFT 16 412 395 413 414 #define CMD_MENU 1415 #define CMD_CONTROL 2416 #define CMD_ACCELERATOR 3417 418 #define KEY_ALTDOWN 1419 #define KEY_PREVDOWN 2420 #define KEY_UP 4421 #define KEY_DEADKEY 8422 423 396 #endif //__cplusplus 424 397 -
trunk/src/user32/window.cpp
r2114 r2200 1 /* $Id: window.cpp,v 1.4 3 1999-12-18 16:31:52 cbratschiExp $ */1 /* $Id: window.cpp,v 1.44 1999-12-24 18:39:13 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 532 532 if(!window) { 533 533 dprintf(("IsWindow, window %x not found", hwnd)); 534 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 534 535 return FALSE; 535 536 } … … 546 547 if(!window) { 547 548 dprintf(("IsWindowEnabled, window %x not found", hwnd)); 549 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 548 550 return 0; 549 551 } … … 1183 1185 HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags) 1184 1186 { 1185 RECT rect; 1186 HWND hWnd; 1187 POINT framePt; 1187 RECT rect; 1188 HWND hWnd; 1188 1189 1189 1190 dprintf(("ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n", … … 1196 1197 } 1197 1198 1198 MapWindowPoints(hwndParent,GetParent(hwndParent),&framePt,1);1199 if (PtInRect (&rect, framePt) == 0) {1199 ClientToScreen(hwndParent, &pt); 1200 if (PtInRect (&rect, pt) == 0) { 1200 1201 // point is outside window 1201 1202 return NULL; -
trunk/src/user32/windowmsg.cpp
r2084 r2200 1 /* $Id: windowmsg.cpp,v 1.1 0 1999-12-16 00:11:49sandervl Exp $ */1 /* $Id: windowmsg.cpp,v 1.11 1999-12-24 18:39:13 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 21 21 #include <win.h> 22 22 #include <heapstring.h> 23 #include <handlemanager.h> 23 24 #include "oslibwin.h" 24 25 #include "oslibmsg.h" … … 45 46 //****************************************************************************** 46 47 //****************************************************************************** 47 BOOL WIN32API TranslateMessage( const MSG * arg1) 48 { 49 // return O32_TranslateMessage(arg1); 50 return TRUE; 48 BOOL WIN32API TranslateMessage( const MSG * msg) 49 { 50 return OSLibWinTranslateMessage((MSG *)msg); 51 51 } 52 52 //****************************************************************************** … … 70 70 71 71 fFoundMsg = OSLibWinPeekMsg(msg, 0, uMsgFilterMin, uMsgFilterMax, 72 (fuRemoveMsg & PM_REMOVE) ? 1 : 0, FALSE);72 fuRemoveMsg, FALSE); 73 73 if(fFoundMsg) { 74 if (msg->message == WM_QUIT && (fuRemoveMsg & (PM_REMOVE))) {74 if (msg->message == WM_QUIT && (fuRemoveMsg & PM_REMOVE)) { 75 75 //TODO: Post WM_QUERYENDSESSION message when WM_QUIT received and system is shutting down 76 76 } … … 991 991 { 992 992 DWORD queueStatus; 993 994 dprintf(("USER32:GetInputState()")); 993 BOOL rc; 994 995 995 queueStatus = OSLibWinQueryQueueStatus(); 996 996 997 return (queueStatus & (QS_KEY | QS_MOUSEBUTTON)) ? TRUE : FALSE; 997 rc = (queueStatus & (QS_KEY | QS_MOUSEBUTTON)) ? TRUE : FALSE; 998 dprintf(("USER32:GetInputState() returned %d", rc)); 999 return rc; 998 1000 } 999 1001 //****************************************************************************** … … 1032 1034 return WAIT_TIMEOUT; 1033 1035 } 1034 return O32_MsgWaitForMultipleObjects(nCount,pHandles,fWaitAll,dwMilliseconds,dwWakeMask); 1035 } 1036 //SvL: Call handlemanager function as we need to translate handles 1037 return HMMsgWaitForMultipleObjects(nCount,pHandles,fWaitAll,dwMilliseconds,dwWakeMask); 1038 }
Note:
See TracChangeset
for help on using the changeset viewer.