[wxVTK] Fwd: [ wxvtk-Bugs-2024961 ] does not handle wxMouseCaptureLostEvent as required by wx
Brought to you by:
malat
|
From: Mathieu M. <mat...@gm...> - 2008-08-10 23:01:23
|
This has been fixed in current CVS HEAD. Thanks to Mu Shang for patch & report.
I have added blockers for version older than wx 2.8
Index: src/wxVTKRenderWindowInteractor.cxx
===================================================================
RCS file: /cvsroot/wxvtk/wxVTK/src/wxVTKRenderWindowInteractor.cxx,v
retrieving revision 1.38
diff -u -r1.38 wxVTKRenderWindowInteractor.cxx
--- src/wxVTKRenderWindowInteractor.cxx 10 Aug 2008 22:55:58 -0000 1.38
+++ src/wxVTKRenderWindowInteractor.cxx 10 Aug 2008 22:58:11 -0000
@@ -695,6 +695,7 @@
}
//---------------------------------------------------------------------------
+#if wxCHECK_VERSION(2, 8, 0)
void wxVTKRenderWindowInteractor::OnMouseCaptureLost(wxMouseCaptureLostEvent&
event)
{
if (ActiveButton != wxEVT_NULL)
@@ -708,6 +709,7 @@
// without a previous CaptureMouse().
ActiveButton = wxEVT_NULL;
}
+#endif
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::Render()
Index: src/wxVTKRenderWindowInteractor.h
===================================================================
RCS file: /cvsroot/wxvtk/wxVTK/src/wxVTKRenderWindowInteractor.h,v
retrieving revision 1.20
diff -u -r1.20 wxVTKRenderWindowInteractor.h
--- src/wxVTKRenderWindowInteractor.h 10 Aug 2008 22:55:58 -0000 1.20
+++ src/wxVTKRenderWindowInteractor.h 10 Aug 2008 22:58:11 -0000
@@ -131,7 +131,9 @@
void OnEnter(wxMouseEvent &event);
void OnLeave(wxMouseEvent &event);
void OnMouseWheel(wxMouseEvent& event);
+#if wxCHECK_VERSION(2, 8, 0)
void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
+#endif
void OnKeyDown(wxKeyEvent &event);
void OnKeyUp(wxKeyEvent &event);
void OnChar(wxKeyEvent &event);
Please report if you find any issues.
Thanks
-Mathieu
---------- Forwarded message ----------
From: SourceForge.net <no...@so...>
Date: Tue, Jul 22, 2008 at 8:59 PM
Subject: [ wxvtk-Bugs-2024961 ] does not handle
wxMouseCaptureLostEvent as required by wx
To: no...@so...
Bugs item #2024961, was opened at 2008-07-22 14:59
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=669338&aid=2024961&group_id=114757
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: shang (mshang)
Assigned to: Nobody/Anonymous (nobody)
Summary: does not handle wxMouseCaptureLostEvent as required by wx
Initial Comment:
wxMouseCaptureLostEvent is not handled as required by wxWidgets. On
Windows, this will generate two wxAssertFailure in debug build.
When the mouse capture is lost (for example, user used Alt+Tab key
combination to switch to another window), one wxAssertFailure is
generated because the class did not handle wxMouseCaptureLostEvent. If
the program is allowed to continue, when the same button is released
in the window, a second wxAssertFailure is generated because
ReleaseMouse() is called without a previous CaptureMouse(). wxWidgets
requires that the program does NOT call ReleaseMouse() if the mouse
capture was lost.
To fix the bug, add a wxMouseCaptureLostEvent handler:
EVT_MOUSE_CAPTURE_LOST(wxVTKRenderWindowInteractor::OnMouseCaptureLost)
void wxVTKRenderWindowInteractor::OnMouseCaptureLost(wxMouseCaptureLostEvent&
event)
{
if (ActiveButton != wxEVT_NULL)
{
//Maybe also invoke the button release event here
}
// Reset ActiveButton so that
// 1. we do not process mouse button up events any more,
// 2. the next button down event will be processed and call CaptureMouse().
// Otherwise ReleaseMouse() will be called
// without a previous CaptureMouse().
ActiveButton = wxEVT_NULL;
}
Optionally, we can also artificially give a button release event to
vtk inside the event handler, as indicated in comments in the above
code.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=669338&aid=2024961&group_id=114757
--
Mathieu
|