X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..c978d36124197b5612a2cabefed7591ad0eea6e2:/src/motif/dcscreen.cpp

diff --git a/src/motif/dcscreen.cpp b/src/motif/dcscreen.cpp
index 1b0597df23..1da45d5e39 100644
--- a/src/motif/dcscreen.cpp
+++ b/src/motif/dcscreen.cpp
@@ -14,6 +14,7 @@
 #endif
 
 #include "wx/window.h"
+#include "wx/frame.h"
 #include "wx/dcscreen.h"
 #include "wx/utils.h"
 
@@ -64,6 +65,7 @@ wxScreenDC::wxScreenDC()
 
 wxScreenDC::~wxScreenDC()
 {
+    EndDrawingOnTop();
 }
 
 bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
@@ -71,7 +73,7 @@ bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
     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;