Changeset 342 for trunk/src


Ignore:
Timestamp:
Jul 20, 1999, 9:42:36 AM (26 years ago)
Author:
sandervl
Message:

Accelerator support (not working) + bugfixes

Location:
trunk/src/user32/new
Files:
1 added
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/loadres.cpp

    r336 r342  
    1 /* $Id: loadres.cpp,v 1.2 1999-07-19 11:50:04 sandervl Exp $ */
     1/* $Id: loadres.cpp,v 1.3 1999-07-20 07:42:35 sandervl Exp $ */
    22
    33/*
     
    6363
    6464    dprintf(("LoadCursor from %X returned %d\n", hinst, rc));
    65     return(rc);
    66 }
    67 //******************************************************************************
    68 //******************************************************************************
    69 HACCEL WIN32API LoadAcceleratorsA(HINSTANCE hinst, LPCSTR lpszAcc)
    70 {
    71  HACCEL rc;
    72 
    73     if((int)lpszAcc >> 16 != 0) {//convert string name identifier to numeric id
    74          dprintf(("lpszAcc %s\n", lpszAcc));
    75          lpszAcc = (LPCSTR)ConvertNameId(hinst, (char *)lpszAcc);
    76     }
    77     else dprintf(("lpszAcc %d\n", (int)lpszAcc));
    78  
    79     rc = O32_LoadAccelerators(hinst, lpszAcc);
    80 
    81     dprintf(("LoadAccelerators returned %d\n", rc));
    8265    return(rc);
    8366}
     
    10790  return(rc);
    10891}
    109 
    110 //******************************************************************************
    111 //******************************************************************************
    112 HACCEL WIN32API LoadAcceleratorsW(HINSTANCE hinst, LPCWSTR lpszAccel)
    113 {
    114  char   *astring = NULL;
    115  HACCEL rc;
    116 
    117     if((int)lpszAccel >> 16 != 0) {//convert string name identifier to numeric id
    118          astring = UnicodeToAsciiString((LPWSTR)lpszAccel);
    119 
    120          dprintf(("lpszAccel %s\n", astring));
    121          lpszAccel = (LPWSTR)ConvertNameId(hinst, (char *)astring);
    122     }
    123     else dprintf(("lpszAccel %d\n", (int)lpszAccel));
    124 
    125     rc = O32_LoadAccelerators(hinst, (char *)lpszAccel);
    126     if(astring)
    127         FreeAsciiString(astring);
    128 
    129     dprintf(("LoadAcceleratorsW returned %d\n", rc));
    130     return(rc);
    131 }
    13292//******************************************************************************
    13393//******************************************************************************
     
    197157//******************************************************************************
    198158//******************************************************************************
    199 HMENU WIN32API LoadMenuA(HINSTANCE hinst, LPCSTR lpszMenu)
    200 {
    201  HMENU rc;
    202 
    203 #if 1
    204     rc = (HMENU)FindResourceA(hinst, lpszMenu, RT_MENUA);
    205 #else
    206     if((int)lpszMenu >> 16 != 0) {//convert string name identifier to numeric id
    207          dprintf(("lpszMenu %s\n", lpszMenu));
    208 
    209          lpszMenu = (LPCSTR)ConvertNameId(hinst, (char *)lpszMenu);
    210     }
    211     else dprintf(("lpszMenu %d\n", (int)lpszMenu));
    212 
    213     rc = O32_LoadMenu(hinst, lpszMenu);
    214 #endif
    215     dprintf(("LoadMenuA (%X) returned %d\n", hinst, rc));
    216     return(rc);
    217 }
    218 //******************************************************************************
    219 //******************************************************************************
    220 HMENU WIN32API LoadMenuW(HINSTANCE hinst, LPCWSTR lpszMenu)
    221 {
    222  HMENU rc;
    223 
    224 #if 1
    225     rc = (HMENU)FindResourceW(hinst, lpszMenu, RT_MENUW);
    226 #else
    227  char  *astring = NULL;
    228     if((int)lpszMenu >> 16 != 0) {//convert string name identifier to numeric id
    229          astring = UnicodeToAsciiString((LPWSTR)lpszMenu);
    230 
    231          dprintf(("lpszMenu %s\n", astring));
    232          lpszMenu = (LPWSTR)ConvertNameId(hinst, (char *)astring);
    233     }
    234     else dprintf(("lpszMenu %d\n", (int)lpszMenu));
    235 
    236     rc  = O32_LoadMenu(hinst, (char *)lpszMenu);
    237     if(astring)
    238         FreeAsciiString(astring);
    239 #endif
    240     dprintf(("LoadMenuW (%X) returned %d\n", hinst, rc));
    241     return(rc);
    242 }
    243 //******************************************************************************
    244 //******************************************************************************
    245 HMENU WIN32API LoadMenuIndirectA( const MENUITEMTEMPLATEHEADER * arg1)
    246 {
    247  char  *astring = NULL;
    248  HMENU rc;
    249 
    250     dprintf(("OS2LoadMenuIndirectA\n"));
    251 
    252     rc = O32_LoadMenuIndirect(arg1);
    253     if(astring)
    254         FreeAsciiString(astring);
    255     return(rc);
    256 }
    257 //******************************************************************************
    258 //Won't work...
    259 //******************************************************************************
    260 HMENU WIN32API LoadMenuIndirectW(const MENUITEMTEMPLATEHEADER * arg1)
    261 {
    262     dprintf(("OS2LoadMenuIndirectW, improperly implemented!!\n"));
    263 
    264     return 0;
    265 //    return O32_LoadMenuIndirect(arg1);
    266 }
    267159//******************************************************************************
    268160//TODO: Far from complete, but works for loading resources from exe
  • trunk/src/user32/new/makefile

    r336 r342  
    1 # $Id: makefile,v 1.12 1999-07-19 11:50:04 sandervl Exp $
     1# $Id: makefile,v 1.13 1999-07-20 07:42:35 sandervl Exp $
    22
    33#
     
    2323OBJS =  user32.obj resstring.obj dialog.obj loadres.obj \
    2424        dde.obj \
    25         icon.obj hook.obj hooks.obj menu.obj \
     25        icon.obj hook.obj hooks.obj winmenu.obj \
    2626        usrcall.obj defwndproc.obj syscolor.obj char.obj initterm.obj \
    2727        uitools.obj unknown.obj spy.obj wndmsg.obj \
     
    5757loadres.obj: loadres.cpp user32.h
    5858icon.obj: icon.cpp icon.h
    59 menu.obj: menu.cpp user32.h
     59winmenu.obj: winmenu.cpp user32.h $(PDWIN32_INCLUDE)\winres.h
    6060syscolor.obj: syscolor.cpp syscolor.h
    6161usrcall.obj: usrcall.cpp usrcall.h
     
    8686windowclass.obj: windowclass.cpp win32class.h win32wnd.h win32wndchild.h
    8787windowword.obj:  windowword.cpp win32class.h win32wnd.h win32dlg.h win32wndchild.h
    88 winaccel.obj:     winaccel.cpp
     88winaccel.obj:     winaccel.cpp  $(PDWIN32_INCLUDE)\winres.h
    8989winscrollbar.obj: winscrollbar.cpp
    9090
    9191pmwindow.obj:   pmwindow.cpp win32class.h win32wnd.h win32dlg.h pmwindow.h win32wndchild.h $(PDWIN32_INCLUDE)\wprocess.h  oslibgdi.h
    9292win32class.obj: win32class.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h
    93 win32wnd.obj:   win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h
     93win32wnd.obj:   win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h
    9494win32dlg.obj:   win32dlg.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h
    9595win32wndchild.obj: win32wndchild.cpp win32wndchild.h
  • trunk/src/user32/new/oslibgdi.cpp

    r340 r342  
    1 /* $Id: oslibgdi.cpp,v 1.3 1999-07-19 18:40:43 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.4 1999-07-20 07:42:35 sandervl Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    5454    }
    5555    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    56     point->y = rectParent.yTop - point->y;
     56    point->y = rectParent.yTop - point->y - 1;
    5757    return TRUE;
    5858}
  • trunk/src/user32/new/oslibgdi.h

    r340 r342  
    1 /* $Id: oslibgdi.h,v 1.2 1999-07-19 18:40:43 sandervl Exp $ */
     1/* $Id: oslibgdi.h,v 1.3 1999-07-20 07:42:35 sandervl Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    4343inline ULONG MapOS2ToWin32Y(Win32Window *window, ULONG y)
    4444{
    45     return window->getWindowHeight() - y;
     45    return window->getWindowHeight() - y - 1;
    4646}
    4747
  • trunk/src/user32/new/oslibmsg.cpp

    r321 r342  
    1 /* $Id: oslibmsg.cpp,v 1.1 1999-07-17 11:52:22 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.2 1999-07-20 07:42:35 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    99 * Project Odin Software License can be found in LICENSE.TXT
    1010 *
    11  * TODO: Simply copy for now. Probably need to make a real translation
     11 * TODO: Simply copy for now. Need to make a real translation
    1212 *
    1313 */
    1414#define  INCL_WIN
    1515#define  INCL_PM
     16#define  INCL_DOSPROCESS
    1617#include <os2.h>
    1718#include <os2wrap.h>
     
    1920#include <misc.h>
    2021#include "oslibmsg.h"
     22#include <win32wnd.h>
     23#include "oslibutil.h"
    2124
     25QMSG *MsgThreadPtr = 0;
     26
     27//******************************************************************************
     28//******************************************************************************
     29BOOL OSLibInitMsgQueue()
     30{
     31   if(DosAllocThreadLocalMemory(sizeof(QMSG)/sizeof(ULONG), (PULONG *)&MsgThreadPtr) != 0)
     32   {
     33        dprintf(("OSLibInitMsgQueue: local thread memory alloc failed!!"));
     34        DebugInt3();
     35        return FALSE;
     36   }
     37   return TRUE;
     38}
    2239//******************************************************************************
    2340//******************************************************************************
     
    3249{
    3350  memcpy(winMsg, os2Msg, sizeof(MSG));
     51  winMsg->hwnd = Win32Window::OS2ToWin32Handle(os2Msg->hwnd);
    3452}
    3553//******************************************************************************
     
    4260//******************************************************************************
    4361//******************************************************************************
     62void OSLibWinPostQuitMessage(ULONG nExitCode)
     63{
     64  WinPostQueueMsg(GetThreadMessageQueue(), WM_QUIT, (MPARAM)nExitCode, 0);
     65}
     66//******************************************************************************
     67//******************************************************************************
     68LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode)
     69{
     70//TODO: What to do if app changed msg? (translate)
     71//  WinToOS2MsgTranslate(msg, &qmsg, isUnicode);
     72 
     73  return (LONG)WinDispatchMsg(GetThreadHAB(), MsgThreadPtr);
     74}
     75//******************************************************************************
     76//******************************************************************************
     77BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, BOOL isUnicode)
     78{
     79 BOOL rc;
     80
     81  rc = WinGetMsg(GetThreadHAB(), MsgThreadPtr, TranslateWinMsg(uMsgFilterMin), TranslateWinMsg(uMsgFilterMax), 0);
     82  OS2ToWinMsgTranslate(MsgThreadPtr, pMsg, isUnicode);
     83  return rc;
     84}
     85//******************************************************************************
     86//******************************************************************************
  • trunk/src/user32/new/oslibmsg.h

    r321 r342  
    1 /* $Id: oslibmsg.h,v 1.1 1999-07-17 11:52:22 sandervl Exp $ */
     1/* $Id: oslibmsg.h,v 1.2 1999-07-20 07:42:35 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    1717void  WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode);
    1818
     19BOOL  OSLibInitMsgQueue();
     20
    1921#endif //__OSLIBMSG_H__
  • trunk/src/user32/new/oslibwin.cpp

    r340 r342  
    1 /* $Id: oslibwin.cpp,v 1.16 1999-07-19 18:40:43 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.17 1999-07-20 07:42:35 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    149149//******************************************************************************
    150150//******************************************************************************
     151BOOL OSLibWinSetAccelTable(HWND hwnd, PVOID acceltemplate)
     152{
     153 HACCEL haccel;
     154 HAB    hab = WinQueryAnchorBlock(hwnd);
     155
     156    haccel = WinCreateAccelTable(hab, (PACCELTABLE)acceltemplate);
     157    if(haccel == 0) {
     158        dprintf(("OSLibWinSetAccelTable: WinCreateAccelTable returned 0"));
     159        return FALSE;
     160    }
     161    return WinSetAccelTable(hab, haccel, hwnd);
     162}
     163//******************************************************************************
     164//******************************************************************************
    151165BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle)
    152166{
     
    333347//******************************************************************************
    334348//******************************************************************************
    335 void OSLibWinPostQuitMessage(ULONG nExitCode)
    336 {
    337   WinPostQueueMsg(GetThreadMessageQueue(), WM_QUIT, (MPARAM)nExitCode, 0);
    338 }
    339 //******************************************************************************
    340 //******************************************************************************
    341 LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode)
    342 {
    343  QMSG qmsg;
    344 
    345   WinToOS2MsgTranslate(msg, &qmsg, isUnicode);
    346   return (LONG)WinDispatchMsg(GetThreadHAB(), &qmsg);
    347 }
    348 //******************************************************************************
    349 //******************************************************************************
    350 BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, BOOL isUnicode)
    351 {
    352  QMSG qmsg;
    353  BOOL rc;
    354 
    355   rc = WinGetMsg(GetThreadHAB(), &qmsg, TranslateWinMsg(uMsgFilterMin), TranslateWinMsg(uMsgFilterMax), 0);
    356   OS2ToWinMsgTranslate(&qmsg, pMsg, isUnicode);
    357   return rc;
    358 }
    359 //******************************************************************************
    360 //******************************************************************************
    361349LONG OSLibWinQueryWindowTextLength(HWND hwnd)
    362350{
  • trunk/src/user32/new/oslibwin.h

    r332 r342  
    1 /* $Id: oslibwin.h,v 1.14 1999-07-18 18:04:29 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.15 1999-07-20 07:42:36 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    2828
    2929HWND  OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate);
     30BOOL  OSLibWinSetAccelTable(HWND hwnd, PVOID acceltemplate);
    3031
    3132#define WAOS_WARNING                 0
  • trunk/src/user32/new/pmwindow.cpp

    r340 r342  
    1 /* $Id: pmwindow.cpp,v 1.12 1999-07-19 18:40:43 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.13 1999-07-20 07:42:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    2424#include "oslibutil.h"
    2525#include "oslibgdi.h"
     26#include "oslibmsg.h"
    2627
    2728HMQ  hmq = 0;                             /* Message queue handle         */
     
    7576   }
    7677
    77    return(TRUE);
     78   return OSLibInitMsgQueue();
    7879} /* End of main */
    7980//******************************************************************************
     
    163164    case WM_ADJUSTWINDOWPOS:
    164165    {
    165       RECTLOS2 rectChild;
    166       ULONG x, y;
     166      ULONG    x, y;
     167      PSWP     pswp = (PSWP)mp1;
    167168
    168169        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
    169170
    170         WinQueryWindowRect(hwnd, (PRECTL)&rectChild);
    171 
    172         //Calculate position relative to parent window (real window or desktop)
    173         x = rectChild.xLeft;
    174 //        y = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
    175 
    176         if(win32wnd->MsgMove(x, y)) {
    177             goto RunDefWndProc;
    178         }
    179         break;
     171        if(pswp->fl & SWP_MOVE) {
     172            if(win32wnd->isChild()) {
     173                x = pswp->x;
     174                y = pswp->cy - y - 1;
     175            }
     176            else {
     177                OSLIBPOINT point;
     178
     179                point.x = pswp->x;
     180                point.y = pswp->y;
     181
     182                MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     183                x = point.x;
     184                y = point.y;
     185            }
     186            if(win32wnd->MsgMove(x, y)) {
     187                goto RunDefWndProc;
     188            }
     189            break;
     190        }
     191        goto RunDefWndProc;
    180192    }
    181193
     
    183195    {
    184196        dprintf(("OS2: WM_WINDOWPOSCHANGED %x", hwnd));
     197        goto RunDefWndProc;
    185198    }
    186199
     
    383396            win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
    384397        }
     398        if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
     399            win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
     400        }
    385401        //todo controls + accelerators
    386402        break;
    387403
    388404    case WM_SYSCOMMAND:
     405        dprintf(("WM_SYSCOMMAND"));
     406        break;
    389407
    390408    case WM_CHAR:
     409        dprintf(("WM_CHAR"));
    391410
    392411    case WM_INITMENU:
  • trunk/src/user32/new/user32.def

    r334 r342  
    1 ; $Id: user32.def,v 1.2 1999-07-18 20:41:12 cbratschi Exp $
     1; $Id: user32.def,v 1.3 1999-07-20 07:42:35 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    554554    TrackPopupMenu             = _TrackPopupMenu@28          @541
    555555    TrackPopupMenuEx           = _TrackPopupMenuEx@24        @542
    556     TranslateAccelerator       = _TranslateAccelerator@12    @543
     556    TranslateAccelerator       = _TranslateAcceleratorA@12   @543
    557557    TranslateAcceleratorA      = _TranslateAcceleratorA@12   @544
    558558    TranslateAcceleratorW      = _TranslateAcceleratorW@12   @545
  • trunk/src/user32/new/win32wnd.cpp

    r340 r342  
    1 /* $Id: win32wnd.cpp,v 1.16 1999-07-19 18:40:44 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.17 1999-07-20 07:42:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    9999  owner            = NULL;
    100100  windowClass      = 0;
     101
     102  acceltableResource = NULL;
     103  menuResource       = NULL;
    101104}
    102105//******************************************************************************
     
    115118//******************************************************************************
    116119//******************************************************************************
     120BOOL Win32Window::isChild()
     121{
     122    return (dwStyle & WS_CHILD) != 0;
     123}
     124//******************************************************************************
     125//******************************************************************************
    117126BOOL Win32Window::CreateWindowExA(CREATESTRUCTA *cs, ATOM classAtom)
    118127{
     
    121130 POINT maxSize, maxPos, minTrack, maxTrack;
    122131
    123   SetLastError(0);
    124 
    125   /* Find the parent window */
    126   if (cs->hwndParent)
    127   {
    128         Win32Window *window = GetWindowFromHandle(cs->hwndParent);
    129         if(!window) {
    130                 dprintf(("Bad parent %04x\n", cs->hwndParent ));
    131                 SetLastError(ERROR_INVALID_PARAMETER);
    132         return FALSE;
    133         }
    134         /* Make sure parent is valid */
    135         if (!window->IsWindow() )
    136         {
    137                 dprintf(("Bad parent %04x\n", cs->hwndParent ));
    138                 SetLastError(ERROR_INVALID_PARAMETER);
    139                 return FALSE;
    140         }
    141   }
    142   else
    143   if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) {
    144         dprintf(("No parent for child window\n" ));
    145         SetLastError(ERROR_INVALID_PARAMETER);
    146         return FALSE;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
    147   }
     132    SetLastError(0);
     133
     134    /* Find the parent window */
     135    if (cs->hwndParent)
     136    {
     137            Win32Window *window = GetWindowFromHandle(cs->hwndParent);
     138            if(!window) {
     139                    dprintf(("Bad parent %04x\n", cs->hwndParent ));
     140                    SetLastError(ERROR_INVALID_PARAMETER);
     141                    return FALSE;
     142            }
     143            /* Make sure parent is valid */
     144            if (!window->IsWindow() )
     145            {
     146                    dprintf(("Bad parent %04x\n", cs->hwndParent ));
     147                    SetLastError(ERROR_INVALID_PARAMETER);
     148                    return FALSE;
     149            }
     150    }
     151    else
     152    if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) {
     153            dprintf(("No parent for child window\n" ));
     154            SetLastError(ERROR_INVALID_PARAMETER);
     155            return FALSE;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
     156    }
    148157
    149158  /* Find the window class */
     
    666675//******************************************************************************
    667676//******************************************************************************
    668 ULONG Win32Window::MsgMove(ULONG xParent, ULONG yParent)
    669 {
    670   return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)xParent, (USHORT)yParent));
     677ULONG Win32Window::MsgMove(ULONG x, ULONG y)
     678{
     679  dprintf(("MsgMove to (%d,%d)", x, y));
     680  return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y));
    671681}
    672682//******************************************************************************
     
    680690        return 0; //todo
    681691    case CMD_ACCELERATOR:
     692        dprintf(("accelerator command"));
    682693        return 0; //todo
    683694  }
     
    733744 ULONG win32ncmsg;
    734745
     746  dprintf(("MsgButton to (%d,%d)", x, y));
    735747  switch(msg) {
    736748        case BUTTON_LEFTDOWN:
     
    10491061 Win32Resource *winres = (Win32Resource *)hMenu;
    10501062
    1051 #if 1
    1052     if(winres == NULL) {
     1063    if(HIWORD(winres) == 0) {
    10531064        dprintf(("Win32Window:: Win32Resource *winres == 0"));
     1065    SetLastError(ERROR_INVALID_PARAMETER);
    10541066        return FALSE;
    10551067    }
     
    10651077        return FALSE;
    10661078    }
     1079    menuResource = winres;
    10671080    return TRUE;
    1068 #else
    1069    if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR)
    1070    {
    1071     OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
    1072     if(OS2HwndMenu == 0) {
    1073         dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
    1074         return FALSE;
    1075     }
    1076    }
    1077    dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu));
    1078    return FALSE;
    1079 #endif
     1081}
     1082//******************************************************************************
     1083//******************************************************************************
     1084BOOL Win32Window::SetAccelTable(ULONG hAccel)
     1085{
     1086 Win32Resource *winres = (Win32Resource *)hAccel;
     1087
     1088    if(HIWORD(hAccel) == 0) {
     1089        dprintf(("SetAccelTable: hAccel %x invalid", hAccel));
     1090            SetLastError(ERROR_INVALID_PARAMETER);
     1091            return FALSE;
     1092    }
     1093    acceltableResource = winres;
     1094        return OSLibWinSetAccelTable(OS2HwndFrame, winres->lockOS2Resource());
    10801095}
    10811096//******************************************************************************
  • trunk/src/user32/new/win32wnd.h

    r340 r342  
    1 /* $Id: win32wnd.h,v 1.15 1999-07-19 18:40:44 sandervl Exp $ */
     1/* $Id: win32wnd.h,v 1.16 1999-07-20 07:42:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    1818#include <gen_object.h>
    1919#include <win32wndchild.h>
     20#include <winres.h>
    2021
    2122class Win32Window;
     
    8788         void   setWindowId(DWORD id)           { windowId = id; };
    8889         ULONG  getWindowHeight()               { return rectClient.bottom - rectClient.top; };
     90         BOOL   isChild();
    8991
    9092         DWORD  getFlags()                      { return flags; };
    9193         void   setFlags(DWORD newflags)        { flags = newflags; };
    9294
     95         ULONG  GetAccelTable()                     { return (ULONG) acceltableResource; };
     96         BOOL   SetAccelTable(ULONG hAccel);
     97
     98         ULONG  GetMenu()                           { return (ULONG) menuResource; };
    9399         BOOL   SetMenu(ULONG hMenu);
     100
    94101         BOOL   ShowWindow(ULONG nCmdShow);
    95102         BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
     
    182189   Win32Window *owner;                 
    183190
     191 Win32Resource *acceltableResource;
     192 Win32Resource *menuResource;
     193
    184194        char   *windowName;
    185195        ULONG   wndNameLength;
  • trunk/src/user32/new/winaccel.cpp

    r332 r342  
    1 /* $Id: winaccel.cpp,v 1.2 1999-07-18 18:04:30 sandervl Exp $ */
     1/* $Id: winaccel.cpp,v 1.3 1999-07-20 07:42:36 sandervl Exp $ */
    22/*
    33 * Win32 accelartor key functions for OS/2
     
    1111#include <os2win.h>
    1212#include <misc.h>
     13#include <win32wnd.h>
    1314
     15//******************************************************************************
     16//******************************************************************************
     17HACCEL WIN32API LoadAcceleratorsA(HINSTANCE hinst, LPCSTR lpszAcc)
     18{
     19 HACCEL rc;
     20
     21    rc = (HACCEL)FindResourceA(hinst, lpszAcc, RT_ACCELERATORA);
     22
     23    dprintf(("LoadAcceleratorsA returned %d\n", rc));
     24    return(rc);
     25}
     26//******************************************************************************
     27//******************************************************************************
     28HACCEL WIN32API LoadAcceleratorsW(HINSTANCE hinst, LPCWSTR lpszAccel)
     29{
     30 HACCEL rc;
     31
     32    rc = (HACCEL)FindResourceW(hinst, lpszAccel, RT_ACCELERATORW);
     33
     34    dprintf(("LoadAcceleratorsW returned %d\n", rc));
     35    return(rc);
     36}
     37//******************************************************************************
     38//******************************************************************************
     39BOOL WIN32API DestroyAcceleratorTable( HACCEL haccel)
     40{
     41 Win32Resource *winres;
     42
     43    if(HIWORD(haccel) == 0) {
     44        dprintf(("DestroyAcceleratorTable: invalid haccel %x", haccel));
     45        SetLastError(ERROR_INVALID_PARAMETER);
     46        return FALSE;
     47    }
     48    dprintf(("DestroyAcceleratorTable %x\n", haccel));
     49    winres = (Win32Resource *)haccel;
     50    delete winres;
     51    return TRUE;
     52}
    1453//******************************************************************************
    1554//TODO: Do more than just return?
     
    1756int WIN32API TranslateAcceleratorA(HWND hwnd, HACCEL haccel, LPMSG lpmsg)
    1857{
    19     //CB: needs more work
    20     //WinTranslateAccel();
    21     //get hab, translate
     58 Win32Window *window;
     59
     60    window = Win32Window::GetWindowFromHandle(hwnd);
     61    if(!window) {
     62//Msg for (non-client) child of our frame window
     63//      dprintf(("TranslateAcceleratorA, window %x not found", hwnd));
     64        return FALSE;
     65    }
     66    if(window->GetAccelTable() != haccel) {
     67        dprintf(("TranslateAcceleratorA %X %X %X", hwnd, haccel, lpmsg->hwnd));
     68        window->SetAccelTable(haccel);
     69    }
     70
    2271    //SvL: OS/2 automatically translates accelerator keys
    2372    return FALSE;
     
    2574//******************************************************************************
    2675//******************************************************************************
    27 int WIN32API TranslateAccelerator( HWND arg1, HACCEL arg2, LPMSG  arg3)
     76int WIN32API TranslateAcceleratorW( HWND hwnd, HACCEL hAccel, LPMSG lpMsg)
    2877{
    29     //SvL: OS/2 automatically translates accelerator keys
    30     return FALSE;
    31 }
    32 //******************************************************************************
    33 //******************************************************************************
    34 int WIN32API TranslateAcceleratorW( HWND arg1, HACCEL arg2, LPMSG  arg3)
    35 {
    36     //SvL: OS/2 automatically translates accelerator keys
    37     return FALSE;
     78    return TranslateAcceleratorA(hwnd, hAccel, lpMsg);
    3879}
    3980//******************************************************************************
     
    67108//******************************************************************************
    68109//******************************************************************************
    69 BOOL WIN32API DestroyAcceleratorTable( HACCEL arg1)
    70 {
    71 #ifdef DEBUG
    72     WriteLog("USER32:  DestroyAcceleratorTable\n");
    73 #endif
    74     return O32_DestroyAcceleratorTable(arg1);
    75 }
    76 //******************************************************************************
    77 //******************************************************************************
    78110int WIN32API CopyAcceleratorTableA(HACCEL hAccelSrc, LPACCEL lpAccelDest,
    79111                      int cAccelEntries)
Note: See TracChangeset for help on using the changeset viewer.