Changeset 7195 for trunk/src


Ignore:
Timestamp:
Oct 24, 2001, 5:41:54 PM (24 years ago)
Author:
sandervl
Message:

double click fix + double click on system menu now works

Location:
trunk/src/user32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/menu.cpp

    r7079 r7195  
    1 /* $Id: menu.cpp,v 1.38 2001-10-16 14:49:45 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.39 2001-10-24 15:41:53 sandervl Exp $*/
    22/*
    33 * Menu functions
     
    3535#include "pmwindow.h"
    3636#include "win32wmisc.h"
     37#include "oslibmsg.h"
    3738
    3839#define DBG_LOCALLOG    DBG_menu
     
    28272828    }
    28282829
    2829     //EVENT_Capture( mt.hOwnerWnd, HTMENU ); //CB: todo
     2830#ifdef __WIN32OS2__
    28302831    //SvL: Set keyboard & mouse event capture
    28312832    SetCapture(mt.hOwnerWnd);
     2833    //SetCapture breaks system menu (double click), must generate double
     2834    //clicks manually
     2835    SetMenuDoubleClick(TRUE);
     2836#else
     2837    EVENT_Capture( mt.hOwnerWnd, HTMENU );
     2838#endif
    28322839
    28332840    while (!fEndMenu)
     
    28382845        /* we have to keep the message in the queue until it's
    28392846         * clear that menu loop is not over yet. */
    2840 //        if (!GetMessageA(&msg,msg.hwnd,0,0)) break;
     2847#ifdef __WIN32OS2__
    28412848        //SvL: Getting messages for only the menu delays background paints (i.e. VPBuddy logo)
    28422849        if (!GetMessageA(&msg,0,0,0)) break;
     2850#else
     2851        if (!GetMessageA(&msg,msg.hwnd,0,0)) break;
     2852#endif
    28432853        TranslateMessage( &msg );
    28442854        mt.pt = msg.pt;
     
    28682878                    if (bSysMenu && (hmenu == mt.hTopMenu))
    28692879                    {
     2880#ifdef __WIN32OS2__
     2881                        //double click on system menu -> close application
     2882                        PostMessageA(hwnd, WM_SYSCOMMAND,SC_CLOSE, msg.lParam);
     2883#endif
    28702884                        fEndMenu = TRUE;
    28712885                        break;
     
    30623076        else if (msg.message == WM_SYSCOMMAND)
    30633077        {
    3064                 /* The user clicked on the system menu/button */
    3065         fEndMenu = TRUE;
    3066         break;
     3078            /* The user clicked on the system menu/button */
     3079            fEndMenu = TRUE;
     3080            break;
    30673081        }
    30683082        else
     
    30793093        else mt.trackFlags &= ~TF_SKIPREMOVE;
    30803094    }
    3081 
     3095#ifdef __WIN32OS2__
     3096    SetMenuDoubleClick(FALSE);
    30823097    ReleaseCapture();
     3098#endif
    30833099
    30843100    menu = MENU_GetMenu(mt.hTopMenu);
  • trunk/src/user32/oslibmsg.h

    r6941 r7195  
    1 /* $Id: oslibmsg.h,v 1.15 2001-10-03 18:37:52 sandervl Exp $ */
     1/* $Id: oslibmsg.h,v 1.16 2001-10-24 15:41:53 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    3939BOOL  OSLibWinReplyMessage(ULONG result);
    4040ULONG OSLibWinQueryQueueStatus();
     41
     42void  SetMenuDoubleClick(BOOL fSet);
    4143
    4244BOOL  OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode);
  • trunk/src/user32/oslibmsgtranslate.cpp

    r7191 r7195  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.65 2001-10-24 13:18:59 phaller Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.66 2001-10-24 15:41:54 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    161161};
    162162
     163static BOOL fGenerateDoubleClick = FALSE;
     164static MSG  doubleClickMsg = {0};
     165
    163166//******************************************************************************
    164167//******************************************************************************
     
    185188{
    186189  return ((win32wnd->getLastHitTestVal() != HTCLIENT_W) && (WinQueryCapture(HWND_DESKTOP) != win32wnd->getOS2WindowHandle()));
     190}
     191//******************************************************************************
     192//******************************************************************************
     193void SetMenuDoubleClick(BOOL fSet)
     194{
     195  fGenerateDoubleClick = fSet;
    187196}
    188197//******************************************************************************
     
    389398        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    390399
     400        dprintf(("MsgButton %x (%x) %d at (%d,%d) time %x", winMsg->hwnd, os2Msg->hwnd, WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN), winMsg->pt.x, winMsg->pt.y, winMsg->time));
     401
    391402        HWND hwnd;
    392403
     
    445456            else goto dummymessage; //don't send mouse messages to disabled windows
    446457        }
     458
     459        DisableLogging();
     460        if ((winMsg->message == WINWM_LBUTTONDOWN) ||
     461            (winMsg->message == WINWM_RBUTTONDOWN) ||
     462            (winMsg->message == WINWM_MBUTTONDOWN) ||
     463            (winMsg->message == WINWM_NCLBUTTONDOWN) ||
     464            (winMsg->message == WINWM_NCRBUTTONDOWN) ||
     465            (winMsg->message == WINWM_NCMBUTTONDOWN))
     466        {
     467            if(fGenerateDoubleClick && doubleClickMsg.message == winMsg->message &&
     468               winMsg->time - doubleClickMsg.time < GetDoubleClickTime() &&
     469               (abs(winMsg->pt.x - doubleClickMsg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK_W)/2) &&
     470               (abs(winMsg->pt.y - doubleClickMsg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK_W)/2))
     471            {
     472                 dprintf(("single -> double click"));
     473                 if(winMsg->message >= WINWM_LBUTTONDOWN) {
     474                      winMsg->message += (WINWM_LBUTTONDBLCLK - WINWM_LBUTTONDOWN);
     475                 }
     476                 else winMsg->message += (WINWM_LBUTTONDBLCLK - WINWM_NCLBUTTONDOWN);
     477                 doubleClickMsg.message = 0;
     478            }
     479            else {
     480                 dprintf(("save for double click"));
     481                 doubleClickMsg = *winMsg;
     482                 if(doubleClickMsg.message >= WINWM_NCLBUTTONDOWN && doubleClickMsg.message <= WINWM_NCMBUTTONDOWN) {
     483                      doubleClickMsg.message += (WINWM_LBUTTONDOWN - WINWM_NCLBUTTONDOWN);
     484                 }
     485            }
     486        }
     487        EnableLogging();
     488
    447489        break;
    448490    }
  • trunk/src/user32/pmwindow.cpp

    r7110 r7195  
    1 /* $Id: pmwindow.cpp,v 1.156 2001-10-18 13:28:08 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.157 2001-10-24 15:41:54 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    331331    case WM_SHOW:
    332332        dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1));
    333         //SvL: When a window is made visible, then we don't receive a
    334         //     WM_VRNENABLED message (for some weird reason)
    335         win32wnd->callVisibleRgnNotifyProc(TRUE);
    336333        win32wnd->MsgShow((ULONG)mp1);
    337334        break;
     
    695692    {
    696693        //WM_CREATE handled during client window creation
    697         dprintf(("PMFRAME: WM_CREATE %x"));
     694        dprintf(("PMFRAME: WM_CREATE %x", hwnd));
    698695        goto RunDefFrameWndProc;
    699696    }
     
    972969        }
    973970
     971        //SvL: When a window is made visible, then we don't receive a
     972        //     WM_VRNENABLED message (for some weird reason)
     973        if(pswp->fl & SWP_SHOW) {
     974            win32wnd->callVisibleRgnNotifyProc(TRUE);
     975        }
     976        else
     977        if(pswp->fl & SWP_HIDE) {
     978            win32wnd->callVisibleRgnNotifyProc(FALSE);
     979        }
     980
    974981        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
    975982        {
  • trunk/src/user32/win32wbase.cpp

    r7183 r7195  
    1 /* $Id: win32wbase.cpp,v 1.294 2001-10-24 10:26:45 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.295 2001-10-24 15:41:54 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    10801080 BOOL  fClick = FALSE;
    10811081
    1082 //    dprintf(("MsgButton at (%d,%d)", msg->pt.x, msg->pt.y));
     1082    dprintf(("MsgButton %d at (%d,%d)", msg->message, msg->pt.x, msg->pt.y));
    10831083    switch(msg->message) {
    10841084        case WM_LBUTTONDBLCLK:
     
    10881088                {
    10891089                    msg->message = msg->message - (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); //dblclick -> down
    1090                     MsgButton(msg);
    1091                     msg->message++; //button-up
    10921090                    return MsgButton(msg);
    10931091                }
Note: See TracChangeset for help on using the changeset viewer.