Corrected double clicks (always on the same window).

Corrected mouse up events (same window as mouse down).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15382 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-05-05 11:36:33 +00:00
parent a9d171bd00
commit 32b5be3d67
6 changed files with 374 additions and 320 deletions

View File

@@ -52,7 +52,15 @@
// ----------------------------------------------------------------------------
// list of all frames and modeless dialogs
wxWindowList wxModelessWindows;
wxWindowList wxModelessWindows;
// double click testing
static Point gs_lastWhere;
static long gs_lastWhen = 0;
// cursor stuff
extern int wxBusyCursorCount;
// ============================================================================
// wxTopLevelWindowMac implementation
@@ -347,10 +355,6 @@ void wxTopLevelWindowMac::Lower()
::SendBehind( (WindowRef)m_macWindow , NULL ) ;
}
Point lastWhere ;
long lastWhen = 0 ;
extern int wxBusyCursorCount ;
void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
{
EventRecord *ev = (EventRecord*) evr ;
@@ -397,22 +401,25 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
if ( ev->what == mouseDown )
{
if ( ev->when - lastWhen <= GetDblTime() )
if ( ev->when - gs_lastWhen <= GetDblTime() )
{
if ( abs( localwhere.h - lastWhere.h ) < 3 || abs( localwhere.v - lastWhere.v ) < 3 )
if ( abs( localwhere.h - gs_lastWhere.h ) < 3 && abs( localwhere.v - gs_lastWhere.v ) < 3 )
{
// This is not right if the second mouse down
// event occured in a differen window. We
// correct this in MacDispatchMouseEvent.
if ( controlDown )
event.SetEventType(wxEVT_RIGHT_DCLICK ) ;
else
event.SetEventType(wxEVT_LEFT_DCLICK ) ;
}
lastWhen = 0 ;
gs_lastWhen = 0 ;
}
else
{
lastWhen = ev->when ;
gs_lastWhen = ev->when ;
}
lastWhere = localwhere ;
gs_lastWhere = localwhere ;
}
event.m_x = localwhere.h;