X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/20b6985553b4e01e7960847e3211d940aeff8742..cc44c7102fbab987280ad2dca7eb1e85ac70a9f6:/src/mac/carbon/dcclient.cpp diff --git a/src/mac/carbon/dcclient.cpp b/src/mac/carbon/dcclient.cpp index ac107c5cdf..f256b6b4ee 100644 --- a/src/mac/carbon/dcclient.cpp +++ b/src/mac/carbon/dcclient.cpp @@ -23,6 +23,7 @@ #include "wx/settings.h" #include "wx/math.h" #include "wx/mac/private.h" +#include "wx/log.h" //----------------------------------------------------------------------------- // constants @@ -118,7 +119,25 @@ wxWindowDC::wxWindowDC(wxWindow *window) SetBackground(MacGetBackgroundBrush(window)); } else - m_graphicContext = NULL ; + { + // as out of order redraw is not supported under CQ, we have to create a qd port for these + // situations + wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ; + if (!rootwindow) + return; + WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ; + int x , y ; + x = y = 0 ; + window->MacWindowToRootWindow( &x , &y ) ; + m_macLocalOrigin.x = x ; + m_macLocalOrigin.y = y ; + CGrafPtr port = UMAGetWindowPort( windowref ) ; + + m_graphicContext = new wxMacCGContext( port ) ; + m_graphicContext->SetPen( m_pen ) ; + m_graphicContext->SetBrush( m_brush ) ; + SetBackground(MacGetBackgroundBrush(window)); + } // there is no out-of-order drawing on OSX #else wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ; @@ -172,13 +191,13 @@ wxClientDC::wxClientDC(wxWindow *window) } else { - /* + // as out of order redraw is not supported under CQ, we have to create a qd port for these + // situations wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ; if (!rootwindow) return; WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ; wxPoint origin = window->GetClientAreaOrigin() ; - wxSize size = window->GetClientSize() ; int x , y ; x = origin.x ; y = origin.y ; @@ -191,9 +210,7 @@ wxClientDC::wxClientDC(wxWindow *window) m_graphicContext->SetPen( m_pen ) ; m_graphicContext->SetBrush( m_brush ) ; SetBackground(MacGetBackgroundBrush(window)); - m_ok = TRUE ; - */ - } + } m_ok = TRUE ; #else wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;