[WIN32K]
[reactos.git] / reactos / subsystems / win32 / win32k / ntuser / accelerator.c
index 0bcf40d..1e20a83 100644 (file)
@@ -4,44 +4,18 @@
  * PURPOSE:          Window accelerator
  * FILE:             subsystems/win32/win32k/ntuser/accelerator.c
  * PROGRAMER:        Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISION HISTORY:
- *       06-06-2001  CSH  Created
+ *                   Copyright 1993 Martin Ayotte
+ *                   Copyright 1994 Alexandre Julliard
+ *                   Copyright 1997 Morten Welinder
+ *                   Copyright 2011 Rafal Harabien
  */
 
-/*
- * Copyright 1993 Martin Ayotte
- * Copyright 1994 Alexandre Julliard
- * Copyright 1997 Morten Welinder
- * Copyright 2011 Rafal Harabien
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* INCLUDES ******************************************************************/
-
 #include <win32k.h>
+DBG_DEFAULT_CHANNEL(UserAccel);
 
 #define FVIRT_TBL_END 0x80
 #define FVIRT_MASK 0x7F
 
-DBG_DEFAULT_CHANNEL(UserAccel);
-
-UINT FASTCALL IntFindSubMenu(HMENU *hMenu, HMENU hSubTarget );
-HMENU FASTCALL IntGetSubMenu( HMENU hMenu, int nPos);
-UINT FASTCALL IntGetMenuState( HMENU hMenu, UINT uId, UINT uFlags);
-
 /* FUNCTIONS *****************************************************************/
 
 PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hAccel)
@@ -136,7 +110,7 @@ co_IntTranslateAccelerator(
                                    &MenuItem,
                                    NULL);
        if (nPos != (UINT)-1)
-           hSubMenu = MenuItem->hSubMenu;
+           hSubMenu = SubMenu->head.h;
        else
            hMenu = NULL;
    }
@@ -155,7 +129,7 @@ co_IntTranslateAccelerator(
                                        &MenuItem,
                                        NULL);
            if (nPos != (UINT)-1)
-               hSubMenu = MenuItem->hSubMenu;
+               hSubMenu = SubMenu->head.h;
            else
                hMenu = NULL;
        }
@@ -164,7 +138,7 @@ co_IntTranslateAccelerator(
    /* If this is a menu item, there is no capturing enabled and
       window is not disabled, send WM_INITMENU */
    if (hMenu && !IntGetCaptureWindow())
-   {                                               
+   {
        co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
        if (hSubMenu)
        {
@@ -180,7 +154,7 @@ co_IntTranslateAccelerator(
       - this is window menu and window is minimized */
    if (!(Window->style & WS_DISABLED) &&
        !(hMenu && IntGetMenuState(hMenu, pAccel->cmd, MF_BYCOMMAND) & (MF_DISABLED|MF_GRAYED)) &&
-       !(hMenu && hMenu == (HMENU)Window->IDMenu && !(Window->style & WS_MINIMIZED)))
+       !(hMenu && hMenu == (HMENU)Window->IDMenu && (Window->style & WS_MINIMIZED)))
    {
        /* If this is system menu item, send WM_SYSCOMMAND, otherwise send WM_COMMAND */
        if (hMenu && hMenu == Window->SystemMenu)
@@ -452,8 +426,7 @@ NtUserTranslateAccelerator(
    {
       if (co_IntTranslateAccelerator(Window, &Message, &Accel->Table[i]))
       {
-         TRACE("NtUserTranslateAccelerator returns 1\n");
-         RETURN( 1);
+          RETURN( 1);
       }
 
       /* Undocumented feature... */
@@ -467,7 +440,7 @@ CLEANUP:
    if (Window) UserDerefObjectCo(Window);
    if (Accel) UserDerefObjectCo(Accel);
 
-   TRACE("NtUserTranslateAccelerator returns 0\n");
+   TRACE("NtUserTranslateAccelerator returns %d\n", _ret_);
    UserLeave();
    END_CLEANUP;
 }