Release 970120
Sun Jan 19 11:46:48 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [loader/module.c]
Fixed LoadModule() to always call the DLL initialization code.
* [windows/event.c]
Moved all the keyboard stuff to windows/keyboard.c
* [tools/build.c]
Fixed Win32 register functions.
Sat Jan 18 22:24:41 1997 David Makepeace <D.Makepeace@mailbox.uq.oz.au>
* [tools/makedep.c]
Fixed bug which causes SEGV on Solaris x86.
Fri Jan 17 18:32:27 1997 Frans van Dorsselaer <dorssel@rulhmpc49.LeidenUniv.nl>
* [controls/edit.c]
Implemented WM_UNDO, WM_CONTEXTMENU (temporary using WM_RBUTTONUP),
WM_COMMAND, WM_INITPOPUPMENU, WM_SYSKEYDOWN.
Fixed EM_SETSEL and some minor bugs (features).
Hence: fully functional undo and a win95 menu with the right mouse
button.
* [include/resources.h] [resources/TODO] [resources/sysres_??.rc]
Added a context menu for the edit control.
Translations, please ...
Fri Jan 17 08:29:52 1997 David Faure <david.faure@ifhamy.insa-lyon.fr>
* [windows/event.c]
Move EVENT_ToAscii to windows/keyboard.c (where name ToAscii)
Fixed Keypad keys 0-9 and . in EVENT_event_to_vkey.
Added 3-state handling of toggle keys (CapsLock, NumLock) in order
to make them work with any X server.
Toggle keys now generate WM_KEYDOWN and WM_KEYUP on each pressing.
* [include/keyboard.h]
Totally replaced the file (formerly containing the vkcase definitions)
by the declaration of 'extern' variables contained by event.c and used
by keyboard.c
* [windows/keyboard.c]
Started to rewrite VkKeyScan and MapVirtualKey, to make them use the
table keyc2vkey or X functions only.
ToAscii : added keypad 0-9 and . special case.
Changed toggle keys active mask from 0x80 to 0x1.
* [misc/keyboard.c]
File deleted. Contents moved to windows/keyboard.c.
* [misc/main.c]
Added putenv XKB_DISABLE to disable XKB extension (which, when
present, causes AltGr to change keyboard group instead of being a
modifier).
Tue Jan 14 22:56:43 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
* [windows/event.c]
Do not assume NumLockMask is Mod2Mask, but compute it by scanning
output of XGetModifierMapping for XK_Num_Lock.
Tue Jan 14 15:49:49 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [loader/pe_*.c] [include/peexe.h] [include/resource32.h]
[debugger/*.c]
General clean up.
Changed defines/structures to match Windows NT SDK.
* [loader/main.c]
Don't crash on empty command-line.
* [windows/winpos.c]
winpos.c made win32 clean.
* [misc/ntdll.c]
Some string conversion additions.
* [files/file.c]
GetFileAttributes/GetTempFileName fixed.
* [misc/ver.c]
VerInstallFile implemented.
Mon Jan 13 15:03:11 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
* [tools/build.c]: Use PREFIX also in stabs messages.
Mon Jan 13 10:40:33 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/*] [include/win16drv.h]
Many fixes and some new features.
* [graphics/x11drv/font.c] [graphics/x11drv/init.c]
[include/x11drv.h] [objects/font.c]
GetTextMetrics() moved to graphics driver.
* [if1632/gdi.spec] [misc/fontengine.c] [misc/Makefile.in]
New dummy EngineEnumerateFont, EngineRealizeFont functions.
* [include/windows.h]
TEXTFORM16 and FONTINFO16 structure definitions moved here from
include/win16drv.h
diff --git a/windows/dce.c b/windows/dce.c
index 56889ce..08c09e1 100644
--- a/windows/dce.c
+++ b/windows/dce.c
@@ -273,7 +273,7 @@
* clipped by the client area of all ancestors, and then optionally
* by siblings and children.
*/
-HRGN32 DCE_GetVisRgn( HWND hwnd, WORD flags )
+HRGN32 DCE_GetVisRgn( HWND32 hwnd, WORD flags )
{
RECT16 rect;
HRGN32 hrgn;
diff --git a/windows/defdlg.c b/windows/defdlg.c
index a4808e9..0ec5c44 100644
--- a/windows/defdlg.c
+++ b/windows/defdlg.c
@@ -21,7 +21,7 @@
{
HWND32 hwndPrev = GetFocus32();
- if (IsChild( hwndDlg, hwndPrev ))
+ if (IsChild32( hwndDlg, hwndPrev ))
{
if (SendMessage16( hwndPrev, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
SendMessage16( hwndPrev, EM_SETSEL16, TRUE, MAKELONG( -1, 0 ) );
@@ -39,7 +39,7 @@
{
HWND32 hwndFocus = GetFocus32();
- if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return FALSE;
+ if (!hwndFocus || !IsChild32( hwnd, hwndFocus )) return FALSE;
infoPtr->hwndFocus = hwndFocus;
/* Remove default button */
return TRUE;
@@ -51,7 +51,7 @@
*/
static BOOL32 DEFDLG_RestoreFocus( HWND32 hwnd, DIALOGINFO *infoPtr )
{
- if (!infoPtr->hwndFocus || IsIconic(hwnd)) return FALSE;
+ if (!infoPtr->hwndFocus || IsIconic32(hwnd)) return FALSE;
if (!IsWindow( infoPtr->hwndFocus )) return FALSE;
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
infoPtr->hwndFocus = 0;
@@ -66,12 +66,12 @@
*/
static HWND32 DEFDLG_FindDefButton( HWND32 hwndDlg )
{
- HWND32 hwndChild = GetWindow( hwndDlg, GW_CHILD );
+ HWND32 hwndChild = GetWindow32( hwndDlg, GW_CHILD );
while (hwndChild)
{
if (SendMessage16( hwndChild, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON)
break;
- hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
+ hwndChild = GetWindow32( hwndChild, GW_HWNDNEXT );
}
return hwndChild;
}
@@ -91,14 +91,14 @@
if (dlgInfo->idResult) /* There's already a default pushbutton */
{
- HWND32 hwndOld = GetDlgItem( hwndDlg, dlgInfo->idResult );
+ HWND32 hwndOld = GetDlgItem32( hwndDlg, dlgInfo->idResult );
if (SendMessage32A( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
SendMessage32A( hwndOld, BM_SETSTYLE32, BS_PUSHBUTTON, TRUE );
}
if (hwndNew)
{
SendMessage32A( hwndNew, BM_SETSTYLE32, BS_DEFPUSHBUTTON, TRUE );
- dlgInfo->idResult = GetDlgCtrlID( hwndNew );
+ dlgInfo->idResult = GetDlgCtrlID32( hwndNew );
}
else dlgInfo->idResult = 0;
return TRUE;
@@ -170,7 +170,7 @@
case DM_SETDEFID:
if (dlgInfo->fEnd) return 1;
DEFDLG_SetDefButton( hwnd, dlgInfo,
- wParam ? GetDlgItem( hwnd, wParam ) : 0 );
+ wParam ? GetDlgItem32( hwnd, wParam ) : 0 );
return 1;
case DM_GETDEFID:
@@ -179,7 +179,7 @@
return MAKELONG( dlgInfo->idResult, DC_HASDEFID );
hwndDefId = DEFDLG_FindDefButton( hwnd );
if (hwndDefId)
- return MAKELONG( GetDlgCtrlID( hwndDefId ), DC_HASDEFID);
+ return MAKELONG( GetDlgCtrlID32( hwndDefId ), DC_HASDEFID);
return 0;
case WM_NEXTDLGCTL:
@@ -197,7 +197,7 @@
case WM_CLOSE:
EndDialog( hwnd, TRUE );
- DestroyWindow( hwnd );
+ DestroyWindow32( hwnd );
return 0;
}
return 0;
diff --git a/windows/defwnd.c b/windows/defwnd.c
index b666cca..c393eb7 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -132,11 +132,15 @@
ValidateRect32( wndPtr->hwndSelf, NULL );
wndPtr->flags |= WIN_NO_REDRAW;
}
- else wndPtr->flags &= ~WIN_NO_REDRAW;
+ else
+ {
+ wndPtr->flags &= ~WIN_NO_REDRAW;
+ ShowWindow32( wndPtr->hwndSelf, SW_SHOW );
+ }
return 0;
case WM_CLOSE:
- DestroyWindow( wndPtr->hwndSelf );
+ DestroyWindow32( wndPtr->hwndSelf );
return 0;
case WM_MOUSEACTIVATE:
@@ -297,7 +301,7 @@
if (!(wndPtr->dwStyle & WS_POPUP) || !wndPtr->owner) return 0;
if ((wndPtr->dwStyle & WS_VISIBLE) && wParam) return 0;
else if (!(wndPtr->dwStyle & WS_VISIBLE) && !wParam) return 0;
- ShowWindow( wndPtr->hwndSelf, wParam ? SW_SHOWNOACTIVATE : SW_HIDE );
+ ShowWindow32( wndPtr->hwndSelf, wParam ? SW_SHOWNOACTIVATE : SW_HIDE );
break;
case WM_CANCELMODE:
diff --git a/windows/dialog.c b/windows/dialog.c
index bcd73ea..5fbd4ee 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -5,6 +5,7 @@
*/
#include <ctype.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -226,7 +227,7 @@
* Create the control windows for a dialog.
*/
static BOOL32 DIALOG_CreateControls( WND *pWnd, LPCSTR template, INT32 items,
- HINSTANCE32 hInst, BOOL win32 )
+ HINSTANCE32 hInst, BOOL32 win32 )
{
DIALOGINFO *dlgInfo = (DIALOGINFO *)pWnd->wExtra;
DLG_CONTROL_INFO info;
@@ -465,8 +466,8 @@
{
HMENU16 hMenu = 0;
HFONT16 hFont = 0;
- HWND hwnd;
- RECT16 rect;
+ HWND32 hwnd;
+ RECT32 rect;
WND * wndPtr;
DLG_TEMPLATE template;
DIALOGINFO * dlgInfo;
@@ -524,7 +525,7 @@
rect.bottom = template.cy * yUnit / 8;
if (template.style & DS_MODALFRAME)
template.exStyle |= WS_EX_DLGMODALFRAME;
- AdjustWindowRectEx16( &rect, template.style,
+ AdjustWindowRectEx32( &rect, template.style,
hMenu ? TRUE : FALSE , template.exStyle );
rect.right -= rect.left;
rect.bottom -= rect.top;
@@ -543,7 +544,7 @@
INT16 dX, dY;
if( !(template.style & DS_ABSALIGN) )
- ClientToScreen16( owner, (POINT16 *)&rect );
+ ClientToScreen32( owner, (POINT32 *)&rect );
/* try to fit it into the desktop */
@@ -596,7 +597,7 @@
if (!DIALOG_CreateControls( wndPtr, dlgTemplate, template.nbItems,
hInst, win32Template ))
{
- DestroyWindow( hwnd );
+ DestroyWindow32( hwnd );
return 0;
}
@@ -606,7 +607,7 @@
if (SendMessage32A( hwnd, WM_INITDIALOG,
(WPARAM32)dlgInfo->hwndFocus, param ))
SetFocus32( dlgInfo->hwndFocus );
- if (template.style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
+ if (template.style & WS_VISIBLE) ShowWindow32( hwnd, SW_SHOW );
return hwnd;
}
@@ -736,8 +737,8 @@
owner = WIN_GetTopParent( owner );
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return -1;
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
- EnableWindow( owner, FALSE );
- ShowWindow( hwnd, SW_SHOW );
+ EnableWindow32( owner, FALSE );
+ ShowWindow32( hwnd, SW_SHOW );
while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX, PM_REMOVE,
!(wndPtr->dwStyle & DS_NOIDLEMSG) ))
@@ -750,8 +751,8 @@
if (dlgInfo->fEnd) break;
}
retval = dlgInfo->idResult;
- EnableWindow( owner, TRUE );
- DestroyWindow( hwnd );
+ EnableWindow32( owner, TRUE );
+ DestroyWindow32( hwnd );
return retval;
}
@@ -872,13 +873,13 @@
/***********************************************************************
* IsDialogMessage (USER.90)
*/
-BOOL IsDialogMessage( HWND hwndDlg, LPMSG16 msg )
+BOOL16 IsDialogMessage( HWND16 hwndDlg, LPMSG16 msg )
{
WND * wndPtr;
int dlgCode;
if (!(wndPtr = WIN_FindWndPtr( hwndDlg ))) return FALSE;
- if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd )) return FALSE;
+ if ((hwndDlg != msg->hwnd) && !IsChild16( hwndDlg, msg->hwnd )) return FALSE;
/* Only the key messages get special processing */
if ((msg->message != WM_KEYDOWN) &&
@@ -930,7 +931,7 @@
case VK_ESCAPE:
SendMessage32A( hwndDlg, WM_COMMAND, IDCANCEL,
- (LPARAM)GetDlgItem( hwndDlg, IDCANCEL ) );
+ (LPARAM)GetDlgItem32( hwndDlg, IDCANCEL ) );
break;
case VK_RETURN:
@@ -939,10 +940,10 @@
if (HIWORD(dw) == DC_HASDEFID)
SendMessage32A( hwndDlg, WM_COMMAND,
MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
- (LPARAM)GetDlgItem( hwndDlg, LOWORD(dw) ));
+ (LPARAM)GetDlgItem32(hwndDlg, LOWORD(dw)));
else
SendMessage32A( hwndDlg, WM_COMMAND, IDOK,
- (LPARAM)GetDlgItem( hwndDlg, IDOK ) );
+ (LPARAM)GetDlgItem32( hwndDlg, IDOK ) );
}
break;
@@ -969,9 +970,20 @@
/****************************************************************
- * GetDlgCtrlID (USER.277) (USER32.233)
+ * GetDlgCtrlID16 (USER.277)
*/
-INT16 GetDlgCtrlID( HWND32 hwnd )
+INT16 GetDlgCtrlID16( HWND16 hwnd )
+{
+ WND *wndPtr = WIN_FindWndPtr(hwnd);
+ if (wndPtr) return wndPtr->wIDmenu;
+ else return 0;
+}
+
+
+/****************************************************************
+ * GetDlgCtrlID32 (USER32.233)
+ */
+INT32 GetDlgCtrlID32( HWND32 hwnd )
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr) return wndPtr->wIDmenu;
@@ -980,15 +992,29 @@
/***********************************************************************
- * GetDlgItem (USER.91)
+ * GetDlgItem16 (USER.91)
*/
-HWND GetDlgItem( HWND hwndDlg, WORD id )
+HWND16 GetDlgItem16( HWND16 hwndDlg, INT16 id )
{
WND *pWnd;
if (!(pWnd = WIN_FindWndPtr( hwndDlg ))) return 0;
for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
- if (pWnd->wIDmenu == id) return pWnd->hwndSelf;
+ if (pWnd->wIDmenu == (UINT16)id) return pWnd->hwndSelf;
+ return 0;
+}
+
+
+/***********************************************************************
+ * GetDlgItem32 (USER32.234)
+ */
+HWND32 GetDlgItem32( HWND32 hwndDlg, INT32 id )
+{
+ WND *pWnd;
+
+ if (!(pWnd = WIN_FindWndPtr( hwndDlg ))) return 0;
+ for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
+ if (pWnd->wIDmenu == (UINT16)id) return pWnd->hwndSelf;
return 0;
}
@@ -999,7 +1025,7 @@
LRESULT SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
WPARAM16 wParam, LPARAM lParam )
{
- HWND16 hwndCtrl = GetDlgItem( hwnd, id );
+ HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
else return 0;
}
@@ -1011,7 +1037,7 @@
LRESULT SendDlgItemMessage32A( HWND32 hwnd, INT32 id, UINT32 msg,
WPARAM32 wParam, LPARAM lParam )
{
- HWND hwndCtrl = GetDlgItem( (HWND16)hwnd, (INT16)id );
+ HWND32 hwndCtrl = GetDlgItem32( hwnd, id );
if (hwndCtrl) return SendMessage32A( hwndCtrl, msg, wParam, lParam );
else return 0;
}
@@ -1023,7 +1049,7 @@
LRESULT SendDlgItemMessage32W( HWND32 hwnd, INT32 id, UINT32 msg,
WPARAM32 wParam, LPARAM lParam )
{
- HWND hwndCtrl = GetDlgItem( (HWND16)hwnd, (INT16)id );
+ HWND32 hwndCtrl = GetDlgItem32( hwnd, id );
if (hwndCtrl) return SendMessage32W( hwndCtrl, msg, wParam, lParam );
else return 0;
}
@@ -1091,13 +1117,7 @@
*/
void SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
{
- char *str = (char *)SEGPTR_ALLOC( 20 * sizeof(char) );
-
- if (!str) return;
- if (fSigned) sprintf( str, "%d", (INT32)(INT16)value );
- else sprintf( str, "%u", value );
- SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)SEGPTR_GET(str) );
- SEGPTR_FREE(str);
+ return SetDlgItemInt32( hwnd, (UINT32)(UINT16)id, value, fSigned );
}
@@ -1115,42 +1135,67 @@
/***********************************************************************
- * GetDlgItemInt (USER.95)
+ * GetDlgItemInt16 (USER.95)
*/
-WORD GetDlgItemInt( HWND hwnd, WORD id, BOOL * translated, BOOL fSigned )
+UINT16 GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated,
+ BOOL16 fSigned )
{
- char *str;
- long result = 0;
-
+ UINT32 result;
+ BOOL32 ok;
+
if (translated) *translated = FALSE;
- if (!(str = (char *)SEGPTR_ALLOC( 30 * sizeof(char) ))) return 0;
- if (SendDlgItemMessage16( hwnd, id, WM_GETTEXT, 30, (LPARAM)SEGPTR_GET(str)))
+ result = GetDlgItemInt32( hwnd, (UINT32)(UINT16)id, &ok, fSigned );
+ if (!ok) return 0;
+ if (fSigned)
{
- char * endptr;
- result = strtol( str, &endptr, 10 );
- if (endptr && (endptr != str)) /* Conversion was successful */
- {
- if (fSigned)
- {
- if ((result < -32767) || (result > 32767)) result = 0;
- else if (translated) *translated = TRUE;
- }
- else
- {
- if ((result < 0) || (result > 65535)) result = 0;
- else if (translated) *translated = TRUE;
- }
- }
+ if (((INT32)result < -32767) || ((INT32)result > 32767)) return 0;
}
- SEGPTR_FREE(str);
- return (WORD)result;
+ else
+ {
+ if (result > 65535) return 0;
+ }
+ if (translated) *translated = TRUE;
+ return (UINT16)result;
}
/***********************************************************************
- * CheckDlgButton (USER.97) (USER32.44)
+ * GetDlgItemInt32 (USER32.235)
*/
-BOOL16 CheckDlgButton( HWND32 hwnd, INT32 id, UINT32 check )
+UINT32 GetDlgItemInt32( HWND32 hwnd, INT32 id, BOOL32 *translated,
+ BOOL32 fSigned )
+{
+ char str[30];
+ char * endptr;
+ long result = 0;
+
+ if (translated) *translated = FALSE;
+ if (!SendDlgItemMessage32A(hwnd, id, WM_GETTEXT, sizeof(str), (LPARAM)str))
+ return 0;
+ if (fSigned)
+ {
+ result = strtol( str, &endptr, 10 );
+ if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
+ return 0;
+ if (((result == LONG_MIN) || (result == LONG_MAX)) && (errno==ERANGE))
+ return 0;
+ }
+ else
+ {
+ result = strtoul( str, &endptr, 10 );
+ if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
+ return 0;
+ if ((result == ULONG_MAX) && (errno == ERANGE)) return 0;
+ }
+ if (translated) *translated = TRUE;
+ return (UINT32)result;
+}
+
+
+/***********************************************************************
+ * CheckDlgButton16 (USER.97)
+ */
+BOOL16 CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
{
SendDlgItemMessage32A( hwnd, id, BM_SETCHECK32, check, 0 );
return TRUE;
@@ -1158,19 +1203,48 @@
/***********************************************************************
- * IsDlgButtonChecked (USER.98)
+ * CheckDlgButton32 (USER32.44)
*/
-WORD IsDlgButtonChecked( HWND hwnd, WORD id )
+BOOL32 CheckDlgButton32( HWND32 hwnd, INT32 id, UINT32 check )
{
- return (WORD)SendDlgItemMessage32A( hwnd, id, BM_GETCHECK32, 0, 0 );
+ SendDlgItemMessage32A( hwnd, id, BM_SETCHECK32, check, 0 );
+ return TRUE;
}
/***********************************************************************
- * CheckRadioButton (USER.96) (USER32.47)
+ * IsDlgButtonChecked16 (USER.98)
*/
-BOOL16 CheckRadioButton( HWND32 hwndDlg, UINT32 firstID, UINT32 lastID,
- UINT32 checkID )
+UINT16 IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
+{
+ return (UINT16)SendDlgItemMessage32A( hwnd, id, BM_GETCHECK32, 0, 0 );
+}
+
+
+/***********************************************************************
+ * IsDlgButtonChecked32 (USER32.343)
+ */
+UINT32 IsDlgButtonChecked32( HWND32 hwnd, UINT32 id )
+{
+ return (UINT32)SendDlgItemMessage32A( hwnd, id, BM_GETCHECK32, 0, 0 );
+}
+
+
+/***********************************************************************
+ * CheckRadioButton16 (USER.96)
+ */
+BOOL16 CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID, UINT16 lastID,
+ UINT16 checkID )
+{
+ return CheckRadioButton32( hwndDlg, firstID, lastID, checkID );
+}
+
+
+/***********************************************************************
+ * CheckRadioButton32 (USER32.47)
+ */
+BOOL32 CheckRadioButton32( HWND32 hwndDlg, UINT32 firstID, UINT32 lastID,
+ UINT32 checkID )
{
WND *pWnd = WIN_FindWndPtr( hwndDlg );
if (!pWnd) return FALSE;
@@ -1354,7 +1428,7 @@
char *buffer, *ptr;
INT32 item, size;
BOOL32 ret;
- HWND32 listbox = GetDlgItem( hwnd, id );
+ HWND32 listbox = GetDlgItem32( hwnd, id );
dprintf_dialog( stddeb, "DlgDirSelect: %04x '%s' %d\n", hwnd, str, id );
if (!listbox) return FALSE;
@@ -1436,7 +1510,7 @@
}
else drive = DRIVE_GetCurrentDrive();
- if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0))
+ if (idLBox && ((hwnd = GetDlgItem32( hDlg, idLBox )) != 0))
{
/* If the path exists and is a directory, chdir to it */
if (!spec || !spec[0] || DRIVE_Chdir( drive, spec )) spec = "*.*";
@@ -1484,7 +1558,7 @@
}
}
- if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
+ if (idStatic && ((hwnd = GetDlgItem32( hDlg, idStatic )) != 0))
{
char temp[512];
int drive = DRIVE_GetCurrentDrive();
diff --git a/windows/event.c b/windows/event.c
index 19480dd..d8e6dfb 100644
--- a/windows/event.c
+++ b/windows/event.c
@@ -58,11 +58,6 @@
/* X context to associate a hwnd to an X window */
static XContext winContext = 0;
- /* State variables */
-BOOL MouseButtonsStates[NB_BUTTONS];
-BOOL AsyncMouseButtonsStates[NB_BUTTONS];
-BYTE InputKeyStateTable[256];
-
static INT16 captureHT = HTCLIENT;
static HWND32 captureWnd = 0;
static BOOL32 InputEnabled = TRUE;
@@ -85,7 +80,7 @@
};
/* Event handlers */
-static void EVENT_key( XKeyEvent *event );
+static void EVENT_Key( XKeyEvent *event );
static void EVENT_ButtonPress( XButtonEvent *event );
static void EVENT_ButtonRelease( XButtonEvent *event );
static void EVENT_MotionNotify( XMotionEvent *event );
@@ -128,7 +123,7 @@
case KeyPress:
case KeyRelease:
if (InputEnabled)
- EVENT_key( (XKeyEvent*)event );
+ EVENT_Key( (XKeyEvent*)event );
break;
case ButtonPress:
@@ -445,417 +440,13 @@
/***********************************************************************
- * EVENT_key
+ * EVENT_Key
*
* Handle a X key event
*/
-
-/* Keyboard translation tables */
-static const int special_key[] =
+static void EVENT_Key( XKeyEvent *event )
{
- VK_BACK, VK_TAB, 0, VK_CLEAR, 0, VK_RETURN, 0, 0, /* FF08 */
- 0, 0, 0, VK_PAUSE, VK_SCROLL, 0, 0, 0, /* FF10 */
- 0, 0, 0, VK_ESCAPE /* FF18 */
-};
-
-static const int cursor_key[] =
-{
- VK_HOME, VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN, VK_PRIOR,
- VK_NEXT, VK_END /* FF50 */
-};
-
-static const int misc_key[] =
-{
- VK_SELECT, VK_SNAPSHOT, VK_EXECUTE, VK_INSERT, 0, 0, 0, 0, /* FF60 */
- VK_CANCEL, VK_HELP, VK_CANCEL, VK_MENU /* FF68 */
-};
-
-static const int keypad_key[] =
-{
- 0, VK_NUMLOCK, /* FF7E */
- 0, 0, 0, 0, 0, 0, 0, 0, /* FF80 */
- 0, 0, 0, 0, 0, VK_RETURN, 0, 0, /* FF88 */
- 0, 0, 0, 0, 0, VK_HOME, VK_LEFT, VK_UP, /* FF90 */
- VK_RIGHT, VK_DOWN, VK_PRIOR, VK_NEXT, VK_END, 0,
- VK_INSERT, VK_DELETE, /* FF98 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* FFA0 */
- 0, 0, VK_MULTIPLY, VK_ADD, VK_SEPARATOR, VK_SUBTRACT,
- VK_DECIMAL, VK_DIVIDE, /* FFA8 */
- VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4,
- VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, /* FFB0 */
- VK_NUMPAD8, VK_NUMPAD9 /* FFB8 */
-};
-
-static const int function_key[] =
-{
- VK_F1, VK_F2, /* FFBE */
- VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, /* FFC0 */
- VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16 /* FFC8 */
-};
-
-static const int modifier_key[] =
-{
- VK_SHIFT, VK_SHIFT, VK_CONTROL, VK_CONTROL, VK_CAPITAL, 0, /* FFE1 */
- VK_MENU, VK_MENU, VK_MENU, VK_MENU /* FFE7 */
-};
-
-static int AltGrMask;
-static int min_keycode, max_keycode;
-static int keyc2vkey [256];
-/* For example : keyc2vkey[10] is the VK_* associated with keycode10 */
-
-static WORD EVENT_event_to_vkey( XKeyEvent *e)
-{
- static int keysyms_per_keycode;
- int i;
- KeySym keysym;
-
- if (!keysyms_per_keycode) /* First time : Initialization */
- {
- KeySym *ksp;
- XModifierKeymap *mmp;
- KeyCode *kcp;
- XKeyEvent e2;
- WORD vkey, OEMvkey;
-
- XDisplayKeycodes(e->display, &min_keycode, &max_keycode);
- ksp = XGetKeyboardMapping(e->display, min_keycode,
- max_keycode + 1 - min_keycode, &keysyms_per_keycode);
- /* We are only interested in keysyms_per_keycode.
- There is no need to hold a local copy of the keysyms table */
- XFree(ksp);
- mmp = XGetModifierMapping(e->display);
- kcp = mmp->modifiermap;
- for (i = 0; i < 8; i += 1) /* There are 8 modifier keys */
- {
- int j;
-
- for (j = 0; j < mmp->max_keypermod; j += 1, kcp += 1)
- if (*kcp)
- {
- int k;
-
- for (k = 0; k < keysyms_per_keycode; k += 1)
- if (XKeycodeToKeysym(e->display, *kcp, k)
- == XK_Mode_switch)
- {
- AltGrMask = 1 << i;
- dprintf_key(stddeb, "AltGrMask is %x\n", AltGrMask);
- }
- }
- }
- XFreeModifiermap(mmp);
-
- /* Now build two conversion arrays :
- * keycode -> vkey + extended
- * vkey + extended -> keycode */
-
- e2.display = e->display;
- e2.state = 0;
-
- OEMvkey = 0xb9; /* first OEM virtual key available is ba */
- for (e2.keycode=min_keycode; e2.keycode<=max_keycode; e2.keycode++)
- {
- XLookupString(&e2, NULL, 0, &keysym, NULL);
- vkey = 0;
- if (keysym) /* otherwise, keycode not used */
- {
- if ((keysym >> 8) == 0xFF) /* non-character key */
- {
- int key = keysym & 0xff;
-
- if (key >= 0x08 && key <= 0x1B) /* special key */
- vkey = special_key[key - 0x08];
- else if (key >= 0x50 && key <= 0x57) /* cursor key */
- vkey = cursor_key[key - 0x50];
- else if (key >= 0x60 && key <= 0x6B) /* miscellaneous key */
- vkey = misc_key[key - 0x60];
- else if (key >= 0x7E && key <= 0xB9) /* keypad key */
- vkey = keypad_key[key - 0x7E];
- else if (key >= 0xBE && key <= 0xCD) /* function key */
- {
- vkey = function_key[key - 0xBE];
- vkey |= 0x100; /* set extended bit */
- }
- else if (key >= 0xE1 && key <= 0xEA) /* modifier key */
- vkey = modifier_key[key - 0xE1];
- else if (key == 0xFF) /* DEL key */
- vkey = VK_DELETE;
- /* extended must also be set for ALT_R, CTRL_R,
- INS, DEL, HOME, END, PAGE_UP, PAGE_DOWN, ARROW keys,
- keypad / and keypad ENTER (SDK 3.1 Vol.3 p 138) */
- switch (keysym)
- {
- case XK_Control_R :
- case XK_Alt_R :
- case XK_Insert :
- case XK_Delete :
- case XK_Home :
- case XK_End :
- case XK_Prior :
- case XK_Next :
- case XK_Left :
- case XK_Up :
- case XK_Right :
- case XK_Down :
- case XK_KP_Divide :
- case XK_KP_Enter :
- vkey |= 0x100;
- }
- }
- for (i = 0; (i < keysyms_per_keycode) && (!vkey); i++)
- {
- keysym = XLookupKeysym(&e2, i);
- if ((keysym >= VK_0 && keysym <= VK_9)
- || (keysym >= VK_A && keysym <= VK_Z)
- || keysym == VK_SPACE)
- vkey = keysym;
- }
-
- if (!vkey)
- {
- /* Others keys: let's assign OEM virtual key codes in the allowed range,
- * that is ([0xba,0xc0], [0xdb,0xe4], 0xe6 (given up) et [0xe9,0xf5]) */
- switch (++OEMvkey)
- {
- case 0xc1 : OEMvkey=0xdb; break;
- case 0xe5 : OEMvkey=0xe9; break;
- case 0xf6 : OEMvkey=0xf5; fprintf(stderr,"No more OEM vkey available!\n");
- }
-
- vkey = OEMvkey;
-
- if (debugging_keyboard)
- {
- fprintf(stddeb,"OEM specific virtual key %X assigned to keycode %X :\n ("
- ,OEMvkey,e2.keycode);
- for (i = 0; i < keysyms_per_keycode; i += 1)
- {
- char *ksname;
-
- keysym = XLookupKeysym(&e2, i);
- ksname = XKeysymToString(keysym);
- if (!ksname)
- ksname = "NoSymbol";
- fprintf(stddeb, "%lX (%s) ", keysym, ksname);
- }
- fprintf(stddeb, ")\n");
- }
- }
- }
- keyc2vkey[e2.keycode] = vkey;
- } /* for */
- } /* Initialization */
-
- return keyc2vkey[e->keycode];
-
-}
-
-int EVENT_ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
- LPVOID lpChar, WORD wFlags)
-{
- XKeyEvent e;
- KeySym keysym;
- static XComposeStatus cs;
- int ret;
- WORD keyc;
-
- e.display = display;
- e.keycode = 0;
- for (keyc=min_keycode; keyc<=max_keycode; keyc++)
- { /* this could be speed up by making another table, an array of struct vkey,keycode
- * (vkey -> keycode) with vkeys sorted .... but it takes memory (512*3 bytes)! DF */
- if ((keyc2vkey[keyc] & 0xFF)== wVirtKey) /* no need to make a more precise test (with the extended bit correctly set above wVirtKey ... VK* are different enough... */
- {
- if ((e.keycode) && ((wVirtKey<0x10) || (wVirtKey>0x12)))
- /* it's normal to have 2 shift, control, and alt ! */
- dprintf_keyboard(stddeb,"Strange ... the keycodes %X and %X are matching!\n",
- e.keycode,keyc);
- e.keycode = keyc;
- }
- }
- if (!e.keycode)
- {
- fprintf(stderr,"Unknown virtual key %X !!! \n",wVirtKey);
- return wVirtKey; /* whatever */
- }
- e.state = 0;
- if (lpKeyState[VK_SHIFT] & 0x80)
- e.state |= ShiftMask;
- if (lpKeyState[VK_CAPITAL] & 0x80)
- e.state |= LockMask;
- if (lpKeyState[VK_CONTROL] & 0x80)
- if (lpKeyState[VK_MENU] & 0x80)
- e.state |= AltGrMask;
- else
- e.state |= ControlMask;
- if (lpKeyState[VK_NUMLOCK] & 0x80)
- e.state |= Mod2Mask;
- dprintf_key(stddeb, "EVENT_ToAscii(%04X, %04X) : faked state = %X\n",
- wVirtKey, wScanCode, e.state);
- ret = XLookupString(&e, lpChar, 2, &keysym, &cs);
- if (ret == 0)
- {
- BYTE dead_char = 0;
-
- ((char*)lpChar)[1] = '\0';
- switch (keysym)
- {
- case XK_dead_tilde :
- case 0x1000FE7E : /* Xfree's XK_Dtilde */
- dead_char = '~';
- break;
- case XK_dead_acute :
- case 0x1000FE27 : /* Xfree's XK_Dacute_accent */
- dead_char = 0xb4;
- break;
- case XK_dead_circumflex :
- case 0x1000FE5E : /* Xfree's XK_Dcircumflex_accent */
- dead_char = '^';
- break;
- case XK_dead_grave :
- case 0x1000FE60 : /* Xfree's XK_Dgrave_accent */
- dead_char = '`';
- break;
- case XK_dead_diaeresis :
- case 0x1000FE22 : /* Xfree's XK_Ddiaeresis */
- dead_char = 0xa8;
- break;
- }
- if (dead_char)
- {
- *(char*)lpChar = dead_char;
- ret = -1;
- }
- else
- {
- char *ksname;
-
- ksname = XKeysymToString(keysym);
- if (!ksname)
- ksname = "No Name";
- if ((keysym >> 8) != 0xff)
- {
- fprintf(stderr, "Please report : no char for keysym %04lX (%s) :\n",
- keysym, ksname);
- fprintf(stderr, " wVirtKey = %X, wScanCode = %X, keycode = %X, state = %X\n",
- wVirtKey, wScanCode, e.keycode, e.state);
- }
- }
- }
- dprintf_key(stddeb, "EVENT_ToAscii about to return %d with char %x\n",
- ret, *(char*)lpChar);
- return ret;
-}
-
-typedef union
-{
- struct
- {
- unsigned long count : 16;
- unsigned long code : 8;
- unsigned long extended : 1;
- unsigned long unused : 2;
- unsigned long win_internal : 2;
- unsigned long context : 1;
- unsigned long previous : 1;
- unsigned long transition : 1;
- } lp1;
- unsigned long lp2;
-} KEYLP;
-
-static void EVENT_key( XKeyEvent *event )
-{
- char Str[24];
- XComposeStatus cs;
- KeySym keysym;
- WORD vkey = 0;
- KEYLP keylp;
- WORD message;
- static BOOL force_extended = FALSE; /* hack for AltGr translation */
-
- int ascii_chars = XLookupString(event, Str, 1, &keysym, &cs);
-
- dprintf_key(stddeb, "EVENT_key : state = %X\n", event->state);
- if (keysym == XK_Mode_switch)
- {
- dprintf_key(stddeb, "Alt Gr key event received\n");
- event->keycode = XKeysymToKeycode(event->display, XK_Control_L);
- dprintf_key(stddeb, "Control_L is keycode 0x%x\n", event->keycode);
- EVENT_key(event);
- event->keycode = XKeysymToKeycode(event->display, XK_Alt_L);
- dprintf_key(stddeb, "Alt_L is keycode 0x%x\n", event->keycode);
- force_extended = TRUE;
- EVENT_key(event);
- force_extended = FALSE;
- return;
- }
-
- Str[ascii_chars] = '\0';
- if (debugging_key)
- {
- char *ksname;
-
- ksname = XKeysymToString(keysym);
- if (!ksname)
- ksname = "No Name";
- fprintf(stddeb, "%s : keysym=%lX (%s), ascii chars=%u / %X / '%s'\n",
- event_names[event->type], keysym, ksname,
- ascii_chars, Str[0] & 0xff, Str);
- }
-
-#if 0
- /* Ctrl-Alt-Return enters the debugger */
- if ((keysym == XK_Return) && (event->type == KeyPress) &&
- (event->state & ControlMask) && (event->state & Mod1Mask))
- DEBUG_EnterDebugger();
-#endif
-
- vkey = EVENT_event_to_vkey(event);
- if (force_extended) vkey |= 0x100;
-
- dprintf_key(stddeb, "keycode 0x%x converted to vkey 0x%x\n",
- event->keycode, vkey);
-
- keylp.lp1.count = 1;
- keylp.lp1.code = LOBYTE(event->keycode) - 8;
- keylp.lp1.extended = (vkey & 0x100 ? 1 : 0);
- keylp.lp1.win_internal = 0; /* this has something to do with dialogs,
- * don't remember where I read it - AK */
- /* it's '1' under windows, when a dialog box appears
- * and you press one of the underlined keys - DF*/
- vkey &= 0xff;
- if (event->type == KeyPress)
- {
- keylp.lp1.previous = (InputKeyStateTable[vkey] & 0x80) != 0;
- if (!(InputKeyStateTable[vkey] & 0x80))
- InputKeyStateTable[vkey] ^= 0x01;
- InputKeyStateTable[vkey] |= 0x80;
- keylp.lp1.transition = 0;
- message = (InputKeyStateTable[VK_MENU] & 0x80)
- && !(InputKeyStateTable[VK_CONTROL] & 0x80)
- ? WM_SYSKEYDOWN : WM_KEYDOWN;
- }
- else
- {
- UINT sysKey = (InputKeyStateTable[VK_MENU] & 0x80)
- && !(InputKeyStateTable[VK_CONTROL] & 0x80)
- && (force_extended == FALSE); /* for Alt from AltGr */
-
- InputKeyStateTable[vkey] &= ~0x80;
- keylp.lp1.previous = 1;
- keylp.lp1.transition = 1;
- message = sysKey ? WM_SYSKEYUP : WM_KEYUP;
- }
- keylp.lp1.context = ( (event->state & Mod1Mask) ||
- (InputKeyStateTable[VK_MENU] & 0x80)) ? 1 : 0;
- dprintf_key(stddeb," wParam=%04X, lParam=%08lX\n",
- vkey, keylp.lp2 );
- dprintf_key(stddeb," InputKeyState=%X\n",
- InputKeyStateTable[vkey]);
-
- hardware_event( message, vkey, keylp.lp2, event->x_root - desktopX,
- event->y_root - desktopY, event->time - MSG_WineStartTicks, 0 );
+ KEYBOARD_HandleEvent( event );
}
@@ -933,8 +524,8 @@
static void EVENT_FocusIn (HWND hwnd, XFocusChangeEvent *event )
{
if (event->detail == NotifyPointer) return;
- if (hwnd != GetActiveWindow()) WINPOS_ChangeActiveWindow( hwnd, FALSE );
- if ((hwnd != GetFocus32()) && !IsChild( hwnd, GetFocus32()))
+ if (hwnd != GetActiveWindow32()) WINPOS_ChangeActiveWindow( hwnd, FALSE );
+ if ((hwnd != GetFocus32()) && !IsChild32( hwnd, GetFocus32()))
SetFocus32( hwnd );
}
@@ -947,8 +538,8 @@
static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
{
if (event->detail == NotifyPointer) return;
- if (hwnd == GetActiveWindow()) WINPOS_ChangeActiveWindow( 0, FALSE );
- if ((hwnd == GetFocus32()) || IsChild( hwnd, GetFocus32()))
+ if (hwnd == GetActiveWindow32()) WINPOS_ChangeActiveWindow( 0, FALSE );
+ if ((hwnd == GetFocus32()) || IsChild32( hwnd, GetFocus32()))
SetFocus32( 0 );
}
@@ -1271,7 +862,7 @@
{
HWND32 hwndFocus = GetFocus32();
- if (hwndFocus && IsChild( hWnd, hwndFocus ))
+ if (hwndFocus && IsChild32( hWnd, hwndFocus ))
FOCUS_SetXFocus( (HWND32)hwndFocus );
return;
diff --git a/windows/focus.c b/windows/focus.c
index 7d284d0..f40c5db 100644
--- a/windows/focus.c
+++ b/windows/focus.c
@@ -106,7 +106,7 @@
return 0;
/* activate hwndTop if needed. */
- if (hwndTop != GetActiveWindow())
+ if (hwndTop != GetActiveWindow32())
{
if (!WINPOS_SetActiveWindow(hwndTop, 0, 0)) return 0;
diff --git a/windows/keyboard.c b/windows/keyboard.c
index 1a418fd..12c3fce 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -3,22 +3,424 @@
*
* Copyright 1993 Bob Amstadt
* Copyright 1996 Albrecht Kleine
+ * Copyright 1997 David Faure
+ *
*/
-
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "win.h"
-#include "windows.h"
-#include "accel.h"
-#include "stddebug.h"
-#include "debug.h"
+#include <ctype.h>
+#include <X11/keysym.h>
+#include <X11/Xlib.h>
+#include <X11/Xresource.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
-extern BOOL MouseButtonsStates[3];
-extern BOOL AsyncMouseButtonsStates[3];
-extern BYTE InputKeyStateTable[256];
+#include "windows.h"
+#include "win.h"
+#include "gdi.h"
+#include "keyboard.h"
+#include "message.h"
+#include "stddebug.h"
+/* #define DEBUG_KEYBOARD */
+#include "debug.h"
+#include "xmalloc.h"
+#include "accel.h"
+
+BOOL32 MouseButtonsStates[3];
+BOOL32 AsyncMouseButtonsStates[3];
+BYTE InputKeyStateTable[256];
+BYTE QueueKeyStateTable[256];
BYTE AsyncKeyStateTable[256];
-extern BYTE QueueKeyStateTable[256];
+static int NumLockMask;
+static int AltGrMask;
+static int min_keycode, max_keycode;
+static int keyc2vkey[256];
+
+typedef union
+{
+ struct
+ {
+ unsigned long count : 16;
+ unsigned long code : 8;
+ unsigned long extended : 1;
+ unsigned long unused : 2;
+ unsigned long win_internal : 2;
+ unsigned long context : 1;
+ unsigned long previous : 1;
+ unsigned long transition : 1;
+ } lp1;
+ unsigned long lp2;
+} KEYLP;
+
+typedef enum {OFF,INTERM,ON} ToggleKeyState;
+
+/* Keyboard translation tables */
+static const int special_key[] =
+{
+ VK_BACK, VK_TAB, 0, VK_CLEAR, 0, VK_RETURN, 0, 0, /* FF08 */
+ 0, 0, 0, VK_PAUSE, VK_SCROLL, 0, 0, 0, /* FF10 */
+ 0, 0, 0, VK_ESCAPE /* FF18 */
+};
+
+static const int cursor_key[] =
+{
+ VK_HOME, VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN, VK_PRIOR,
+ VK_NEXT, VK_END /* FF50 */
+};
+
+static const int misc_key[] =
+{
+ VK_SELECT, VK_SNAPSHOT, VK_EXECUTE, VK_INSERT, 0, 0, 0, 0, /* FF60 */
+ VK_CANCEL, VK_HELP, VK_CANCEL, VK_MENU /* FF68 */
+};
+
+static const int keypad_key[] =
+{
+ 0, VK_NUMLOCK, /* FF7E */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF80 */
+ 0, 0, 0, 0, 0, VK_RETURN, 0, 0, /* FF88 */
+ 0, 0, 0, 0, 0, VK_HOME, VK_LEFT, VK_UP, /* FF90 */
+ VK_RIGHT, VK_DOWN, VK_PRIOR, VK_NEXT, VK_END, 0,
+ VK_INSERT, VK_DELETE, /* FF98 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FFA0 */
+ 0, 0, VK_MULTIPLY, VK_ADD, VK_SEPARATOR, VK_SUBTRACT,
+ VK_DECIMAL, VK_DIVIDE, /* FFA8 */
+ VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4,
+ VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, /* FFB0 */
+ VK_NUMPAD8, VK_NUMPAD9 /* FFB8 */
+};
+
+static const int function_key[] =
+{
+ VK_F1, VK_F2, /* FFBE */
+ VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, /* FFC0 */
+ VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16 /* FFC8 */
+};
+
+static const int modifier_key[] =
+{
+ VK_SHIFT, VK_SHIFT, VK_CONTROL, VK_CONTROL, VK_CAPITAL, 0, /* FFE1 */
+ VK_MENU, VK_MENU, VK_MENU, VK_MENU /* FFE7 */
+};
+
+
+static WORD EVENT_event_to_vkey( XKeyEvent *e)
+{
+ KeySym keysym;
+
+ XLookupString(e, NULL, 0, &keysym, NULL);
+
+ if ((keysym >= 0xFFAE) && (keysym <= 0xFFB9) && (e->state & NumLockMask))
+ /* Only the Keypad keys 0-9 and . send different keysyms
+ * depending on the NumLock state */
+ return keypad_key[(keysym & 0xFF) - 0x7E];
+
+ return keyc2vkey[e->keycode];
+}
+
+/**********************************************************************
+ * KEYBOARD_Init
+ */
+BOOL32 KEYBOARD_Init(void)
+{
+ int i, keysyms_per_keycode;
+ KeySym *ksp;
+ XModifierKeymap *mmp;
+ KeySym keysym;
+ KeyCode *kcp;
+ XKeyEvent e2;
+ WORD vkey, OEMvkey;
+
+ XDisplayKeycodes(display, &min_keycode, &max_keycode);
+ ksp = XGetKeyboardMapping(display, min_keycode,
+ max_keycode + 1 - min_keycode, &keysyms_per_keycode);
+ /* We are only interested in keysyms_per_keycode.
+ There is no need to hold a local copy of the keysyms table */
+ XFree(ksp);
+ mmp = XGetModifierMapping(display);
+ kcp = mmp->modifiermap;
+ for (i = 0; i < 8; i += 1) /* There are 8 modifier keys */
+ {
+ int j;
+
+ for (j = 0; j < mmp->max_keypermod; j += 1, kcp += 1)
+ if (*kcp)
+ {
+ int k;
+
+ for (k = 0; k < keysyms_per_keycode; k += 1)
+ if (XKeycodeToKeysym(display, *kcp, k) == XK_Mode_switch)
+ {
+ AltGrMask = 1 << i;
+ dprintf_key(stddeb, "AltGrMask is %x\n", AltGrMask);
+ }
+ else if (XKeycodeToKeysym(display, *kcp, k) == XK_Num_Lock)
+ {
+ NumLockMask = 1 << i;
+ dprintf_key(stddeb, "NumLockMask is %x\n", NumLockMask);
+ }
+ }
+ }
+ XFreeModifiermap(mmp);
+
+ /* Now build two conversion arrays :
+ * keycode -> vkey + extended
+ * vkey + extended -> keycode */
+
+ e2.display = display;
+ e2.state = 0;
+
+ OEMvkey = 0xb9; /* first OEM virtual key available is ba */
+ for (e2.keycode=min_keycode; e2.keycode<=max_keycode; e2.keycode++)
+ {
+ XLookupString(&e2, NULL, 0, &keysym, NULL);
+ vkey = 0;
+ if (keysym) /* otherwise, keycode not used */
+ {
+ if ((keysym >> 8) == 0xFF) /* non-character key */
+ {
+ int key = keysym & 0xff;
+
+ if (key >= 0x08 && key <= 0x1B) /* special key */
+ vkey = special_key[key - 0x08];
+ else if (key >= 0x50 && key <= 0x57) /* cursor key */
+ vkey = cursor_key[key - 0x50];
+ else if (key >= 0x60 && key <= 0x6B) /* miscellaneous key */
+ vkey = misc_key[key - 0x60];
+ else if (key >= 0x7E && key <= 0xB9) /* keypad key */
+ vkey = keypad_key[key - 0x7E];
+ else if (key >= 0xBE && key <= 0xCD) /* function key */
+ {
+ vkey = function_key[key - 0xBE];
+ vkey |= 0x100; /* set extended bit */
+ }
+ else if (key >= 0xE1 && key <= 0xEA) /* modifier key */
+ vkey = modifier_key[key - 0xE1];
+ else if (key == 0xFF) /* DEL key */
+ vkey = VK_DELETE;
+ /* extended must also be set for ALT_R, CTRL_R,
+ INS, DEL, HOME, END, PAGE_UP, PAGE_DOWN, ARROW keys,
+ keypad / and keypad ENTER (SDK 3.1 Vol.3 p 138) */
+ /* FIXME should we set extended bit for NumLock ? My
+ * Windows does ... DF */
+ switch (keysym)
+ {
+ case XK_Control_R :
+ case XK_Alt_R :
+ case XK_Insert :
+ case XK_Delete :
+ case XK_Home :
+ case XK_End :
+ case XK_Prior :
+ case XK_Next :
+ case XK_Left :
+ case XK_Up :
+ case XK_Right :
+ case XK_Down :
+ case XK_KP_Divide :
+ case XK_KP_Enter :
+ vkey |= 0x100;
+ }
+ }
+ for (i = 0; (i < keysyms_per_keycode) && (!vkey); i++)
+ {
+ keysym = XLookupKeysym(&e2, i);
+ if ((keysym >= VK_0 && keysym <= VK_9)
+ || (keysym >= VK_A && keysym <= VK_Z)
+ || keysym == VK_SPACE)
+ vkey = keysym;
+ }
+
+ if (!vkey)
+ {
+ /* Others keys: let's assign OEM virtual key codes in the allowed range,
+ * that is ([0xba,0xc0], [0xdb,0xe4], 0xe6 (given up) et [0xe9,0xf5]) */
+ switch (++OEMvkey)
+ {
+ case 0xc1 : OEMvkey=0xdb; break;
+ case 0xe5 : OEMvkey=0xe9; break;
+ case 0xf6 : OEMvkey=0xf5; fprintf(stderr,"No more OEM vkey available!\n");
+ }
+
+ vkey = OEMvkey;
+
+ if (debugging_keyboard)
+ {
+ fprintf(stddeb,"OEM specific virtual key %X assigned to keycode %X :\n ("
+ ,OEMvkey,e2.keycode);
+ for (i = 0; i < keysyms_per_keycode; i += 1)
+ {
+ char *ksname;
+
+ keysym = XLookupKeysym(&e2, i);
+ ksname = XKeysymToString(keysym);
+ if (!ksname)
+ ksname = "NoSymbol";
+ fprintf(stddeb, "%lX (%s) ", keysym, ksname);
+ }
+ fprintf(stddeb, ")\n");
+ }
+ }
+ }
+ keyc2vkey[e2.keycode] = vkey;
+ } /* for */
+ return TRUE;
+}
+
+
+/***********************************************************************
+ * KEYBOARD_HandleEvent
+ *
+ * Handle a X key event
+ */
+void KEYBOARD_HandleEvent( XKeyEvent *event )
+{
+ char Str[24];
+ XComposeStatus cs;
+ KeySym keysym;
+ WORD vkey = 0;
+ KEYLP keylp;
+ WORD message;
+ static BOOL force_extended = FALSE; /* hack for AltGr translation */
+ BOOL DontPropagate;
+ ToggleKeyState * State;
+ static ToggleKeyState NumState=OFF, CapsState=OFF;
+
+ int ascii_chars = XLookupString(event, Str, 1, &keysym, &cs);
+
+ dprintf_key(stddeb, "EVENT_key : state = %X\n", event->state);
+ if (keysym == XK_Mode_switch)
+ {
+ dprintf_key(stddeb, "Alt Gr key event received\n");
+ event->keycode = XKeysymToKeycode(event->display, XK_Control_L);
+ dprintf_key(stddeb, "Control_L is keycode 0x%x\n", event->keycode);
+ KEYBOARD_HandleEvent(event);
+ event->keycode = XKeysymToKeycode(event->display, XK_Alt_L);
+ dprintf_key(stddeb, "Alt_L is keycode 0x%x\n", event->keycode);
+ force_extended = TRUE;
+ KEYBOARD_HandleEvent(event);
+ force_extended = FALSE;
+ return;
+ }
+
+ Str[ascii_chars] = '\0';
+ if (debugging_key)
+ {
+ char *ksname;
+
+ ksname = XKeysymToString(keysym);
+ if (!ksname)
+ ksname = "No Name";
+ fprintf(stddeb, "%s : keysym=%lX (%s), ascii chars=%u / %X / '%s'\n",
+ (event->type == KeyPress) ? "KeyPress" : "KeyRelease",
+ keysym, ksname, ascii_chars, Str[0] & 0xff, Str);
+ }
+
+#if 0
+ /* Ctrl-Alt-Return enters the debugger */
+ if ((keysym == XK_Return) && (event->type == KeyPress) &&
+ (event->state & ControlMask) && (event->state & Mod1Mask))
+ DEBUG_EnterDebugger();
+#endif
+
+ vkey = EVENT_event_to_vkey(event);
+ if (force_extended) vkey |= 0x100;
+
+ dprintf_key(stddeb, "keycode 0x%x converted to vkey 0x%x\n",
+ event->keycode, vkey);
+
+ if (vkey)
+ {
+ keylp.lp1.count = 1;
+ keylp.lp1.code = LOBYTE(event->keycode) - 8;
+ keylp.lp1.extended = (vkey & 0x100 ? 1 : 0);
+ keylp.lp1.win_internal = 0; /* this has something to do with dialogs,
+ * don't remember where I read it - AK */
+ /* it's '1' under windows, when a dialog box appears
+ * and you press one of the underlined keys - DF*/
+ vkey &= 0xff;
+ if (event->type == KeyPress)
+ {
+ keylp.lp1.previous = (InputKeyStateTable[vkey] & 0x80) != 0;
+ if (!(InputKeyStateTable[vkey] & 0x80))
+ InputKeyStateTable[vkey] ^= 0x01;
+ InputKeyStateTable[vkey] |= 0x80;
+ keylp.lp1.transition = 0;
+ message = (InputKeyStateTable[VK_MENU] & 0x80)
+ && !(InputKeyStateTable[VK_CONTROL] & 0x80)
+ ? WM_SYSKEYDOWN : WM_KEYDOWN;
+ }
+ else
+ {
+ UINT sysKey = (InputKeyStateTable[VK_MENU] & 0x80)
+ && !(InputKeyStateTable[VK_CONTROL] & 0x80)
+ && (force_extended == FALSE); /* for Alt from AltGr */
+
+ InputKeyStateTable[vkey] &= ~0x80;
+ keylp.lp1.previous = 1;
+ keylp.lp1.transition = 1;
+ message = sysKey ? WM_SYSKEYUP : WM_KEYUP;
+ }
+ keylp.lp1.context = ( (event->state & Mod1Mask) ||
+ (InputKeyStateTable[VK_MENU] & 0x80)) ? 1 : 0;
+ DontPropagate = FALSE;
+ if ((vkey==VK_NUMLOCK) || (vkey==VK_CAPITAL))
+ {
+
+ switch (*( State = (vkey==VK_NUMLOCK? &NumState : &CapsState))) {
+ case OFF:if (event->type==KeyPress)
+ {
+ dprintf_keyboard(stddeb,"OFF + Keypress => DOWN and UP generated. \n");
+ hardware_event( message, vkey, keylp.lp2, event->x_root - desktopX,
+ event->y_root - desktopY, event->time - MSG_WineStartTicks, 0);
+ message += WM_KEYUP - WM_KEYDOWN; /* create a *UP message from the *DOWN one */
+ keylp.lp1.previous = 1;
+ keylp.lp1.transition = 1;
+ *State = INTERM;
+ } break;
+ case INTERM:
+ /* The 'INTERM' state means : just after a 'press' event, if a 'release' event comes,
+ don't "propagate" it. It's from the same key press. Then the state goes to ON.
+ And from there, a 'release' event will switch off the toggle key. */
+ DontPropagate = TRUE;
+ *State=ON;
+ InputKeyStateTable[vkey] |= 0x01; /* force to 'on' event if a release event was received */
+ dprintf_keyboard(stddeb,"INTERM : don\'t propagate press/release of toggle key. InputKeyStateTable[%#x] = %#x",vkey,InputKeyStateTable[vkey]);
+ break;
+ case ON: if (event->type==KeyPress) DontPropagate = TRUE; else
+ {
+ KEYLP downkeylp = keylp;
+ dprintf_keyboard(stddeb,"ON + KeyRelease => generating DOWN msg before the UP\n");
+ message += WM_KEYDOWN - WM_KEYUP; /* create the *DOWN from the *UP */
+ downkeylp.lp1.previous = 0; /* ? */
+ downkeylp.lp1.transition = 0;
+ hardware_event( message, vkey, downkeylp.lp2, event->x_root - desktopX,
+ event->y_root - desktopY, event->time - MSG_WineStartTicks, 0);
+ message += WM_KEYUP - WM_KEYDOWN; /* back to the UP message */
+ *State=OFF;
+ } break;
+ }
+ dprintf_keyboard(stddeb,"Internal State : %d (0=OFF 1=INTERM 2=ON). InputTable state : %#x \n",*State,InputKeyStateTable[vkey]);
+ } else {
+ if (NumState == INTERM) NumState = ON;
+ if (CapsState == INTERM) CapsState = ON;
+ }
+
+ if (!DontPropagate)
+ {
+ dprintf_key(stddeb," wParam=%04X, lParam=%08lX\n",
+ vkey, keylp.lp2 );
+ dprintf_key(stddeb," InputKeyState=%X\n",
+ InputKeyStateTable[vkey]);
+
+ hardware_event( message, vkey, keylp.lp2, event->x_root - desktopX,
+ event->y_root - desktopY, event->time - MSG_WineStartTicks, 0 );
+ }
+ }
+}
+
/**********************************************************************
* GetKeyState [USER.106]
@@ -201,7 +603,7 @@
if (GetCapture16())
mesg=2;
else
- if (!IsWindowEnabled(hWnd))
+ if (!IsWindowEnabled16(hWnd))
mesg=3;
else
{
@@ -226,7 +628,7 @@
{
if (iStat!=-1)
{
- if (IsIconic(hWnd))
+ if (IsIconic32(hWnd))
mesg=5;
else
{
@@ -268,3 +670,264 @@
GlobalUnlock16(hAccel);
return 0;
}
+
+
+DWORD OemKeyScan(WORD wOemChar)
+{
+ dprintf_keyboard(stddeb,"*OemKeyScan (%d)\n",wOemChar);
+
+ return wOemChar;
+}
+
+/* VkKeyScan translates an ANSI character to a virtual-key and shift code
+ * for the current keyboard.
+ * FIXME high-order byte should yield :
+ * 0 Unshifted
+ * 1 Shift
+ * 2 Ctrl
+ * 3-5 Shift-key combinations that are not used for characters
+ * 6 Ctrl-Alt
+ * 7 Ctrl-Alt-Shift
+ * I.e. : Shift = 1, Ctrl = 2, Alt = 4.
+ */
+
+WORD VkKeyScan(WORD cChar)
+{
+ KeyCode keycode;
+ dprintf_keyboard(stddeb,"VkKeyScan '%c'(%d) ",cChar,cChar);
+
+/* let's do this : char = keysym (for ANSI chars) -> keyc [ + shift ... (?? how ??)]
+keyc -> (keyc2vkey) vkey */
+
+ keycode = XKeysymToKeycode(display, cChar & 0xFF);
+
+ dprintf_keyboard(stddeb," ... got keycode 0x%x ... returning 0x%x\n",
+ keycode,keyc2vkey[keycode]);
+ return keyc2vkey[keycode];
+}
+
+WORD VkKeyScan32W(WORD cChar)
+{
+ /* lower part of cChar is used anyway */
+ return VkKeyScan(cChar);
+}
+
+int GetKeyboardType(int nTypeFlag)
+{
+ dprintf_keyboard(stddeb,"GetKeyboardType(%d)\n",nTypeFlag);
+ switch(nTypeFlag)
+ {
+ case 0: /* Keyboard type */
+ return 4; /* AT-101 */
+ break;
+ case 1: /* Keyboard Subtype */
+ return 0; /* There are no defined subtypes */
+ break;
+ case 2: /* Number of F-keys */
+ return 12; /* We're doing an 101 for now, so return 12 F-keys */
+ break;
+ default:
+ fprintf(stderr, "Unknown type on GetKeyboardType\n");
+ return 0; /* The book says 0 here, so 0 */
+ }
+}
+
+/* MapVirtualKey translates keycodes from one format to another. */
+
+WORD MapVirtualKey(WORD wCode, WORD wMapType)
+{
+#define returnMVK(value) { dprintf_keyboard(stddeb,"returning 0x%x.\n",value); return value; }
+
+ dprintf_keyboard(stddeb,"MapVirtualKey wCode=0x%x wMapType=%d ... ",wCode,wMapType);
+ switch(wMapType) {
+ case 0: { /* vkey-code to scan-code */
+ /* let's do vkey -> keycode -> scan */
+ KeyCode keyc;
+ for (keyc=min_keycode; keyc<=max_keycode; keyc++) /* see event.c */
+ if ((keyc2vkey[keyc] & 0xFF)== wCode)
+ returnMVK (keyc - 8);
+ return 0; }
+
+ case 1: /* scan-code to vkey-code */
+ /* let's do scan -> keycode -> vkey */
+
+ returnMVK (keyc2vkey[(wCode & 0xFF) + 8]);
+
+ case 2: { /* vkey-code to unshifted ANSI code */
+ /* (was FIXME) : what does unshifted mean ? 'a' or 'A' ? */
+ /* My Windows returns 'A'. */
+ /* let's do vkey -> keycode -> (XLookupString) ansi char */
+ XKeyEvent e;
+ KeySym keysym;
+ char s[2];
+ e.display = display;
+ e.state = 0; /* unshifted */
+ e.keycode = MapVirtualKey( wCode, 0);
+ if (!XLookupString(&e, s , 2 , &keysym, NULL))
+ returnMVK (*s);
+
+ return 0;
+ }
+ default: /* reserved */
+ fprintf(stderr, "MapVirtualKey: unknown wMapType %d !\n",
+ wMapType);
+ return 0;
+ }
+ return 0;
+}
+
+int GetKbCodePage(void)
+{
+ dprintf_keyboard(stddeb,"GetKbCodePage()\n");
+ return 850;
+}
+
+/****************************************************************************
+ * GetKeyNameText32W (USER32.247)
+ */
+INT32 GetKeyNameText32W(LONG lParam, LPWSTR lpBuffer, INT32 nSize)
+{
+ LPSTR buf = xmalloc(nSize);
+ int res = GetKeyNameText32A(lParam,buf,nSize);
+
+ lstrcpynAtoW(lpBuffer,buf,nSize);
+ free(buf);
+ return res;
+}
+
+/****************************************************************************
+ * GetKeyNameText32A (USER32.246)
+ */
+INT32 GetKeyNameText32A(LONG lParam, LPSTR lpBuffer, INT32 nSize)
+{
+ return GetKeyNameText16(lParam,lpBuffer,nSize);
+}
+
+/****************************************************************************
+ * GetKeyNameText16 (KEYBOARD.133)
+ */
+INT16 GetKeyNameText16(LONG lParam, LPSTR lpBuffer, INT16 nSize)
+{
+ /* int i; */
+
+ dprintf_keyboard(stddeb,"GetKeyNameText(%ld,<ptr>,%d)\n",lParam,nSize);
+
+ lParam >>= 16;
+ lParam &= 0xff;
+
+ /* for (i = 0 ; i != KeyTableSize ; i++)
+ if (KeyTable[i].scancode == lParam) {
+ lstrcpyn32A( lpBuffer, KeyTable[i].name, nSize );
+ return strlen(lpBuffer);
+ }
+ */
+ /* FIXME ! GetKeyNameText is still to do...
+ */
+ *lpBuffer = 0;
+ return 0;
+}
+
+int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
+ LPVOID lpChar, WORD wFlags)
+{
+ XKeyEvent e;
+ KeySym keysym;
+ static XComposeStatus cs;
+ int ret;
+ WORD keyc;
+
+ e.display = display;
+ e.keycode = 0;
+ for (keyc=min_keycode; keyc<=max_keycode; keyc++)
+ { /* this could be speeded up by making another table, an array of struct vkey,keycode
+ * (vkey -> keycode) with vkeys sorted .... but it takes memory (512*3 bytes)! DF */
+ if ((keyc2vkey[keyc] & 0xFF)== wVirtKey) /* no need to make a more precise test (with the extended bit correctly set above wVirtKey ... VK* are different enough... */
+ {
+ if ((e.keycode) && ((wVirtKey<0x10) || (wVirtKey>0x12)))
+ /* it's normal to have 2 shift, control, and alt ! */
+ dprintf_keyboard(stddeb,"ToAscii : The keycodes %X and %X are matching the same vkey %X\n",
+ e.keycode,keyc,wVirtKey);
+ e.keycode = keyc;
+ }
+ }
+ if ((!e.keycode) && (lpKeyState[VK_NUMLOCK] & 0x01))
+ {
+ if ((wVirtKey>=VK_NUMPAD0) && (wVirtKey<=VK_NUMPAD9))
+ e.keycode = XKeysymToKeycode(e.display, wVirtKey-VK_NUMPAD0+XK_KP_0);
+ if (wVirtKey==VK_DECIMAL)
+ e.keycode = XKeysymToKeycode(e.display, XK_KP_Decimal);
+ }
+ if (!e.keycode)
+ {
+ fprintf(stderr,"ToAscii : Unknown virtual key %X !!! \n",wVirtKey);
+ return wVirtKey; /* whatever */
+ }
+ e.state = 0;
+ if (lpKeyState[VK_SHIFT] & 0x80)
+ e.state |= ShiftMask;
+ dprintf_keyboard(stddeb,"ToAscii : lpKeyState[0x14(VK_CAPITAL)]=%#x\n",lpKeyState[VK_CAPITAL]);
+ if (lpKeyState[VK_CAPITAL] & 0x01)
+ e.state |= LockMask;
+ if (lpKeyState[VK_CONTROL] & 0x80)
+ if (lpKeyState[VK_MENU] & 0x80)
+ e.state |= AltGrMask;
+ else
+ e.state |= ControlMask;
+ if (lpKeyState[VK_NUMLOCK] & 0x01)
+ e.state |= NumLockMask;
+ dprintf_key(stddeb, "ToAscii(%04X, %04X) : faked state = %X\n",
+ wVirtKey, wScanCode, e.state);
+ ret = XLookupString(&e, lpChar, 2, &keysym, &cs);
+ if (ret == 0)
+ {
+ BYTE dead_char = 0;
+
+ ((char*)lpChar)[1] = '\0';
+ switch (keysym)
+ {
+ case XK_dead_tilde :
+ case 0x1000FE7E : /* Xfree's XK_Dtilde */
+ dead_char = '~';
+ break;
+ case XK_dead_acute :
+ case 0x1000FE27 : /* Xfree's XK_Dacute_accent */
+ dead_char = 0xb4;
+ break;
+ case XK_dead_circumflex :
+ case 0x1000FE5E : /* Xfree's XK_Dcircumflex_accent */
+ dead_char = '^';
+ break;
+ case XK_dead_grave :
+ case 0x1000FE60 : /* Xfree's XK_Dgrave_accent */
+ dead_char = '`';
+ break;
+ case XK_dead_diaeresis :
+ case 0x1000FE22 : /* Xfree's XK_Ddiaeresis */
+ dead_char = 0xa8;
+ break;
+ }
+ if (dead_char)
+ {
+ *(char*)lpChar = dead_char;
+ ret = -1;
+ }
+ else
+ {
+ char *ksname;
+
+ ksname = XKeysymToString(keysym);
+ if (!ksname)
+ ksname = "No Name";
+ if ((keysym >> 8) != 0xff)
+ {
+ fprintf(stderr, "Please report : no char for keysym %04lX (%s) :\n",
+ keysym, ksname);
+ fprintf(stderr, " wVirtKey = %X, wScanCode = %X, keycode = %X, state = %X\n",
+ wVirtKey, wScanCode, e.keycode, e.state);
+ }
+ }
+ }
+ dprintf_key(stddeb, "ToAscii about to return %d with char %x\n",
+ ret, *(char*)lpChar);
+ return ret;
+}
diff --git a/windows/mdi.c b/windows/mdi.c
index f6e5bac..558f9ce 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -284,7 +284,7 @@
*/
WORD MDIIconArrange(HWND parent)
{
- return ArrangeIconicWindows(parent); /* Any reason why the */
+ return ArrangeIconicWindows16(parent); /* Any reason why the */
/* existing icon arrange */
/* can't be used here? */
/* -DRP */
@@ -333,7 +333,7 @@
if( style & WS_MAXIMIZE )
SendMessage16(w->hwndSelf, WM_SETREDRAW, FALSE, 0L );
hwndMax = ci->hwndChildMaximized;
- ShowWindow( hwndMax, SW_SHOWNOACTIVATE );
+ ShowWindow16( hwndMax, SW_SHOWNOACTIVATE );
if( style & WS_MAXIMIZE )
SendMessage16(w->hwndSelf, WM_SETREDRAW, TRUE, 0L );
}
@@ -365,10 +365,10 @@
MDI_MenuModifyItem(w ,hwnd);
if( wnd->dwStyle & WS_MINIMIZE && ci->hwndActiveChild )
- ShowWindow( hwnd, SW_SHOWMINNOACTIVE );
+ ShowWindow16( hwnd, SW_SHOWMINNOACTIVE );
else
{
- SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
+ SetWindowPos32( hwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
/* Set maximized state here in case hwnd didn't receive WM_SIZE
* during CreateWindow - bad!
@@ -388,7 +388,7 @@
ci->nActiveChildren--;
DeleteMenu32(ci->hWindowMenu,wIDmenu,MF_BYCOMMAND);
if( IsWindow(hwndMax) )
- ShowWindow(hwndMax, SW_SHOWMAXIMIZED);
+ ShowWindow16(hwndMax, SW_SHOWMAXIMIZED);
}
return hwnd;
@@ -453,16 +453,16 @@
w->dwStyle &= ~WS_VISIBLE;
}
- SetWindowPos( hwndTo, HWND_TOP, 0, 0, 0, 0,
+ SetWindowPos32( hwndTo, HWND_TOP, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE );
if( !wTo && hwndPrev )
{
- SetWindowPos( hwndPrev, HWND_BOTTOM, 0, 0, 0, 0,
+ SetWindowPos32( hwndPrev, HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
if( bOptimize )
- ShowWindow( clientHwnd, SW_SHOW );
+ ShowWindow16( clientHwnd, SW_SHOW );
}
}
@@ -483,7 +483,7 @@
if( child == ci->hwndActiveChild )
{
- ShowWindow( child, SW_HIDE);
+ ShowWindow16( child, SW_HIDE);
if( child == ci->hwndChildMaximized )
{
MDI_RestoreFrameMenu(w_parent->parent, child);
@@ -502,8 +502,8 @@
if (flagDestroy)
{
- MDI_PostUpdate(GetParent16(child), ci, SB_BOTH+1);
- DestroyWindow(child);
+ MDI_PostUpdate(GetParent16(child), ci, SB_BOTH+1);
+ DestroyWindow32(child);
}
}
@@ -531,7 +531,7 @@
dprintf_mdi(stddeb,"MDI_ChildActivate: %04x\n", hWndChild);
- if( GetActiveWindow() == clientPtr->parent->hwndSelf )
+ if( GetActiveWindow32() == clientPtr->parent->hwndSelf )
isActiveFrameWnd = TRUE;
/* deactivate prev. active child */
@@ -560,10 +560,10 @@
if( hWndChild )
{
clientInfo->hwndActiveChild = hWndChild;
- ShowWindow( hWndChild, SW_SHOWMAXIMIZED);
+ ShowWindow16( hWndChild, SW_SHOWMAXIMIZED);
}
else
- ShowWindow( clientInfo->hwndActiveChild,
+ ShowWindow16( clientInfo->hwndActiveChild,
SW_SHOWNORMAL );
clientInfo->hwndActiveChild = hWndChild;
@@ -582,7 +582,7 @@
wndPtr->wIDmenu, MF_CHECKED);
/* bring active child to the top */
- SetWindowPos( hWndChild, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
+ SetWindowPos32( hWndChild, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
if( isActiveFrameWnd )
{
@@ -696,7 +696,7 @@
POINT16 pos[2];
if (ci->hwndChildMaximized)
- ShowWindow( ci->hwndChildMaximized, SW_NORMAL);
+ ShowWindow16( ci->hwndChildMaximized, SW_NORMAL);
if (ci->nActiveChildren == 0) return 0;
@@ -714,8 +714,8 @@
if( listTop->hChild )
{
MDI_CalcDefaultChildPos(clientWnd, n++, pos, delta);
- SetWindowPos(listTop->hChild, 0, pos[0].x, pos[0].y, pos[1].x, pos[1].y,
- SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER);
+ SetWindowPos32(listTop->hChild, 0, pos[0].x, pos[0].y, pos[1].x, pos[1].y,
+ SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER);
}
listPrev = listTop->prev;
@@ -724,7 +724,7 @@
}
if( iToPosition < ci->nActiveChildren )
- ArrangeIconicWindows( clientWnd->hwndSelf );
+ ArrangeIconicWindows32( clientWnd->hwndSelf );
return 0;
}
@@ -745,7 +745,7 @@
INT16 iToPosition = 0;
if (ci->hwndChildMaximized)
- ShowWindow(ci->hwndChildMaximized, SW_NORMAL);
+ ShowWindow16(ci->hwndChildMaximized, SW_NORMAL);
if (ci->nActiveChildren == 0) return 0;
@@ -804,8 +804,8 @@
free(listTop);
listTop = listPrev;
}
- SetWindowPos(listTop->hChild, 0, x, y, xsize, ysize,
- SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER);
+ SetWindowPos32(listTop->hChild, 0, x, y, xsize, ysize,
+ SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER);
y += ysize;
listPrev = listTop->prev;
free(listTop);
@@ -824,7 +824,7 @@
}
if (iToPosition < ci->nActiveChildren )
- ArrangeIconicWindows( wndClient->hwndSelf );
+ ArrangeIconicWindows32( wndClient->hwndSelf );
return 0;
}
@@ -959,8 +959,8 @@
DEFWND_SetText( frameWnd, lpBuffer );
if( repaint == MDI_REPAINTFRAME)
- SetWindowPos(frameWnd->hwndSelf, 0,0,0,0,0, SWP_FRAMECHANGED |
- SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER );
+ SetWindowPos32(frameWnd->hwndSelf, 0,0,0,0,0, SWP_FRAMECHANGED |
+ SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER );
}
@@ -1029,7 +1029,7 @@
case WM_MDIACTIVATE:
if( ci->hwndActiveChild != (HWND)wParam )
- SetWindowPos((HWND)wParam, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
+ SetWindowPos32((HWND)wParam, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
return 0;
case WM_MDICASCADE:
@@ -1053,7 +1053,7 @@
return 0;
case WM_MDIMAXIMIZE:
- ShowWindow((HWND)wParam, SW_MAXIMIZE);
+ ShowWindow16((HWND16)wParam, SW_MAXIMIZE);
return 0;
case WM_MDINEXT:
@@ -1061,7 +1061,7 @@
break;
case WM_MDIRESTORE:
- ShowWindow( (HWND)wParam, SW_NORMAL);
+ ShowWindow16( (HWND16)wParam, SW_NORMAL);
return 0;
case WM_MDISETMENU:
@@ -1115,7 +1115,7 @@
if( wnd->owner ) child = wnd->owner->hwndSelf;
if( child != ci->hwndActiveChild )
- SetWindowPos(child, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
+ SetWindowPos32(child, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
}
}
return 0;
@@ -1127,8 +1127,8 @@
RECT16 rect = { 0, 0, LOWORD(lParam), HIWORD(lParam) };
AdjustWindowRectEx16(&rect, child->dwStyle, 0, child->dwExStyle);
- MoveWindow(ci->hwndChildMaximized, rect.left, rect.top,
- rect.right - rect.left, rect.bottom - rect.top, 1);
+ MoveWindow16(ci->hwndChildMaximized, rect.left, rect.top,
+ rect.right - rect.left, rect.bottom - rect.top, 1);
}
else
MDI_PostUpdate(hwnd, ci, SB_BOTH+1);
@@ -1213,8 +1213,8 @@
break;
case WM_SIZE:
- MoveWindow(hwndMDIClient, 0, 0,
- LOWORD(lParam), HIWORD(lParam), TRUE);
+ MoveWindow16(hwndMDIClient, 0, 0,
+ LOWORD(lParam), HIWORD(lParam), TRUE);
break;
case WM_NEXTMENU:
@@ -1414,7 +1414,7 @@
SendMessage16( hMaxChild, WM_SETREDRAW, FALSE, 0L );
MDI_RestoreFrameMenu( clientWnd->parent, hMaxChild);
- ShowWindow( hMaxChild, SW_SHOWNOACTIVATE);
+ ShowWindow16( hMaxChild, SW_SHOWNOACTIVATE);
SendMessage16( hMaxChild, WM_SETREDRAW, TRUE, 0L );
}
@@ -1640,8 +1640,8 @@
case SB_BOTH:
SCROLL_SetNCSbState( Wnd, vmin, vmax, vpos,
hmin, hmax, hpos);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
- | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
+ SetWindowPos32(hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
+ | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
}
}
diff --git a/windows/message.c b/windows/message.c
index 203d7e8..7358f4b 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -16,6 +16,7 @@
#include "sysmetrics.h"
#include "heap.h"
#include "hook.h"
+#include "keyboard.h"
#include "spy.h"
#include "winpos.h"
#include "atom.h"
@@ -35,13 +36,6 @@
typedef enum { SYSQ_MSG_ABANDON, SYSQ_MSG_SKIP,
SYSQ_MSG_ACCEPT, SYSQ_MSG_CONTINUE } SYSQ_STATUS;
-extern BOOL MouseButtonsStates[3];
-extern BOOL AsyncMouseButtonsStates[3];
-extern BYTE InputKeyStateTable[256];
-extern BYTE AsyncKeyStateTable[256];
-
-BYTE QueueKeyStateTable[256];
-
extern MESSAGEQUEUE *pCursorQueue; /* queue.c */
extern MESSAGEQUEUE *pActiveQueue;
@@ -121,7 +115,7 @@
/* check if hWnd is within hWndScope */
if( hWndScope && hWnd != hWndScope )
- if( !IsChild(hWndScope, hWnd) ) return SYSQ_MSG_CONTINUE;
+ if( !IsChild16(hWndScope, hWnd) ) return SYSQ_MSG_CONTINUE;
if( mouseClick )
{
@@ -203,7 +197,7 @@
/* Activate the window if needed */
- if (hWnd != GetActiveWindow() && hWnd != GetDesktopWindow16())
+ if (hWnd != GetActiveWindow16() && hWnd != GetDesktopWindow16())
{
LONG ret = SendMessage16( hWnd, WM_MOUSEACTIVATE, hwndTop,
MAKELONG( hittest, message ) );
@@ -212,7 +206,7 @@
eatMsg = TRUE;
if (((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT))
- && hwndTop != GetActiveWindow() )
+ && hwndTop != GetActiveWindow16() )
if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE ))
eatMsg = TRUE;
}
@@ -252,7 +246,7 @@
/* Send the message to the active window instead, */
/* translating messages to their WM_SYS equivalent */
- hWnd = GetActiveWindow();
+ hWnd = GetActiveWindow16();
if( message < WM_SYSKEYDOWN )
message += WM_SYSKEYDOWN - WM_KEYDOWN;
@@ -270,7 +264,7 @@
}
if (hWndScope && hWnd != hWndScope)
- if (!IsChild(hWndScope, hWnd)) return SYSQ_MSG_CONTINUE;
+ if (!IsChild16(hWndScope, hWnd)) return SYSQ_MSG_CONTINUE;
if (!MSG_CheckFilter(message, filter)) return SYSQ_MSG_CONTINUE;
msg->hwnd = hWnd;
@@ -760,7 +754,7 @@
msg->wParam = 1;
}
- if( !hwnd || msg->hwnd == hwnd || IsChild(hwnd,msg->hwnd) )
+ if( !hwnd || msg->hwnd == hwnd || IsChild16(hwnd,msg->hwnd) )
{
if( wndPtr->flags & WIN_INTERNAL_PAINT && !wndPtr->hrgnUpdate)
{
diff --git a/windows/msgbox.c b/windows/msgbox.c
index 40d9344..f5a5d26 100644
--- a/windows/msgbox.c
+++ b/windows/msgbox.c
@@ -42,33 +42,33 @@
case WM_INITDIALOG:
lpmb = (LPMSGBOX)lParam;
if (lpmb->title) SetWindowText32A(hwnd, lpmb->title);
- SetWindowText32A(GetDlgItem(hwnd, 100), lpmb->text);
+ SetWindowText32A(GetDlgItem32(hwnd, 100), lpmb->text);
/* Hide not selected buttons */
switch(lpmb->type & MB_TYPEMASK) {
case MB_OK:
- ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 2), SW_HIDE);
/* fall through */
case MB_OKCANCEL:
- ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 3), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 4), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 5), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 6), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 7), SW_HIDE);
break;
case MB_ABORTRETRYIGNORE:
- ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 1), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 2), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 6), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 7), SW_HIDE);
break;
case MB_YESNO:
- ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 2), SW_HIDE);
/* fall through */
case MB_YESNOCANCEL:
- ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
- ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 1), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 3), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 4), SW_HIDE);
+ ShowWindow32(GetDlgItem32(hwnd, 5), SW_HIDE);
break;
}
/* Set the icon */
@@ -100,23 +100,23 @@
borheight -= rect.bottom - rect.top;
/* Get the icon height */
- GetWindowRect32(GetDlgItem(hwnd, 1088), &rect);
+ GetWindowRect32(GetDlgItem32(hwnd, 1088), &rect);
iheight = rect.bottom - rect.top;
/* Get the number of visible buttons and their width */
- GetWindowRect32(GetDlgItem(hwnd, 2), &rect);
+ GetWindowRect32(GetDlgItem32(hwnd, 2), &rect);
bheight = rect.bottom - rect.top;
bwidth = rect.left;
- GetWindowRect32(GetDlgItem(hwnd, 1), &rect);
+ GetWindowRect32(GetDlgItem32(hwnd, 1), &rect);
bwidth -= rect.left;
for (buttons = 0, i = 1; i < 8; i++)
{
- hItem = GetDlgItem(hwnd, i);
+ hItem = GetDlgItem32(hwnd, i);
if (GetWindowLong32A(hItem, GWL_STYLE) & WS_VISIBLE) buttons++;
}
/* Get the text size */
- hItem = GetDlgItem(hwnd, 100);
+ hItem = GetDlgItem32(hwnd, 100);
GetWindowRect32(hItem, &textrect);
MapWindowPoints32(0, hwnd, (LPPOINT32)&textrect, 2);
@@ -129,34 +129,34 @@
ReleaseDC32(hItem, hdc);
/* Position the text */
- SetWindowPos(hItem, 0, textrect.left, (tiheight - theight) / 2,
- rect.right - rect.left, theight,
- SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
+ SetWindowPos32(hItem, 0, textrect.left, (tiheight - theight) / 2,
+ rect.right - rect.left, theight,
+ SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
/* Position the icon */
- hItem = GetDlgItem(hwnd, 1088);
+ hItem = GetDlgItem32(hwnd, 1088);
GetWindowRect32(hItem, &rect);
MapWindowPoints32(0, hwnd, (LPPOINT32)&rect, 2);
- SetWindowPos(hItem, 0, rect.left, (tiheight - iheight) / 2, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
+ SetWindowPos32(hItem, 0, rect.left, (tiheight - iheight) / 2, 0, 0,
+ SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
/* Resize the window */
- SetWindowPos(hwnd, 0, 0, 0, wwidth, 8 + tiheight + bheight + borheight,
- SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
+ SetWindowPos32(hwnd, 0, 0, 0, wwidth, 8 + tiheight + bheight + borheight,
+ SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
/* Position the buttons */
bpos = (wwidth - bwidth * buttons) / 2;
- GetWindowRect32(GetDlgItem(hwnd, 1), &rect);
+ GetWindowRect32(GetDlgItem32(hwnd, 1), &rect);
for (buttons = i = 0; i < 7; i++) {
/* some arithmetic to get the right order for YesNoCancel windows */
- hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
+ hItem = GetDlgItem32(hwnd, (i + 5) % 7 + 1);
if (GetWindowLong32A(hItem, GWL_STYLE) & WS_VISIBLE) {
if (buttons++ == ((lpmb->type & MB_DEFMASK) >> 8)) {
SetFocus32(hItem);
SendMessage32A( hItem, BM_SETSTYLE32, BS_DEFPUSHBUTTON, TRUE );
}
- SetWindowPos(hItem, 0, bpos, tiheight, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
+ SetWindowPos32(hItem, 0, bpos, tiheight, 0, 0,
+ SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
bpos += bwidth;
}
}
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 2f93a6a..ba5f6cc 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -465,7 +465,7 @@
if( !(wndPtr->flags & WIN_MANAGED) )
{
NC_GetInsideRect( hwnd, &rect );
- GRAPH_DrawBitmap( hdc, (IsZoomed(hwnd) ?
+ GRAPH_DrawBitmap( hdc, (IsZoomed32(hwnd) ?
(down ? hbitmapRestoreD : hbitmapRestore) :
(down ? hbitmapMaximizeD : hbitmapMaximize)),
rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
@@ -1024,7 +1024,7 @@
BOOL32 iconic = wndPtr->dwStyle & WS_MINIMIZE;
int moved = 0;
- if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) ||
+ if (IsZoomed32(hwnd) || !IsWindowVisible32(hwnd) ||
(wndPtr->flags & WIN_MANAGED)) return;
if ((wParam & 0xfff0) == SC_MOVE)
@@ -1197,7 +1197,7 @@
}
}
SendMessage16( hwnd, WM_EXITSIZEMOVE, 0, 0 );
- SendMessage16( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
+ SendMessage16( hwnd, WM_SETVISIBLE, !IsIconic16(hwnd), 0L);
/* Single click brings up the system menu when iconized */
@@ -1211,12 +1211,12 @@
if ((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) return;
if (hittest != HTCAPTION)
- SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top,
- sizingRect.right - sizingRect.left,
- sizingRect.bottom - sizingRect.top,
- SWP_NOACTIVATE | SWP_NOZORDER );
- else SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top, 0, 0,
- SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER );
+ SetWindowPos32( hwnd, 0, sizingRect.left, sizingRect.top,
+ sizingRect.right - sizingRect.left,
+ sizingRect.bottom - sizingRect.top,
+ SWP_NOACTIVATE | SWP_NOZORDER );
+ else SetWindowPos32( hwnd, 0, sizingRect.left, sizingRect.top, 0, 0,
+ SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER );
}
@@ -1259,7 +1259,7 @@
SendMessage16( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, *(LONG*)&msg.pt );
else
SendMessage16( hwnd, WM_SYSCOMMAND,
- IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, *(LONG*)&msg.pt );
+ IsZoomed32(hwnd) ? SC_RESTORE:SC_MAXIMIZE, *(LONG*)&msg.pt );
}
@@ -1431,15 +1431,15 @@
break;
case SC_MINIMIZE:
- ShowWindow( hwnd, SW_MINIMIZE );
+ ShowWindow32( hwnd, SW_MINIMIZE );
break;
case SC_MAXIMIZE:
- ShowWindow( hwnd, SW_MAXIMIZE );
+ ShowWindow32( hwnd, SW_MAXIMIZE );
break;
case SC_RESTORE:
- ShowWindow( hwnd, SW_RESTORE );
+ ShowWindow32( hwnd, SW_RESTORE );
break;
case SC_CLOSE:
diff --git a/windows/painting.c b/windows/painting.c
index 42dacc6..bdc5593 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -71,7 +71,7 @@
wnd->flags &= ~WIN_NEEDS_NCPAINT;
- if ((wnd->hwndSelf == GetActiveWindow()) &&
+ if ((wnd->hwndSelf == GetActiveWindow32()) &&
!(wnd->flags & WIN_NCACTIVATED))
{
wnd->flags |= WIN_NCACTIVATED;
@@ -256,7 +256,7 @@
if (!hwnd) hwnd = GetDesktopWindow32();
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
- if (!IsWindowVisible(hwnd) || (wndPtr->flags & WIN_NO_REDRAW))
+ if (!IsWindowVisible32(hwnd) || (wndPtr->flags & WIN_NO_REDRAW))
return TRUE; /* No redraw needed */
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && wndPtr->class->hIcon);
diff --git a/windows/scroll.c b/windows/scroll.c
index 8689f90..9fec3e0 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -64,7 +64,7 @@
GetClientRect32(hwnd, &rc);
hrgnClip = CreateRectRgnIndirect32( &rc );
- if ((hCaretWnd == hwnd) || IsChild(hwnd,hCaretWnd))
+ if ((hCaretWnd == hwnd) || IsChild32(hwnd,hCaretWnd))
HideCaret(hCaretWnd);
else hCaretWnd = 0;
@@ -98,10 +98,10 @@
OffsetRgn32( wndScroll->hrgnUpdate, dx, dy );
for (wndPtr = wndScroll->child; wndPtr; wndPtr = wndPtr->next)
- SetWindowPos(wndPtr->hwndSelf, 0, wndPtr->rectWindow.left + dx,
- wndPtr->rectWindow.top + dy, 0,0, SWP_NOZORDER |
- SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW |
- SWP_DEFERERASE );
+ SetWindowPos32(wndPtr->hwndSelf, 0, wndPtr->rectWindow.left + dx,
+ wndPtr->rectWindow.top + dy, 0,0, SWP_NOZORDER |
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW |
+ SWP_DEFERERASE );
}
PAINT_RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_ALLCHILDREN |
@@ -323,7 +323,7 @@
RECT32 rc;
CARET_GetRect( &rc );
if( hCaret == hWnd ||
- (flags & SW_SCROLLCHILDREN && IsChild(hWnd, hCaret)) )
+ (flags & SW_SCROLLCHILDREN && IsChild32(hWnd, hCaret)) )
{
POINT32 pt;
@@ -436,10 +436,10 @@
{
CONV_RECT16TO32( &w->rectWindow, &r );
if( IntersectRect32(&r, &r, &cliprc) )
- SetWindowPos(w->hwndSelf, 0, w->rectWindow.left + dx,
- w->rectWindow.top + dy, 0,0, SWP_NOZORDER |
- SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW |
- SWP_DEFERERASE );
+ SetWindowPos32(w->hwndSelf, 0, w->rectWindow.left + dx,
+ w->rectWindow.top + dy, 0,0, SWP_NOZORDER |
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW |
+ SWP_DEFERERASE );
}
}
diff --git a/windows/win.c b/windows/win.c
index 0966b49..31ceffd 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -29,6 +29,7 @@
#include "dde_proc.h"
#include "clipboard.h"
#include "winproc.h"
+#include "thread.h"
#include "stddebug.h"
/* #define DEBUG_WIN */
/* #define DEBUG_MENU */
@@ -385,7 +386,7 @@
next = wnd->next;
if (wnd->hmemTaskQ == hQueue)
if( hNew ) wnd->hmemTaskQ = hNew;
- else DestroyWindow( wnd->hwndSelf );
+ else DestroyWindow32( wnd->hwndSelf );
else WIN_ResetQueueWindows( wnd->child, hQueue, hNew );
wnd = next;
}
@@ -782,20 +783,20 @@
wndPtr->dwStyle &= ~WS_MAXIMIZE;
WINPOS_FindIconPos( hwnd );
- SetWindowPos( hwnd, 0, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y,
- SYSMETRICS_CXICON, SYSMETRICS_CYICON,
- SWP_FRAMECHANGED | ((GetActiveWindow())? SWP_NOACTIVATE : 0) );
+ SetWindowPos32( hwnd, 0, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y,
+ SYSMETRICS_CXICON, SYSMETRICS_CYICON,
+ SWP_FRAMECHANGED | ((GetActiveWindow32())? SWP_NOACTIVATE : 0) );
}
else if (wndPtr->dwStyle & WS_MAXIMIZE)
{
/* MinMaximize(hwnd, SW_SHOWMAXIMIZED, 1) */
NC_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack );
- SetWindowPos( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y,
- ((GetActiveWindow())? SWP_NOACTIVATE : 0) | SWP_FRAMECHANGED );
+ SetWindowPos32( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y,
+ ((GetActiveWindow32())? SWP_NOACTIVATE : 0) | SWP_FRAMECHANGED );
}
- if (cs->style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
+ if (cs->style & WS_VISIBLE) ShowWindow32( hwnd, SW_SHOW );
/* Call WH_SHELL hook */
@@ -989,7 +990,14 @@
/***********************************************************************
* DestroyWindow (USER.53)
*/
-BOOL DestroyWindow( HWND hwnd )
+BOOL16 DestroyWindow16( HWND16 hwnd )
+{
+ return DestroyWindow32(hwnd);
+}
+/***********************************************************************
+ * DestroyWindow (USER32.134)
+ */
+BOOL32 DestroyWindow32( HWND32 hwnd )
{
WND * wndPtr;
@@ -1021,9 +1029,9 @@
if (wndPtr->dwStyle & WS_VISIBLE)
{
- SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW |
- SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE |
- ((QUEUE_IsDoomedQueue(wndPtr->hmemTaskQ))?SWP_DEFERERASE:0) );
+ SetWindowPos32( hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW |
+ SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|
+ ((QUEUE_IsDoomedQueue(wndPtr->hmemTaskQ))?SWP_DEFERERASE:0) );
if( !IsWindow(hwnd) ) return TRUE;
}
@@ -1043,7 +1051,7 @@
siblingPtr->owner = NULL;
siblingPtr = siblingPtr->next;
}
- if (siblingPtr) DestroyWindow( siblingPtr->hwndSelf );
+ if (siblingPtr) DestroyWindow32( siblingPtr->hwndSelf );
else break;
}
@@ -1077,7 +1085,7 @@
{
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (!wndPtr || (wndPtr->dwStyle & WS_CHILD)) return TRUE;
- ShowWindow(hWnd, SW_MINIMIZE);
+ ShowWindow32(hWnd, SW_MINIMIZE);
return TRUE;
}
@@ -1087,8 +1095,8 @@
*/
BOOL OpenIcon(HWND hWnd)
{
- if (!IsIconic(hWnd)) return FALSE;
- ShowWindow(hWnd, SW_SHOWNORMAL);
+ if (!IsIconic16(hWnd)) return FALSE;
+ ShowWindow32(hWnd, SW_SHOWNORMAL);
return(TRUE);
}
@@ -1276,9 +1284,18 @@
/*******************************************************************
- * EnableWindow (USER.34)
+ * EnableWindow16 (USER.34)
*/
-BOOL EnableWindow( HWND hwnd, BOOL enable )
+BOOL16 EnableWindow16( HWND16 hwnd, BOOL16 enable )
+{
+ return EnableWindow32( hwnd, enable );
+}
+
+
+/*******************************************************************
+ * EnableWindow32 (USER32.171)
+ */
+BOOL32 EnableWindow32( HWND32 hwnd, BOOL32 enable )
{
WND *wndPtr;
@@ -1287,18 +1304,18 @@
{
/* Enable window */
wndPtr->dwStyle &= ~WS_DISABLED;
- SendMessage16( hwnd, WM_ENABLE, TRUE, 0 );
+ SendMessage32A( hwnd, WM_ENABLE, TRUE, 0 );
return TRUE;
}
else if (!enable && !(wndPtr->dwStyle & WS_DISABLED))
{
/* Disable window */
wndPtr->dwStyle |= WS_DISABLED;
- if ((hwnd == GetFocus32()) || IsChild( hwnd, GetFocus32() ))
+ if ((hwnd == GetFocus32()) || IsChild32( hwnd, GetFocus32() ))
SetFocus32( 0 ); /* A disabled window can't have the focus */
- if ((hwnd == GetCapture32()) || IsChild( hwnd, GetCapture32() ))
+ if ((hwnd == GetCapture32()) || IsChild32( hwnd, GetCapture32() ))
ReleaseCapture(); /* A disabled window can't capture the mouse */
- SendMessage16( hwnd, WM_ENABLE, FALSE, 0 );
+ SendMessage32A( hwnd, WM_ENABLE, FALSE, 0 );
return FALSE;
}
return ((wndPtr->dwStyle & WS_DISABLED) != 0);
@@ -1306,9 +1323,18 @@
/***********************************************************************
- * IsWindowEnabled (USER.35) (USER32.348)
+ * IsWindowEnabled16 (USER.35)
*/
-BOOL IsWindowEnabled(HWND hWnd)
+BOOL16 IsWindowEnabled16(HWND16 hWnd)
+{
+ return IsWindowEnabled32(hWnd);
+}
+
+
+/***********************************************************************
+ * IsWindowEnabled32 (USER32.348)
+ */
+BOOL32 IsWindowEnabled32(HWND32 hWnd)
{
WND * wndPtr;
@@ -1691,7 +1717,7 @@
if (hwndNewParent) wndPtr->parent = pWndParent;
WIN_LinkWindow(hwndChild, HWND_BOTTOM);
- if (IsWindowVisible(hwndChild)) UpdateWindow(hwndChild);
+ if (IsWindowVisible32(hwndChild)) UpdateWindow(hwndChild);
return oldParent;
}
@@ -1701,7 +1727,14 @@
/*******************************************************************
* IsChild (USER.48)
*/
-BOOL IsChild( HWND parent, HWND child )
+BOOL16 IsChild16( HWND16 parent, HWND16 child )
+{
+ return IsChild32(parent,child);
+}
+/*******************************************************************
+ * IsChild (USER32.338)
+ */
+BOOL32 IsChild32( HWND32 parent, HWND32 child )
{
WND * wndPtr = WIN_FindWndPtr( child );
while (wndPtr && (wndPtr->dwStyle & WS_CHILD))
@@ -1714,9 +1747,16 @@
/***********************************************************************
- * IsWindowVisible (USER.49) (USER32.350)
+ * IsWindowVisible (USER.49)
*/
-BOOL IsWindowVisible( HWND hwnd )
+BOOL16 IsWindowVisible16( HWND16 hwnd )
+{
+ return IsWindowVisible32(hwnd);
+}
+/***********************************************************************
+ * IsWindowVisible (USER32.350)
+ */
+BOOL32 IsWindowVisible32( HWND32 hwnd )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
while (wndPtr && (wndPtr->dwStyle & WS_CHILD))
@@ -1753,7 +1793,14 @@
/*******************************************************************
* GetTopWindow (USER.229)
*/
-HWND GetTopWindow( HWND hwnd )
+HWND16 GetTopWindow16( HWND16 hwnd )
+{
+ return GetTopWindow32(hwnd);
+}
+/*******************************************************************
+ * GetTopWindow (USER.229)
+ */
+HWND32 GetTopWindow32( HWND32 hwnd )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (wndPtr && wndPtr->child) return wndPtr->child->hwndSelf;
@@ -1764,7 +1811,14 @@
/*******************************************************************
* GetWindow (USER.262)
*/
-HWND GetWindow( HWND hwnd, WORD rel )
+HWND16 GetWindow16( HWND16 hwnd, WORD rel )
+{
+ return GetWindow32( hwnd,rel );
+}
+/*******************************************************************
+ * GetWindow (USER32.301)
+ */
+HWND32 GetWindow32( HWND32 hwnd, WORD rel )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
@@ -1807,10 +1861,10 @@
/*******************************************************************
* GetNextWindow (USER.230)
*/
-HWND GetNextWindow( HWND hwnd, WORD flag )
+HWND16 GetNextWindow16( HWND16 hwnd, WORD flag )
{
if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
- return GetWindow( hwnd, flag );
+ return GetWindow16( hwnd, flag );
}
/*******************************************************************
@@ -1823,7 +1877,7 @@
{
if (pWnd->owner && (pWnd->owner->hwndSelf == owner) &&
(pWnd->dwStyle & WS_POPUP))
- ShowWindow( pWnd->hwndSelf, fShow ? SW_SHOW : SW_HIDE );
+ ShowWindow32( pWnd->hwndSelf, fShow ? SW_SHOW : SW_HIDE );
pWnd = pWnd->next;
}
}
@@ -1937,7 +1991,9 @@
*/
BOOL32 EnumThreadWindows( DWORD id, WNDENUMPROC32 func, LPARAM lParam )
{
- return (BOOL16)EnumTaskWindows16((HTASK16)id, (WNDENUMPROC16)func, lParam);
+ THDB *tdb = (THDB*)id;
+
+ return (BOOL16)EnumTaskWindows16(tdb->teb.htask16, (WNDENUMPROC16)func, lParam);
}
@@ -2039,7 +2095,7 @@
{
WPARAM16 wparam;
if (bInvert) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
- else wparam = (hWnd == GetActiveWindow());
+ else wparam = (hWnd == GetActiveWindow32());
SendMessage16( hWnd, WM_NCACTIVATE, wparam, (LPARAM)0 );
return wparam;
diff --git a/windows/winpos.c b/windows/winpos.c
index 40516f3..adac82f 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -5,6 +5,7 @@
* 1995,1996 Alex Korobka
*/
+#define NO_TRANSITION_TYPES
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
@@ -38,15 +39,15 @@
/* ----- external functions ----- */
-extern void FOCUS_SwitchFocus( HWND , HWND );
-extern HRGN32 DCE_GetVisRgn( HWND, WORD );
-extern HWND CARET_GetHwnd();
-extern BOOL DCE_InvalidateDCE(WND*, RECT16* );
+extern void FOCUS_SwitchFocus( HWND32 , HWND32 );
+extern HRGN32 DCE_GetVisRgn( HWND32, WORD );
+extern HWND32 CARET_GetHwnd();
+extern BOOL32 DCE_InvalidateDCE(WND*, RECT16* );
/* ----- internal variables ----- */
-static HWND hwndActive = 0; /* Currently active window */
-static HWND hwndPrevActive = 0; /* Previously active window */
+static HWND32 hwndActive = 0; /* Currently active window */
+static HWND32 hwndPrevActive = 0; /* Previously active window */
extern MESSAGEQUEUE* pActiveQueue;
@@ -117,26 +118,32 @@
/***********************************************************************
+ * ArrangeIconicWindows (USER32.6)
+ */
+UINT16 ArrangeIconicWindows16( HWND16 parent) {
+ return ArrangeIconicWindows32(parent);
+}
+/***********************************************************************
* ArrangeIconicWindows (USER.170)
*/
-UINT ArrangeIconicWindows( HWND parent )
+UINT32 ArrangeIconicWindows32( HWND32 parent )
{
- RECT16 rectParent;
- HWND hwndChild;
- INT x, y, xspacing, yspacing;
+ RECT32 rectParent;
+ HWND32 hwndChild;
+ INT32 x, y, xspacing, yspacing;
- GetClientRect16( parent, &rectParent );
+ GetClientRect32( parent, &rectParent );
x = rectParent.left;
y = rectParent.bottom;
xspacing = yspacing = 70; /* FIXME: This should come from WIN.INI */
- hwndChild = GetWindow( parent, GW_CHILD );
+ hwndChild = GetWindow32( parent, GW_CHILD );
while (hwndChild)
{
- if (IsIconic( hwndChild ))
+ if (IsIconic32( hwndChild ))
{
- SetWindowPos( hwndChild, 0, x + (xspacing - SYSMETRICS_CXICON) / 2,
- y - (yspacing + SYSMETRICS_CYICON) / 2, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
+ SetWindowPos32( hwndChild, 0, x + (xspacing - SYSMETRICS_CXICON) / 2,
+ y - (yspacing + SYSMETRICS_CYICON) / 2, 0, 0,
+ SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE );
if (x <= rectParent.right - xspacing) x += xspacing;
else
{
@@ -144,7 +151,7 @@
y -= yspacing;
}
}
- hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
+ hwndChild = GetWindow32( hwndChild, GW_HWNDNEXT );
}
return yspacing;
}
@@ -316,7 +323,7 @@
/* Send the WM_NCHITTEST message (only if to the same task) */
if ((*ppWnd)->hmemTaskQ != GetTaskQueue(0)) return HTCLIENT;
- hittest = (INT)SendMessage16( (*ppWnd)->hwndSelf, WM_NCHITTEST, 0,
+ hittest = (INT16)SendMessage16( (*ppWnd)->hwndSelf, WM_NCHITTEST, 0,
MAKELONG( pt.x, pt.y ) );
if (hittest != HTTRANSPARENT) return hittest; /* Found the window */
@@ -485,7 +492,14 @@
/***********************************************************************
* IsIconic (USER.31)
*/
-BOOL IsIconic(HWND hWnd)
+BOOL16 IsIconic16(HWND16 hWnd)
+{
+ return IsIconic32(hWnd);
+}
+/***********************************************************************
+ * IsIconic (USER32.344)
+ */
+BOOL32 IsIconic32(HWND32 hWnd)
{
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) return FALSE;
@@ -496,7 +510,14 @@
/***********************************************************************
* IsZoomed (USER.272)
*/
-BOOL IsZoomed(HWND hWnd)
+BOOL16 IsZoomed16(HWND16 hWnd)
+{
+ return IsZoomed32(hWnd);
+}
+/***********************************************************************
+ * IsZoomed (USER32.351)
+ */
+BOOL32 IsZoomed32(HWND32 hWnd)
{
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) return FALSE;
@@ -507,7 +528,14 @@
/*******************************************************************
* GetActiveWindow (USER.60)
*/
-HWND GetActiveWindow(void)
+HWND16 GetActiveWindow16(void)
+{
+ return GetActiveWindow32();
+}
+/*******************************************************************
+ * GetActiveWindow (USER32.204)
+ */
+HWND32 GetActiveWindow32(void)
{
return hwndActive;
}
@@ -526,9 +554,16 @@
/*******************************************************************
* SetActiveWindow (USER.59)
*/
-HWND SetActiveWindow( HWND hwnd )
+HWND16 SetActiveWindow16( HWND16 hwnd )
{
- HWND prev = hwndActive;
+ return SetActiveWindow32(hwnd);
+}
+/*******************************************************************
+ * SetActiveWindow (USER.59)
+ */
+HWND32 SetActiveWindow32( HWND32 hwnd )
+{
+ HWND32 prev = hwndActive;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if ( !WINPOS_IsGoodEnough(wndPtr) ) return 0;
@@ -541,29 +576,51 @@
/***********************************************************************
* BringWindowToTop (USER.45)
*/
-BOOL BringWindowToTop( HWND hwnd )
+BOOL16 BringWindowToTop16( HWND16 hwnd )
{
- return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
+ return BringWindowToTop32(hwnd);
+}
+/***********************************************************************
+ * BringWindowToTop (USER32.10)
+ */
+BOOL32 BringWindowToTop32( HWND32 hwnd )
+{
+ return SetWindowPos32( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
}
/***********************************************************************
* MoveWindow (USER.56)
*/
-BOOL MoveWindow( HWND hwnd, short x, short y, short cx, short cy, BOOL repaint)
-{
+BOOL16 MoveWindow16(
+ HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint
+) {
+ return MoveWindow32(hwnd,x,y,cx,cy,repaint);
+}
+/***********************************************************************
+ * MoveWindow (USER32.398)
+ */
+BOOL32 MoveWindow32(
+ HWND32 hwnd, INT32 x, INT32 y, INT32 cx, INT32 cy, BOOL32 repaint
+) {
int flags = SWP_NOZORDER | SWP_NOACTIVATE;
if (!repaint) flags |= SWP_NOREDRAW;
dprintf_win(stddeb, "MoveWindow: %04x %d,%d %dx%d %d\n",
hwnd, x, y, cx, cy, repaint );
- return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
+ return SetWindowPos32( hwnd, 0, x, y, cx, cy, flags );
}
-
/***********************************************************************
* ShowWindow (USER.42)
*/
-BOOL ShowWindow( HWND hwnd, int cmd )
+BOOL16 ShowWindow16( HWND16 hwnd, INT16 cmd )
+{
+ return ShowWindow32(hwnd,cmd);
+}
+/***********************************************************************
+ * ShowWindow (USER.42)
+ */
+BOOL32 ShowWindow32( HWND32 hwnd, INT32 cmd )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
BOOL32 wasVisible, showFlag;
@@ -636,7 +693,7 @@
y = wndPtr->ptMaxPos.y;
if( wndPtr->dwStyle & WS_MINIMIZE )
- if( !SendMessage16( hwnd, WM_QUERYOPEN, 0, 0L ) )
+ if( !SendMessage32A( hwnd, WM_QUERYOPEN, 0, 0L ) )
{
swpflags |= SWP_NOSIZE | SWP_NOMOVE;
break;
@@ -660,7 +717,7 @@
case SW_SHOWNOACTIVATE:
swpflags |= SWP_NOZORDER;
- if (GetActiveWindow()) swpflags |= SWP_NOACTIVATE;
+ if (GetActiveWindow32()) swpflags |= SWP_NOACTIVATE;
/* fall through */
case SW_SHOWNORMAL: /* same as SW_NORMAL: */
case SW_SHOWDEFAULT: /* FIXME: should have its own handler */
@@ -725,10 +782,10 @@
}
if ((wndPtr->dwStyle & WS_CHILD) &&
- !IsWindowVisible( wndPtr->parent->hwndSelf ) &&
+ !IsWindowVisible32( wndPtr->parent->hwndSelf ) &&
(swpflags & SWP_NOSIZE) && (swpflags & SWP_NOMOVE))
{
- /* Don't call SetWindowPos() on invisible child windows */
+ /* Don't call SetWindowPos32() on invisible child windows */
if (cmd == SW_HIDE) wndPtr->dwStyle &= ~WS_VISIBLE;
else wndPtr->dwStyle |= WS_VISIBLE;
}
@@ -737,7 +794,7 @@
/* We can't activate a child window */
if (wndPtr->dwStyle & WS_CHILD)
swpflags |= SWP_NOACTIVATE | SWP_NOZORDER;
- SetWindowPos( hwnd, HWND_TOP, x, y, cx, cy, swpflags );
+ SetWindowPos32( hwnd, HWND_TOP, x, y, cx, cy, swpflags );
if (!IsWindow( hwnd )) return wasVisible;
}
@@ -835,8 +892,8 @@
wndpl->length = sizeof(*wndpl);
wndpl->flags = 0;
- wndpl->showCmd = IsZoomed(hwnd) ? SW_SHOWMAXIMIZED :
- (IsIconic(hwnd) ? SW_SHOWMINIMIZED : SW_SHOWNORMAL);
+ wndpl->showCmd = IsZoomed16(hwnd) ? SW_SHOWMAXIMIZED :
+ (IsIconic16(hwnd) ? SW_SHOWMINIMIZED : SW_SHOWNORMAL);
wndpl->ptMinPosition = wndPtr->ptIconPos;
wndpl->ptMaxPosition = wndPtr->ptMaxPos;
wndpl->rcNormalPosition = wndPtr->rectNormal;
@@ -854,8 +911,8 @@
wndpl->length = sizeof(*wndpl);
wndpl->flags = 0;
- wndpl->showCmd = IsZoomed(hwnd) ? SW_SHOWMAXIMIZED :
- (IsIconic(hwnd) ? SW_SHOWMINIMIZED : SW_SHOWNORMAL);
+ wndpl->showCmd = IsZoomed32(hwnd) ? SW_SHOWMAXIMIZED :
+ (IsIconic32(hwnd) ? SW_SHOWMINIMIZED : SW_SHOWNORMAL);
CONV_POINT16TO32( &wndPtr->ptIconPos, &wndpl->ptMinPosition );
CONV_POINT16TO32( &wndPtr->ptMaxPos, &wndpl->ptMaxPosition );
CONV_RECT16TO32( &wndPtr->rectNormal, &wndpl->rcNormalPosition );
@@ -877,7 +934,7 @@
(wndpl->showCmd == SW_SHOWMINIMIZED)) wndPtr->flags |= WIN_RESTORE_MAX;
wndPtr->ptMaxPos = wndpl->ptMaxPosition;
wndPtr->rectNormal = wndpl->rcNormalPosition;
- ShowWindow( hwnd, wndpl->showCmd );
+ ShowWindow16( hwnd, wndpl->showCmd );
return TRUE;
}
@@ -896,7 +953,7 @@
(wndpl->showCmd == SW_SHOWMINIMIZED)) wndPtr->flags |= WIN_RESTORE_MAX;
CONV_POINT32TO16( &wndpl->ptMaxPosition, &wndPtr->ptMaxPos );
CONV_RECT32TO16( &wndpl->rcNormalPosition, &wndPtr->rectNormal );
- ShowWindow( hwnd, wndpl->showCmd );
+ ShowWindow32( hwnd, wndpl->showCmd );
return TRUE;
}
@@ -1010,8 +1067,8 @@
if (wndTemp->dwStyle & WS_VISIBLE) break;
if( wndTemp != wndPtr )
- SetWindowPos(hWnd, HWND_TOP, 0,0,0,0,
- SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
+ SetWindowPos32(hWnd, HWND_TOP, 0,0,0,0,
+ SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
if( !IsWindow(hWnd) ) return 0;
}
@@ -1254,9 +1311,9 @@
* Move a window in Z order, invalidating everything that needs it.
* Only necessary for windows without associated X window.
*/
-static void WINPOS_MoveWindowZOrder( HWND hwnd, HWND hwndAfter )
+static void WINPOS_MoveWindowZOrder( HWND32 hwnd, HWND32 hwndAfter )
{
- BOOL movingUp;
+ BOOL32 movingUp;
WND *pWndAfter, *pWndCur, *wndPtr = WIN_FindWndPtr( hwnd );
/* We have two possible cases:
@@ -1332,7 +1389,7 @@
* fix Z order taking into account owned popups -
* basically we need to maintain them above owner window
*/
-HWND WINPOS_ReorderOwnedPopups(HWND hwndInsertAfter, WND* wndPtr, WORD flags)
+HWND32 WINPOS_ReorderOwnedPopups(HWND32 hwndInsertAfter,WND* wndPtr,WORD flags)
{
WND* w = WIN_GetDesktop()->child;
@@ -1340,7 +1397,7 @@
{
/* implement "local z-order" between the top and owner window */
- HWND hwndLocalPrev = HWND_TOP;
+ HWND32 hwndLocalPrev = HWND_TOP;
if( hwndInsertAfter != HWND_TOP )
{
@@ -1363,8 +1420,8 @@
if( w->dwStyle & WS_POPUP && w->owner == wndPtr )
{
- SetWindowPos(w->hwndSelf, hwndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
- SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_DEFERERASE);
+ SetWindowPos32(w->hwndSelf, hwndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
+ SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_DEFERERASE);
hwndInsertAfter = w->hwndSelf;
}
w = w->next;
@@ -1384,7 +1441,7 @@
* update regions are in window client coordinates
* client and window rectangles are in parent client coordinates
*/
-static UINT WINPOS_SizeMoveClean(WND* Wnd, HRGN32 oldVisRgn, LPRECT16 lpOldWndRect, LPRECT16 lpOldClientRect, UINT uFlags )
+static UINT32 WINPOS_SizeMoveClean(WND* Wnd, HRGN32 oldVisRgn, LPRECT16 lpOldWndRect, LPRECT16 lpOldClientRect, UINT32 uFlags )
{
HRGN32 newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf,DCX_WINDOW | DCX_CLIPSIBLINGS);
HRGN32 dirtyRgn = CreateRectRgn32(0,0,0,0);
@@ -1605,16 +1662,25 @@
/***********************************************************************
* SetWindowPos (USER.232)
*/
-BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y,
- INT cx, INT cy, WORD flags )
+BOOL16 SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter, INT16 x, INT16 y,
+ INT16 cx, INT16 cy, WORD flags )
+{
+ return SetWindowPos32(hwnd,(INT32)(INT16)hwndInsertAfter,x,y,cx,cy,flags);
+}
+
+/***********************************************************************
+ * SetWindowPos (USER32.519)
+ */
+BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y,
+ INT32 cx, INT32 cy, WORD flags )
{
WINDOWPOS16 *winpos;
WND * wndPtr;
RECT16 newWindowRect, newClientRect, oldWindowRect;
HRGN32 visRgn = 0;
- HWND tempInsertAfter= 0;
+ HWND32 tempInsertAfter= 0;
int result = 0;
- UINT uFlags = 0;
+ UINT32 uFlags = 0;
dprintf_win(stddeb,"SetWindowPos: hwnd %04x, (%i,%i)-(%i,%i) flags %08x\n",
hwnd, x, y, x+cx, y+cy, flags);
@@ -1914,7 +1980,7 @@
}
if ((winpos->hwnd == GetFocus32()) ||
- IsChild( winpos->hwnd, GetFocus32()))
+ IsChild32( winpos->hwnd, GetFocus32()))
{
/* Revert focus to parent */
SetFocus32( GetParent32(winpos->hwnd) );
@@ -1924,10 +1990,10 @@
if (winpos->hwnd == hwndActive)
{
/* Activate previously active window if possible */
- HWND newActive = hwndPrevActive;
+ HWND32 newActive = hwndPrevActive;
if (!IsWindow(newActive) || (newActive == winpos->hwnd))
{
- newActive = GetTopWindow( GetDesktopWindow32() );
+ newActive = GetTopWindow32( GetDesktopWindow32() );
if (newActive == winpos->hwnd)
newActive = wndPtr->next ? wndPtr->next->hwndSelf : 0;
}
@@ -1973,15 +2039,24 @@
/***********************************************************************
- * BeginDeferWindowPos (USER.259)
+ * BeginDeferWindowPos16 (USER.259)
*/
-HDWP16 BeginDeferWindowPos( INT count )
+HDWP16 BeginDeferWindowPos16( INT16 count )
{
- HDWP16 handle;
+ return BeginDeferWindowPos32( count );
+}
+
+
+/***********************************************************************
+ * BeginDeferWindowPos32 (USER32.8)
+ */
+HDWP32 BeginDeferWindowPos32( INT32 count )
+{
+ HDWP32 handle;
DWP *pDWP;
if (count <= 0) return 0;
- handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS16) );
+ handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS32) );
if (!handle) return 0;
pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle );
pDWP->actualCount = 0;
@@ -1994,15 +2069,26 @@
/***********************************************************************
- * DeferWindowPos (USER.260)
+ * DeferWindowPos16 (USER.260)
*/
-HDWP16 DeferWindowPos( HDWP16 hdwp, HWND hwnd, HWND hwndAfter, INT x, INT y,
- INT cx, INT cy, UINT flags )
+HDWP16 DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
+ INT16 x, INT16 y, INT16 cx, INT16 cy, UINT16 flags )
+{
+ return DeferWindowPos32( hdwp, hwnd, (INT32)(INT16)hwndAfter,
+ x, y, cx, cy, flags );
+}
+
+
+/***********************************************************************
+ * DeferWindowPos32 (USER32.127)
+ */
+HDWP32 DeferWindowPos32( HDWP32 hdwp, HWND32 hwnd, HWND32 hwndAfter,
+ INT32 x, INT32 y, INT32 cx, INT32 cy, UINT32 flags )
{
DWP *pDWP;
int i;
- HDWP16 newhdwp = hdwp;
- HWND parent;
+ HDWP32 newhdwp = hdwp;
+ HWND32 parent;
pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
if (!pDWP) return 0;
@@ -2049,7 +2135,7 @@
if (pDWP->actualCount >= pDWP->suggestedCount)
{
newhdwp = USER_HEAP_REALLOC( hdwp,
- sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS16) );
+ sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS32) );
if (!newhdwp) return 0;
pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp );
pDWP->suggestedCount++;
@@ -2067,22 +2153,31 @@
/***********************************************************************
- * EndDeferWindowPos (USER.261)
+ * EndDeferWindowPos16 (USER.261)
*/
-BOOL EndDeferWindowPos( HDWP16 hdwp )
+BOOL16 EndDeferWindowPos16( HDWP16 hdwp )
+{
+ return EndDeferWindowPos32( hdwp );
+}
+
+
+/***********************************************************************
+ * EndDeferWindowPos32 (USER32.172)
+ */
+BOOL32 EndDeferWindowPos32( HDWP32 hdwp )
{
DWP *pDWP;
- WINDOWPOS16 *winpos;
- BOOL res = TRUE;
+ WINDOWPOS32 *winpos;
+ BOOL32 res = TRUE;
int i;
pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
if (!pDWP) return FALSE;
for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
{
- if (!(res = SetWindowPos( winpos->hwnd, winpos->hwndInsertAfter,
- winpos->x, winpos->y, winpos->cx, winpos->cy,
- winpos->flags ))) break;
+ if (!(res = SetWindowPos32( winpos->hwnd, winpos->hwndInsertAfter,
+ winpos->x, winpos->y, winpos->cx,
+ winpos->cy, winpos->flags ))) break;
}
USER_HEAP_FREE( hdwp );
return res;
@@ -2092,7 +2187,7 @@
/***********************************************************************
* TileChildWindows (USER.199)
*/
-void TileChildWindows( HWND parent, WORD action )
+void TileChildWindows( HWND16 parent, WORD action )
{
printf("STUB TileChildWindows(%04x, %d)\n", parent, action);
}
@@ -2100,7 +2195,7 @@
/***********************************************************************
* CascageChildWindows (USER.198)
*/
-void CascadeChildWindows( HWND parent, WORD action )
+void CascadeChildWindows( HWND16 parent, WORD action )
{
printf("STUB CascadeChildWindows(%04x, %d)\n", parent, action);
}