]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dcclient.cpp
don't define min/max macros in windows.h (closes 1052256)
[wxWidgets.git] / src / os2 / dcclient.cpp
index db4fb345624f341ee111903bb882309e3356c773..d02dd2bdcfcd694567846b5c7805f9ea6dc4ddd1 100644 (file)
@@ -70,7 +70,7 @@ static RECT        g_paintStruct;
 #ifdef __WXDEBUG__
     // a global variable which we check to verify that wxPaintDC are only
     // created in resopnse to WM_PAINT message - doing this from elsewhere is a
-    // common programming error among wxWindows programmers and might lead to
+    // common programming error among wxWidgets programmers and might lead to
     // very subtle and difficult to debug refresh/repaint bugs.
     int g_isPainting = 0;
 #endif // __WXDEBUG__
@@ -86,6 +86,8 @@ static RECT        g_paintStruct;
 wxWindowDC::wxWindowDC()
 {
     m_pCanvas = NULL;
+    m_PageSize.cx = m_PageSize.cy = 0;
+
 }
 
 wxWindowDC::wxWindowDC(
@@ -94,8 +96,12 @@ wxWindowDC::wxWindowDC(
 {
     ERRORID                         vError;
     wxString                        sError;
+    int                             nWidth, nHeight;
 
     m_pCanvas = pTheCanvas;
+    DoGetSize(&nWidth, &nHeight);
+    m_PageSize.cx = nWidth;
+    m_PageSize.cy = nHeight;
     m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(pTheCanvas) );
 
     //
@@ -109,11 +115,17 @@ wxWindowDC::wxWindowDC(
                            ,&m_PageSize
                            ,PU_PELS | GPIF_LONG | GPIA_ASSOC
                           );
+    if (!m_hPS)
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+        wxLogError("Unable to create presentation space. Error: %s\n", sError.c_str());
+    }
     ::GpiAssociate(m_hPS, NULLHANDLE);
     ::GpiAssociate(m_hPS, m_hDC);
 
     //
-    // Set the wxWindows color table
+    // Set the wxWidgets color table
     //
     if (!::GpiCreateLogColorTable( m_hPS
                                   ,0L
@@ -214,7 +226,7 @@ wxClientDC::wxClientDC(
                           ,PU_PELS | GPIF_LONG | GPIA_ASSOC
                          );
 
-    // Set the wxWindows color table
+    // Set the wxWidgets color table
     if (!::GpiCreateLogColorTable( m_hPS
                                   ,0L
                                   ,LCOLF_CONSECRGB