wxMGL bugfixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11351 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-08-12 00:13:37 +00:00
parent 2d2c394b59
commit fd495ab3ea
6 changed files with 32 additions and 35 deletions

View File

@@ -226,10 +226,12 @@ bool wxApp::SendIdleEvents(wxWindow* win)
int wxApp::MainLoop() int wxApp::MainLoop()
{ {
int rt;
gs_mainEventLoop = new wxEventLoop; gs_mainEventLoop = new wxEventLoop;
return gs_mainEventLoop->Run(); rt = gs_mainEventLoop->Run();
delete gs_mainEventLoop; delete gs_mainEventLoop;
gs_mainEventLoop = NULL; gs_mainEventLoop = NULL;
return rt;
} }
void wxApp::ExitMainLoop() void wxApp::ExitMainLoop()
@@ -239,7 +241,9 @@ void wxApp::ExitMainLoop()
bool wxApp::Initialized() 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() bool wxApp::Pending()
@@ -481,8 +485,7 @@ int wxEntry(int argc, char *argv[])
call OnRun() */ call OnRun() */
wxTheApp->DeletePendingObjects(); wxTheApp->DeletePendingObjects();
if ( wxTheApp->Initialized() && if ( wxTheApp->Initialized() )
wxTopLevelWindows.GetCount() != 0 )
{ {
wxTheApp->OnRun(); wxTheApp->OnRun();

View File

@@ -334,9 +334,7 @@ void wxDC::Clear()
wxCHECK_RET( Ok(), wxT("invalid dc") ); wxCHECK_RET( Ok(), wxT("invalid dc") );
m_MGLDC->makeCurrent(); // will go away with MGL6.0 m_MGLDC->makeCurrent(); // will go away with MGL6.0
m_MGLDC->clearDevice(); if ( m_backgroundBrush.GetStyle() != wxTRANSPARENT )
if ( m_backgroundBrush.GetStyle() != wxSOLID &&
m_backgroundBrush.GetStyle() != wxTRANSPARENT )
{ {
int w, h; int w, h;
wxBrush oldb = m_brush; 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) 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 m_MGLDC->makeCurrent(); // will go away with MGL6.0
DrawAnyText(text, x, y); DrawAnyText(text, x, y);
@@ -811,7 +808,6 @@ void wxDC::DoDrawRotatedText(const wxString& text,
wxCoord x, wxCoord y, wxCoord x, wxCoord y,
double angle) double angle)
{ {
if ( m_pen.GetStyle() == wxTRANSPARENT ) return;
m_MGLDC->makeCurrent(); // will go away with MGL6.0 m_MGLDC->makeCurrent(); // will go away with MGL6.0
if ( angle == 0 ) if ( angle == 0 )

View File

@@ -157,20 +157,18 @@ bool wxEventLoop::Dispatch()
wxCHECK_MSG( IsRunning(), FALSE, _T("can't call Dispatch() if not running") ); wxCHECK_MSG( IsRunning(), FALSE, _T("can't call Dispatch() if not running") );
event_t evt; event_t evt;
ibool rc = EVT_getNext(&evt, EVT_EVERYEVT); ibool rc;
if ( !rc ) rc = EVT_getNext(&evt, EVT_EVERYEVT);
while ( !rc )
{ {
wxLogError(_T("events queue empty even though Pending() returned true")); wxUsleep(1000);
return FALSE; 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); m_impl->ProcessEvent(&evt);
return m_impl->GetKeepLooping(); return m_impl->GetKeepLooping();
} }

View File

@@ -323,20 +323,17 @@ bool wxMGLFontFamily::HasFace(int type) const
wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font) wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font)
{ {
wxMGLFontFamily *family; wxMGLFontFamily *family;
wxString facename;
int type; int type;
wxString facename = font->GetFaceName();
if ( facename ) if ( !facename.IsEmpty() )
family = GetFamily(font->GetFaceName()); family = GetFamily(facename);
else else
family = NULL; family = NULL;
if ( family )
facename = font->GetFaceName();
else
facename.Empty();
if ( !family ) if ( !family )
{ {
facename.Empty();
switch (font->GetFamily()) switch (font->GetFamily())
{ {
case wxSCRIPT: case wxSCRIPT:

View File

@@ -24,7 +24,7 @@ wxColour wxSystemSettings::GetSystemColour(int WXUNUSED(index))
wxFont wxSystemSettings::GetSystemFont(int WXUNUSED(index)) wxFont wxSystemSettings::GetSystemFont(int WXUNUSED(index))
{ {
// FIXME_MGL // FIXME_MGL
return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL); return wxFont(12, wxSWISS, wxNORMAL, wxNORMAL);
} }
int wxSystemSettings::GetSystemMetric(int WXUNUSED(index)) int wxSystemSettings::GetSystemMetric(int WXUNUSED(index))

View File

@@ -98,6 +98,7 @@ enum
// b) the app has plenty of time in wxApp::OnInit to feed wxSystemOptions // b) the app has plenty of time in wxApp::OnInit to feed wxSystemOptions
// with desired settings // with desired settings
// FIXME_MGL -- move to app.cpp??
bool wxCreateMGL_WM() bool wxCreateMGL_WM()
{ {
int mode; int mode;
@@ -262,6 +263,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
m_wnd = MGL_wmCreateWindow(g_winMng, m_wnd = MGL_wmCreateWindow(g_winMng,
parent ? parent->GetHandle() : NULL, parent ? parent->GetHandle() : NULL,
pos.x, pos.y, size.x, size.y); pos.x, pos.y, size.x, size.y);
MGL_wmShowWindow(m_wnd, m_isShown);
MGL_wmSetWindowUserData(m_wnd, (void*) this); MGL_wmSetWindowUserData(m_wnd, (void*) this);
MGL_wmSetWindowPainter(m_wnd, wxWindowPainter); MGL_wmSetWindowPainter(m_wnd, wxWindowPainter);
return TRUE; return TRUE;
@@ -702,7 +704,6 @@ void wxWindowMGL::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect)
void wxWindowMGL::Update() void wxWindowMGL::Update()
{ {
Refresh();
if ( !m_frozen ) if ( !m_frozen )
MGL_wmUpdateDC(g_winMng); MGL_wmUpdateDC(g_winMng);
} }
@@ -725,12 +726,13 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
if ( m_frozen ) if ( m_frozen )
{ {
// Don't paint anything if the window is frozen. // Don't paint anything if the window is frozen.
m_refreshAfterThaw = TRUE;
return; return;
} }
region_t clip; MGLRegion clip;
MGL_getClipRegionDC(*dc, &clip); dc->getClipRegion(clip);
m_updateRegion = wxRegion(MGLRegion(&clip)); m_updateRegion = wxRegion(clip);
m_paintMGLDC = dc; m_paintMGLDC = dc;
{ {
@@ -749,6 +751,7 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
GetEventHandler()->ProcessEvent(eventPt); GetEventHandler()->ProcessEvent(eventPt);
m_paintMGLDC = NULL; m_paintMGLDC = NULL;
m_updateRegion.Clear();
} }