All mouse capture-related data doesn't have to be declared in wxWindow itself
and can just be global in wincmn.cpp, so move it there, this will facilitate
further changes as they won't require recompiling everything any more.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74673
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// base for dialog unit conversion, i.e. average character size
wxSize GetDlgUnitBase() const;
// base for dialog unit conversion, i.e. average character size
wxSize GetDlgUnitBase() const;
- // the stack of windows which have captured the mouse
- static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext;
-
- // the window that currently has mouse capture
- static wxWindow *ms_winCaptureCurrent;
-
- // indicates if execution is inside CaptureMouse/ReleaseMouse
- static bool ms_winCaptureChanging;
-
// number of Freeze() calls minus the number of Thaw() calls: we're frozen
// (i.e. not being updated) if it is positive
// number of Freeze() calls minus the number of Thaw() calls: we're frozen
// (i.e. not being updated) if it is positive
// mouse capture
// ----------------------------------------------------------------------------
// mouse capture
// ----------------------------------------------------------------------------
-struct WXDLLEXPORT wxWindowNext
+// Private data used for mouse capture tracking.
+namespace wxMouseCapture
+{
+
+// the stack of windows which have captured the mouse
+struct WindowNext
- wxWindowNext *next;
-} *wxWindowBase::ms_winCaptureNext = NULL;
-wxWindow *wxWindowBase::ms_winCaptureCurrent = NULL;
-bool wxWindowBase::ms_winCaptureChanging = false;
+ WindowNext *next;
+} *next = NULL;
+
+// the window that currently has mouse capture
+wxWindow *current = NULL;
+
+// indicates if execution is inside CaptureMouse/ReleaseMouse
+bool changing = false;
+
+} // wxMouseCapture
void wxWindowBase::CaptureMouse()
{
wxLogTrace(wxT("mousecapture"), wxT("CaptureMouse(%p)"), static_cast<void*>(this));
void wxWindowBase::CaptureMouse()
{
wxLogTrace(wxT("mousecapture"), wxT("CaptureMouse(%p)"), static_cast<void*>(this));
- wxASSERT_MSG( !ms_winCaptureChanging, wxT("recursive CaptureMouse call?") );
+ wxASSERT_MSG( !wxMouseCapture::changing, wxT("recursive CaptureMouse call?") );
- ms_winCaptureChanging = true;
+ wxMouseCapture::changing = true;
wxWindow *winOld = GetCapture();
if ( winOld )
wxWindow *winOld = GetCapture();
if ( winOld )
((wxWindowBase*) winOld)->DoReleaseMouse();
// save it on stack
((wxWindowBase*) winOld)->DoReleaseMouse();
// save it on stack
- wxWindowNext *item = new wxWindowNext;
+ wxMouseCapture::WindowNext *item = new wxMouseCapture::WindowNext;
- item->next = ms_winCaptureNext;
- ms_winCaptureNext = item;
+ item->next = wxMouseCapture::next;
+ wxMouseCapture::next = item;
}
//else: no mouse capture to save
DoCaptureMouse();
}
//else: no mouse capture to save
DoCaptureMouse();
- ms_winCaptureCurrent = (wxWindow*)this;
+ wxMouseCapture::current = (wxWindow*)this;
- ms_winCaptureChanging = false;
+ wxMouseCapture::changing = false;
}
void wxWindowBase::ReleaseMouse()
{
wxLogTrace(wxT("mousecapture"), wxT("ReleaseMouse(%p)"), static_cast<void*>(this));
}
void wxWindowBase::ReleaseMouse()
{
wxLogTrace(wxT("mousecapture"), wxT("ReleaseMouse(%p)"), static_cast<void*>(this));
- wxASSERT_MSG( !ms_winCaptureChanging, wxT("recursive ReleaseMouse call?") );
+ wxASSERT_MSG( !wxMouseCapture::changing, wxT("recursive ReleaseMouse call?") );
wxASSERT_MSG( GetCapture() == this,
"attempt to release mouse, but this window hasn't captured it" );
wxASSERT_MSG( GetCapture() == this,
"attempt to release mouse, but this window hasn't captured it" );
- wxASSERT_MSG( ms_winCaptureCurrent == this,
+ wxASSERT_MSG( wxMouseCapture::current == this,
"attempt to release mouse, but this window hasn't captured it" );
"attempt to release mouse, but this window hasn't captured it" );
- ms_winCaptureChanging = true;
+ wxMouseCapture::changing = true;
- ms_winCaptureCurrent = NULL;
+ wxMouseCapture::current = NULL;
- if ( ms_winCaptureNext )
+ if ( wxMouseCapture::next )
- ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse();
- ms_winCaptureCurrent = ms_winCaptureNext->win;
+ ((wxWindowBase*)wxMouseCapture::next->win)->DoCaptureMouse();
+ wxMouseCapture::current = wxMouseCapture::next->win;
- wxWindowNext *item = ms_winCaptureNext;
- ms_winCaptureNext = item->next;
+ wxMouseCapture::WindowNext *item = wxMouseCapture::next;
+ wxMouseCapture::next = item->next;
delete item;
}
//else: stack is empty, no previous capture
delete item;
}
//else: stack is empty, no previous capture
- ms_winCaptureChanging = false;
+ wxMouseCapture::changing = false;
wxLogTrace(wxT("mousecapture"),
(const wxChar *) wxT("After ReleaseMouse() mouse is captured by %p"),
wxLogTrace(wxT("mousecapture"),
(const wxChar *) wxT("After ReleaseMouse() mouse is captured by %p"),
{
// don't do anything if capture lost was expected, i.e. resulted from
// a wx call to ReleaseMouse or CaptureMouse:
{
// don't do anything if capture lost was expected, i.e. resulted from
// a wx call to ReleaseMouse or CaptureMouse:
- if ( ms_winCaptureChanging )
+ if ( wxMouseCapture::changing )
return;
// if the capture was lost unexpectedly, notify every window that has
// capture (on stack or current) about it and clear the stack:
return;
// if the capture was lost unexpectedly, notify every window that has
// capture (on stack or current) about it and clear the stack:
- if ( ms_winCaptureCurrent )
+ if ( wxMouseCapture::current )
- DoNotifyWindowAboutCaptureLost(ms_winCaptureCurrent);
- ms_winCaptureCurrent = NULL;
+ DoNotifyWindowAboutCaptureLost(wxMouseCapture::current);
+ wxMouseCapture::current = NULL;
- while ( ms_winCaptureNext )
+ while ( wxMouseCapture::next )
- wxWindowNext *item = ms_winCaptureNext;
- ms_winCaptureNext = item->next;
+ wxMouseCapture::WindowNext *item = wxMouseCapture::next;
+ wxMouseCapture::next = item->next;
DoNotifyWindowAboutCaptureLost(item->win);
DoNotifyWindowAboutCaptureLost(item->win);