]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/dcscreen.cpp
Don't crash on startup of console programs in monolithic wxX11 build.
[wxWidgets.git] / src / x11 / dcscreen.cpp
index 58f24d50caddeee19c7efd21bdaab45dfeafed4a..7eff9560cda26a2fa06d01b78cb24969d267661f 100644 (file)
@@ -1,53 +1,50 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dcscreen.cpp
+// Name:        src/x11/dcscreen.cpp
 // Purpose:     wxScreenDC class
 // Author:      Julian Smart, Robert Roebling
 // Modified by:
 // Created:     17/09/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart, Robert Roebling
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "dcscreen.h"
-#endif
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
 
-#include "wx/window.h"
-#include "wx/frame.h"
 #include "wx/dcscreen.h"
-#include "wx/utils.h"
-#include "wx/app.h"
-#include "wx/fontutil.h"
+#include "wx/x11/dcscreen.h"
 
-#include "wx/x11/private.h"
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/window.h"
+    #include "wx/frame.h"
+#endif
 
-//-----------------------------------------------------------------------------
-// global data initialization
-//-----------------------------------------------------------------------------
+#include "wx/fontutil.h"
 
-WXWindow *wxScreenDC::sm_overlayWindow  = (WXWindow*) NULL;
-int wxScreenDC::sm_overlayWindowX = 0;
-int wxScreenDC::sm_overlayWindowY = 0;
+#include "wx/x11/private.h"
 
 //-----------------------------------------------------------------------------
 // wxScreenDC
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
+IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl,wxPaintDCImpl)
 
-wxScreenDC::wxScreenDC()
+wxScreenDCImpl::wxScreenDCImpl( wxDC* owner )
+              : wxPaintDCImpl( owner )
 {
-    m_ok = FALSE;
-    
+    m_ok = false;
+
     m_display = (WXDisplay *) wxGlobalDisplay();
-    
+
     int screen = DefaultScreen( (Display*) m_display );
     m_cmap = (WXColormap) DefaultColormap( (Display*) m_display, screen );
-    
-    m_window = (WXWindow) RootWindow( (Display*) m_display, screen );
 
-    m_isScreenDC = TRUE;
+    m_x11window = (WXWindow) RootWindow( (Display*) m_display, screen );
+
+    m_isScreenDC = true;
 
 #if wxUSE_UNICODE
     m_context = wxTheApp->GetPangoContext();
@@ -62,64 +59,15 @@ wxScreenDC::wxScreenDC()
     XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, IncludeInferiors );
 }
 
-wxScreenDC::~wxScreenDC()
+wxScreenDCImpl::~wxScreenDCImpl()
 {
     XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
     XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, ClipByChildren );
     XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, ClipByChildren );
     XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, ClipByChildren );
-
-    EndDrawingOnTop();
-}
-
-bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
-{
-    if (!window) return StartDrawingOnTop();
-
-    int x = 0;
-    int y = 0;
-    window->GetPosition( &x, &y );
-    int w = 0;
-    int h = 0;
-    window->GetSize( &w, &h );
-    window->ClientToScreen( &x, &y );
-
-    wxRect rect;
-    rect.x = x;
-    rect.y = y;
-    rect.width = 0;
-    rect.height = 0;
-
-    return StartDrawingOnTop( &rect );
-}
-
-bool wxScreenDC::StartDrawingOnTop( wxRect *rectIn )
-{
-    // VZ: should we do the same thing that wxMotif wxScreenDC does here?
-#if 0
-    wxRect rect;
-    if ( rectIn )
-    {
-        rect = *rectIn;
-    }
-    else
-    {
-        rect.x =
-        rect.y = 0;
-
-        DoGetSize(&rect.width, &rect.height);
-    }
-#endif // 0
-
-    return TRUE;
-}
-
-bool wxScreenDC::EndDrawingOnTop()
-{
-    return TRUE;
 }
 
-void wxScreenDC::DoGetSize(int *width, int *height) const
+void wxScreenDCImpl::DoGetSize(int *width, int *height) const
 {
     wxDisplaySize(width, height);
 }