From fd495ab3ea1282ddb8bb0cd0fb79fc758ae5fcee Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 12 Aug 2001 00:13:37 +0000 Subject: [PATCH] wxMGL bugfixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11351 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mgl/app.cpp | 11 +++++++---- src/mgl/dc.cpp | 10 +++------- src/mgl/evtloop.cpp | 18 ++++++++---------- src/mgl/fontutil.cpp | 13 +++++-------- src/mgl/settings.cpp | 2 +- src/mgl/window.cpp | 11 +++++++---- 6 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/mgl/app.cpp b/src/mgl/app.cpp index d8b012870e..d9288130de 100644 --- a/src/mgl/app.cpp +++ b/src/mgl/app.cpp @@ -226,10 +226,12 @@ bool wxApp::SendIdleEvents(wxWindow* win) int wxApp::MainLoop() { + int rt; gs_mainEventLoop = new wxEventLoop; - return gs_mainEventLoop->Run(); + rt = gs_mainEventLoop->Run(); delete gs_mainEventLoop; gs_mainEventLoop = NULL; + return rt; } void wxApp::ExitMainLoop() @@ -239,7 +241,9 @@ void wxApp::ExitMainLoop() bool wxApp::Initialized() { - return (GetTopWindow() != NULL); + // FIXME_MGL -- only for now because we don't have wxFrame/wxDialog yet + return TRUE; + //return (wxTopLevelWindows.GetCount() != 0); } bool wxApp::Pending() @@ -481,8 +485,7 @@ int wxEntry(int argc, char *argv[]) call OnRun() */ wxTheApp->DeletePendingObjects(); - if ( wxTheApp->Initialized() && - wxTopLevelWindows.GetCount() != 0 ) + if ( wxTheApp->Initialized() ) { wxTheApp->OnRun(); diff --git a/src/mgl/dc.cpp b/src/mgl/dc.cpp index a2d932bd5a..4b556de6b7 100644 --- a/src/mgl/dc.cpp +++ b/src/mgl/dc.cpp @@ -239,7 +239,7 @@ void wxDC::DoSetClippingRegion(wxCoord cx, wxCoord cy, wxCoord cw, wxCoord ch) if ( m_globalClippingRegion ) { - m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion() + m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion() & *m_globalClippingRegion); } else @@ -284,7 +284,7 @@ void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) if ( m_globalClippingRegion ) { - m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion() + m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion() & *m_globalClippingRegion); } else @@ -334,9 +334,7 @@ void wxDC::Clear() wxCHECK_RET( Ok(), wxT("invalid dc") ); m_MGLDC->makeCurrent(); // will go away with MGL6.0 - m_MGLDC->clearDevice(); - if ( m_backgroundBrush.GetStyle() != wxSOLID && - m_backgroundBrush.GetStyle() != wxTRANSPARENT ) + if ( m_backgroundBrush.GetStyle() != wxTRANSPARENT ) { int w, h; wxBrush oldb = m_brush; @@ -717,7 +715,6 @@ void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,d void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) { - if ( m_pen.GetStyle() == wxTRANSPARENT ) return; m_MGLDC->makeCurrent(); // will go away with MGL6.0 DrawAnyText(text, x, y); @@ -811,7 +808,6 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) { - if ( m_pen.GetStyle() == wxTRANSPARENT ) return; m_MGLDC->makeCurrent(); // will go away with MGL6.0 if ( angle == 0 ) diff --git a/src/mgl/evtloop.cpp b/src/mgl/evtloop.cpp index 9f8161da68..9e69b980a6 100644 --- a/src/mgl/evtloop.cpp +++ b/src/mgl/evtloop.cpp @@ -157,20 +157,18 @@ bool wxEventLoop::Dispatch() wxCHECK_MSG( IsRunning(), FALSE, _T("can't call Dispatch() if not running") ); event_t evt; - ibool rc = EVT_getNext(&evt, EVT_EVERYEVT); - - if ( !rc ) + ibool rc; + + rc = EVT_getNext(&evt, EVT_EVERYEVT); + while ( !rc ) { - wxLogError(_T("events queue empty even though Pending() returned true")); - return FALSE; + wxUsleep(1000); + if ( !m_impl->GetKeepLooping() ) + return FALSE; + rc = EVT_getNext(&evt, EVT_EVERYEVT); } - - // FIXME_MGL -- there must be some way to programatically exit - // the loop, like WM_QUIT under Windows -- perhaps we need custom - // event to indicate this?? m_impl->ProcessEvent(&evt); return m_impl->GetKeepLooping(); } - diff --git a/src/mgl/fontutil.cpp b/src/mgl/fontutil.cpp index 78d0443857..cc361b21b1 100644 --- a/src/mgl/fontutil.cpp +++ b/src/mgl/fontutil.cpp @@ -323,20 +323,17 @@ bool wxMGLFontFamily::HasFace(int type) const wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font) { wxMGLFontFamily *family; - wxString facename; int type; + wxString facename = font->GetFaceName(); - if ( facename ) - family = GetFamily(font->GetFaceName()); + if ( !facename.IsEmpty() ) + family = GetFamily(facename); else family = NULL; - if ( family ) - facename = font->GetFaceName(); - else - facename.Empty(); - + if ( !family ) { + facename.Empty(); switch (font->GetFamily()) { case wxSCRIPT: diff --git a/src/mgl/settings.cpp b/src/mgl/settings.cpp index fab6801169..fc10a6bb0e 100644 --- a/src/mgl/settings.cpp +++ b/src/mgl/settings.cpp @@ -24,7 +24,7 @@ wxColour wxSystemSettings::GetSystemColour(int WXUNUSED(index)) wxFont wxSystemSettings::GetSystemFont(int WXUNUSED(index)) { // FIXME_MGL - return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL); + return wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); } int wxSystemSettings::GetSystemMetric(int WXUNUSED(index)) diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 1ac85be6fa..210c50ec9b 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -98,6 +98,7 @@ enum // b) the app has plenty of time in wxApp::OnInit to feed wxSystemOptions // with desired settings +// FIXME_MGL -- move to app.cpp?? bool wxCreateMGL_WM() { int mode; @@ -262,6 +263,7 @@ bool wxWindowMGL::Create(wxWindow *parent, m_wnd = MGL_wmCreateWindow(g_winMng, parent ? parent->GetHandle() : NULL, pos.x, pos.y, size.x, size.y); + MGL_wmShowWindow(m_wnd, m_isShown); MGL_wmSetWindowUserData(m_wnd, (void*) this); MGL_wmSetWindowPainter(m_wnd, wxWindowPainter); return TRUE; @@ -702,7 +704,6 @@ void wxWindowMGL::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect) void wxWindowMGL::Update() { - Refresh(); if ( !m_frozen ) MGL_wmUpdateDC(g_winMng); } @@ -725,12 +726,13 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc) if ( m_frozen ) { // Don't paint anything if the window is frozen. + m_refreshAfterThaw = TRUE; return; } - region_t clip; - MGL_getClipRegionDC(*dc, &clip); - m_updateRegion = wxRegion(MGLRegion(&clip)); + MGLRegion clip; + dc->getClipRegion(clip); + m_updateRegion = wxRegion(clip); m_paintMGLDC = dc; { @@ -749,6 +751,7 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc) GetEventHandler()->ProcessEvent(eventPt); m_paintMGLDC = NULL; + m_updateRegion.Clear(); } -- 2.45.2