Added SetActive to wxEventLoop
Ensured Yield has a wxEventLoop (wxX11) Process size event explicitly in top-level SetSize (wxX11) Added wxYield to wxTopLevelWindow::Show (wxX11) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -47,6 +47,9 @@ public:
|
|||||||
// return currently active (running) event loop, may be NULL
|
// return currently active (running) event loop, may be NULL
|
||||||
static wxEventLoop *GetActive() { return ms_activeLoop; }
|
static wxEventLoop *GetActive() { return ms_activeLoop; }
|
||||||
|
|
||||||
|
// set currently active (running) event loop
|
||||||
|
static void SetActive(wxEventLoop* loop) { ms_activeLoop = loop; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the pointer to the port specific implementation class
|
// the pointer to the port specific implementation class
|
||||||
class WXDLLEXPORT wxEventLoopImpl *m_impl;
|
class WXDLLEXPORT wxEventLoopImpl *m_impl;
|
||||||
|
@@ -991,6 +991,16 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
|
|
||||||
s_inYield = TRUE;
|
s_inYield = TRUE;
|
||||||
|
|
||||||
|
// Make sure we have an event loop object,
|
||||||
|
// or Pending/Dispatch will fail
|
||||||
|
wxEventLoop* eventLoop = wxEventLoop::GetActive();
|
||||||
|
wxEventLoop* newEventLoop = NULL;
|
||||||
|
if (!eventLoop)
|
||||||
|
{
|
||||||
|
newEventLoop = new wxEventLoop;
|
||||||
|
wxEventLoop::SetActive(newEventLoop);
|
||||||
|
}
|
||||||
|
|
||||||
while (wxTheApp && wxTheApp->Pending())
|
while (wxTheApp && wxTheApp->Pending())
|
||||||
wxTheApp->Dispatch();
|
wxTheApp->Dispatch();
|
||||||
|
|
||||||
@@ -999,6 +1009,12 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
#endif
|
#endif
|
||||||
ProcessIdle();
|
ProcessIdle();
|
||||||
|
|
||||||
|
if (newEventLoop)
|
||||||
|
{
|
||||||
|
wxEventLoop::SetActive(NULL);
|
||||||
|
delete newEventLoop;
|
||||||
|
}
|
||||||
|
|
||||||
s_inYield = FALSE;
|
s_inYield = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -280,7 +280,6 @@ bool wxTopLevelWindowX11::Show(bool show)
|
|||||||
|
|
||||||
m_needResizeInIdle = FALSE;
|
m_needResizeInIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
// This does the layout _before_ the
|
// This does the layout _before_ the
|
||||||
@@ -292,8 +291,10 @@ bool wxTopLevelWindowX11::Show(bool show)
|
|||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wxYield();
|
||||||
|
|
||||||
return wxWindowX11::Show(show);
|
bool ret = wxWindowX11::Show(show);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -637,8 +638,9 @@ void wxTopLevelWindowX11::DoSetClientSize(int width, int height)
|
|||||||
|
|
||||||
void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
|
// wxLogDebug("DoSetSize: %s (%ld) %d, %d %dx%d", GetClassInfo()->GetClassName(), GetId(), x, y, width, height);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// wxLogDebug( "Setting pos: %d, %d", x, y );
|
|
||||||
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
||||||
#endif
|
#endif
|
||||||
XSync(wxGlobalDisplay(), False);
|
XSync(wxGlobalDisplay(), False);
|
||||||
@@ -715,6 +717,11 @@ void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int siz
|
|||||||
XSync(wxGlobalDisplay(), False);
|
XSync(wxGlobalDisplay(), False);
|
||||||
XSync(wxGlobalDisplay(), False);
|
XSync(wxGlobalDisplay(), False);
|
||||||
#endif
|
#endif
|
||||||
|
#if 1
|
||||||
|
wxSizeEvent event(wxSize(width, height), GetId());
|
||||||
|
event.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
||||||
|
@@ -735,6 +735,8 @@ void wxWindowX11::DoGetClientSize(int *x, int *y) const
|
|||||||
|
|
||||||
void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
|
// wxLogDebug("DoSetSize: %s (%ld) %d, %d %dx%d", GetClassInfo()->GetClassName(), GetId(), x, y, width, height);
|
||||||
|
|
||||||
Window xwindow = (Window) GetMainWindow();
|
Window xwindow = (Window) GetMainWindow();
|
||||||
|
|
||||||
wxCHECK_RET( xwindow, wxT("invalid window") );
|
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||||
@@ -775,10 +777,18 @@ void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DoMoveWindow( new_x, new_y, new_w, new_h );
|
DoMoveWindow( new_x, new_y, new_w, new_h );
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
wxSizeEvent event(wxSize(new_w, new_h), GetId());
|
||||||
|
event.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowX11::DoSetClientSize(int width, int height)
|
void wxWindowX11::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
|
// wxLogDebug("DoSetClientSize: %s (%ld) %dx%d", GetClassInfo()->GetClassName(), GetId(), width, height);
|
||||||
|
|
||||||
Window xwindow = (Window) GetMainWindow();
|
Window xwindow = (Window) GetMainWindow();
|
||||||
|
|
||||||
wxCHECK_RET( xwindow, wxT("invalid window") );
|
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||||
@@ -787,6 +797,12 @@ void wxWindowX11::DoSetClientSize(int width, int height)
|
|||||||
|
|
||||||
XResizeWindow( wxGlobalDisplay(), xwindow, width, height );
|
XResizeWindow( wxGlobalDisplay(), xwindow, width, height );
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
wxSizeEvent event(wxSize(width, height), GetId());
|
||||||
|
event.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
@@ -1053,6 +1069,8 @@ void wxWindowX11::SendEraseEvents()
|
|||||||
|
|
||||||
void wxWindowX11::SendPaintEvents()
|
void wxWindowX11::SendPaintEvents()
|
||||||
{
|
{
|
||||||
|
// wxLogDebug("SendPaintEvents: %s (%ld)", GetClassInfo()->GetClassName(), GetId());
|
||||||
|
|
||||||
m_clipPaintRegion = TRUE;
|
m_clipPaintRegion = TRUE;
|
||||||
|
|
||||||
wxNcPaintEvent nc_paint_event( GetId() );
|
wxNcPaintEvent nc_paint_event( GetId() );
|
||||||
|
Reference in New Issue
Block a user