Release 961215
Sun Dec 15 16:18:15 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [graphics/x11drv/bitblt.c]
Fixed BITBLT_StretchImage for partially covered or inverted
bitmaps.
* [objects/dib.c]
Fixed the upside-down bitmap problem.
Sat Dec 14 02:49:57 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/user32.spec]
IsMenu and RemoveMenu added (use existing Win16 functions).
* [include/windows.h]
Corrections to BITMAPINFOHEADER structure.
* [loader/module.c] [if1632/kernel32.spec]
New function GetModuleFileName32A (heavily based on original
Win16 version).
* [loader/pe_image.c]
Hack to allow files with short PE header to be loaded (e.g.
COMDLG32.DLL from Win32s).
* [misc/winsock_async.c]
#if out EIDRM case (not present in FreeBSD).
* [tools/build.c]
Remove trailing comments from .s files generated by build
as these break assembly when not run through pre-processor.
* [windows/graphics.c] [if1632/gdi32.spec]
New function Polyline32 - based on original Polyline. Needs
metafile support adding still.
Fri Dec 13 13:04:06 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [win32/findfile.c] [if1632/kernel.spec]
FindFirstFile32A(): Use dos current directory for drive prefixes.
FindNextFile32A(): Fill in file attribute information.
Implement FindFirstFile16, FindNextFile16, FindClose16.
* [files/drive.c]
GetCurrentDirectory32A - Fix problem with null 3rd character in
string.
Tue Dec 10 14:49:07 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [windows/painting.c][windows/message.c]
Don't use linked lists to call SendMessage(), for it might destroy
the current listentry.
* [misc/registry.c]
Fixed temporary file saving (rename doesn't work across
partitions).
* [files/*.c]
GetFullPathName*,GetDriveType32A fixed, CreateDirectoryEx*,
GetVolumeInformation32W fixed.
* [win32/process.c][if1632/kernel.spec][if1632/kernel32.spec]
LoadLibrary* updated to new naming std., *32W added.
* [win32/console.c] [include/wincon.h]
Additions for NT commandline executables.
* [if1632/advapi32.spec][if1632/kernel32.spec][win32/init.c]
GetUserName32W added, GetComputerName32W added,
GetStartupInfo32W added, GetSystemInfo updated to NT standard.
* [windows/msgbox.c][misc/shell.c][windows/graphics.c]
MessageBox32W, ShellAbout32W, CommandLineToArgvW, Polygon32 added.
* [misc/crtdll.c][include/crtdll.h][if1632/crtdll.spec][misc/ntdll.c]
[if1632/ntdll.spec]
Lot of new unicode functions added (needed for NT).
* [loader/pe_image.c]
NtCurrentTeb added.
Tue Dec 10 22:39:33 1996 Albrecht Kleine <kleine@ak.sax.de>
* [windows/keyboard.c]
Rewrote function TranslateAccelerator().
Mon Dec 9 14:52:13 1996 Slaven Rezic <eserte@cs.tu-berlin.de>
* [windows/defwnd.c]
DEFWND_SetText(): Set icon name.
Sun Dec 8 23:30:00 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [loader/signal.c] [misc/winsock.c] [misc/winsock_async.c]
[if1632/winsock.spec]
IPC resource cleanup, bugfixes.
* [windows/dialog.c] [windows/defdlg.c]
More DefDlgProc() fixes.
Sun Dec 8 14:01:42 1996 Vadim Strizhevsky <striv@ms.com>
* [misc/clipboard.c] [objects/font.c] [win32/init.c]
[win32/newfns.c] [windows/graphics.c]
Added a few WIN32 functions which needed to run some win32
accessories. Clock should now work almost as well as 16 bit version.
Add: RegisterClipboardFormat32W GetTextExtentExPoint32*
GetModuleHandleW, DisableThreadLibraryCalls (empty stub),
Polygon32
Fix: Polygon16 possible memory leak on error return.
diff --git a/windows/keyboard.c b/windows/keyboard.c
index 10e3ed0..0342cb9 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -2,11 +2,14 @@
* Keyboard related functions
*
* Copyright 1993 Bob Amstadt
+ * Copyright 1996 Albrecht Kleine
*/
+
#include <stdio.h>
#include <string.h>
#include "win.h"
#include "windows.h"
+#include "accel.h"
#include "debug.h"
extern BOOL MouseButtonsStates[3];
@@ -115,3 +118,147 @@
dprintf_key(stddeb, "GetAsyncKeyState(%x) -> %x\n", nKey, retval);
return retval;
}
+
+
+/**********************************************************************
+ * TranslateAccelerator [USER.178]
+ *
+ * FIXME: should send some WM_INITMENU or/and WM_INITMENUPOPUP -messages
+ */
+INT16 TranslateAccelerator(HWND hWnd, HACCEL16 hAccel, LPMSG16 msg)
+{
+ ACCELHEADER *lpAccelTbl;
+ int i;
+ BOOL sendmsg;
+
+ if (hAccel == 0 || msg == NULL) return 0;
+ if (msg->message != WM_KEYDOWN &&
+ msg->message != WM_KEYUP &&
+ msg->message != WM_SYSKEYDOWN &&
+ msg->message != WM_SYSKEYUP &&
+ msg->message != WM_CHAR) return 0;
+
+ dprintf_accel(stddeb, "TranslateAccelerators hAccel=%04x, hWnd=%04x,\
+msg->hwnd=%04x, msg->message=%04x\n", hAccel,hWnd,msg->hwnd,msg->message);
+
+ lpAccelTbl = (LPACCELHEADER)GlobalLock16(hAccel);
+ for (sendmsg= i = 0; i < lpAccelTbl->wCount; i++)
+ {
+ if(msg->wParam == lpAccelTbl->tbl[i].wEvent)
+ {
+ if (msg->message == WM_CHAR)
+ {
+ if ( !(lpAccelTbl->tbl[i].type & ALT_ACCEL) &&
+ !(lpAccelTbl->tbl[i].type & VIRTKEY_ACCEL) )
+ {
+ dprintf_accel(stddeb,"found accel for WM_CHAR: ('%c')",msg->wParam&0xff);
+ sendmsg=TRUE;
+ }
+ }
+ else
+ {
+ if(lpAccelTbl->tbl[i].type & VIRTKEY_ACCEL)
+ {
+ INT mask = 0;
+ dprintf_accel(stddeb,"found accel for virt_key %04x (scan %04x)",
+ msg->wParam,0xff & HIWORD(msg->lParam));
+ if(GetKeyState(VK_SHIFT) & 0x8000) mask |= SHIFT_ACCEL;
+ if(GetKeyState(VK_CONTROL) & 0x8000) mask |= CONTROL_ACCEL;
+ if(GetKeyState(VK_MENU) & 0x8000) mask |= ALT_ACCEL;
+ if(mask == (lpAccelTbl->tbl[i].type &
+ (SHIFT_ACCEL | CONTROL_ACCEL | ALT_ACCEL)))
+ sendmsg=TRUE;
+ else
+ dprintf_accel(stddeb,", but incorrect SHIFT/CTRL/ALT-state\n");
+ }
+ else
+ {
+ if (!(msg->lParam & 0x01000000)) /* no special_key */
+ {
+ if ((lpAccelTbl->tbl[i].type & ALT_ACCEL) && (msg->lParam & 0x20000000))
+ { /* ^^ ALT pressed */
+ dprintf_accel(stddeb,"found accel for Alt-%c", msg->wParam&0xff);
+ sendmsg=TRUE;
+ }
+ }
+ }
+ }
+
+ if (sendmsg) /* found an accelerator, but send a message... ? */
+ {
+ INT16 iSysStat,iStat,mesg=0;
+ HMENU16 hSysMenu,hMenu;
+
+ if (msg->message == WM_KEYUP || msg->message == WM_SYSKEYUP)
+ mesg=1;
+ else
+ if (GetCapture16())
+ mesg=2;
+ else
+ if (!IsWindowEnabled(hWnd))
+ mesg=3;
+ else
+ {
+ hMenu=GetMenu(hWnd);
+ hSysMenu=GetSystemMenu(hWnd,FALSE);
+ if (hSysMenu)
+ iSysStat=GetMenuState(hSysMenu,lpAccelTbl->tbl[i].wIDval,MF_BYCOMMAND);
+ else
+ iSysStat=-1;
+ if (hMenu)
+ iStat=GetMenuState(hMenu,lpAccelTbl->tbl[i].wIDval,MF_BYCOMMAND);
+ else
+ iStat=-1;
+ if (iSysStat!=-1)
+ {
+ if (iSysStat & (MF_DISABLED|MF_GRAYED))
+ mesg=4;
+ else
+ mesg=WM_SYSCOMMAND;
+ }
+ else
+ {
+ if (iStat!=-1)
+ {
+ if (IsIconic(hWnd))
+ mesg=5;
+ else
+ {
+ if (iStat & (MF_DISABLED|MF_GRAYED))
+ mesg=6;
+ else
+ mesg=WM_COMMAND;
+ }
+ }
+ else
+ mesg=WM_COMMAND;
+ }
+ }
+ if ( mesg==WM_COMMAND || mesg==WM_SYSCOMMAND )
+ {
+ dprintf_accel(stddeb,", sending %s, wParam=%0x\n",
+ mesg==WM_COMMAND ? "WM_COMMAND" : "WM_SYSCOMMAND",
+ lpAccelTbl->tbl[i].wIDval);
+ SendMessage16(hWnd, mesg, lpAccelTbl->tbl[i].wIDval,0x00010000L);
+ }
+ else
+ {
+ /* some reasons for NOT sending the WM_{SYS}COMMAND message:
+ * #0: unknown (please report!)
+ * #1: for WM_KEYUP,WM_SYKEYUP
+ * #2: mouse is captured
+ * #3: window is disabled
+ * #4: it's a disabled system menu option
+ * #5: it's a menu option, but window is iconic
+ * #6: it's a menu option, but disabled
+ */
+ dprintf_accel(stddeb,", but won't send WM_{SYS}COMMAND, reason is #%d\n",mesg);
+ }
+ GlobalUnlock16(hAccel);
+ return 1;
+ }
+ }
+ }
+ GlobalUnlock16(hAccel);
+ return 0;
+}