]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/dcscreen.cpp
fix another memory leak in SetCommand() (coverity checker CID 52)
[wxWidgets.git] / src / motif / dcscreen.cpp
index df547fe628877bffdda5bbec0036e5b62f3a6b16..762a7401019aed02df95785a8da6b54531520119 100644 (file)
@@ -9,21 +9,25 @@
 // 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/window.h"
+#include "wx/frame.h"
 #include "wx/dcscreen.h"
 #include "wx/utils.h"
 
 #include "wx/dcscreen.h"
 #include "wx/utils.h"
 
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
 #include <Xm/Xm.h>
 #include <Xm/Xm.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
 
 
-#include <wx/motif/private.h>
+#include "wx/motif/private.h"
 
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
-#endif
 
 WXWindow wxScreenDC::sm_overlayWindow = 0;
 int wxScreenDC::sm_overlayWindowX = 0;
 
 WXWindow wxScreenDC::sm_overlayWindow = 0;
 int wxScreenDC::sm_overlayWindowX = 0;
@@ -55,11 +59,12 @@ wxScreenDC::wxScreenDC()
         &gcvalues);
     
     m_backgroundPixel = (int) gcvalues.background;
         &gcvalues);
     
     m_backgroundPixel = (int) gcvalues.background;
-    m_ok = TRUE;
+    m_ok = true;
 }
 
 wxScreenDC::~wxScreenDC()
 {
 }
 
 wxScreenDC::~wxScreenDC()
 {
+    EndDrawingOnTop();
 }
 
 bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
 }
 
 bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
@@ -67,7 +72,7 @@ bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
     wxRect rect;
     int x, y, width, height;
     window->GetPosition(& x, & y);
     wxRect rect;
     int x, y, width, height;
     window->GetPosition(& x, & y);
-    if (window->GetParent())
+    if (window->GetParent() && !window->IsKindOf(CLASSINFO(wxFrame)))
         window->GetParent()->ClientToScreen(& x, & y);
     window->GetSize(& width, & height);
     rect.x = x; rect.y = y;
         window->GetParent()->ClientToScreen(& x, & y);
     window->GetSize(& width, & height);
     rect.x = x; rect.y = y;
@@ -79,7 +84,7 @@ bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
 bool wxScreenDC::StartDrawingOnTop(wxRect* rect)
 {
     if (sm_overlayWindow)
 bool wxScreenDC::StartDrawingOnTop(wxRect* rect)
 {
     if (sm_overlayWindow)
-        return FALSE;
+        return false;
     
     Display *dpy = (Display*) wxGetDisplay();
     Pixmap screenPixmap = RootWindow(dpy, DefaultScreen(dpy));
     
     Display *dpy = (Display*) wxGetDisplay();
     Pixmap screenPixmap = RootWindow(dpy, DefaultScreen(dpy));
@@ -109,10 +114,10 @@ bool wxScreenDC::StartDrawingOnTop(wxRect* rect)
     if (sm_overlayWindow)
     {
         XMapWindow(dpy, (Window) sm_overlayWindow);
     if (sm_overlayWindow)
     {
         XMapWindow(dpy, (Window) sm_overlayWindow);
-        return TRUE;
+        return true;
     }
     else
     }
     else
-        return FALSE;
+        return false;
 }
 
 bool wxScreenDC::EndDrawingOnTop()
 }
 
 bool wxScreenDC::EndDrawingOnTop()
@@ -121,8 +126,8 @@ bool wxScreenDC::EndDrawingOnTop()
     {
         XDestroyWindow((Display*) wxGetDisplay(), (Window) sm_overlayWindow);
         sm_overlayWindow = 0;
     {
         XDestroyWindow((Display*) wxGetDisplay(), (Window) sm_overlayWindow);
         sm_overlayWindow = 0;
-        return TRUE;
+        return true;
     }
     else
     }
     else
-        return FALSE;
+        return false;
 }
 }