X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c151c737e514a8b8ccdc6eebc9a6d421e8d59ec..4fe0156b18e2330be391b804da341e546164b85f:/src/motif/dcscreen.cpp?ds=sidebyside diff --git a/src/motif/dcscreen.cpp b/src/motif/dcscreen.cpp index df547fe628..360acdfe14 100644 --- a/src/motif/dcscreen.cpp +++ b/src/motif/dcscreen.cpp @@ -1,29 +1,36 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dcscreen.cpp +// Name: src/motif/dcscreen.cpp // Purpose: wxScreenDC class // Author: Julian Smart // Modified by: // Created: 17/09/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// 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/dcscreen.h" -#include "wx/utils.h" +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/window.h" + #include "wx/frame.h" +#endif + +#ifdef __VMS__ +#pragma message disable nosimpint +#endif #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif -#include +#include "wx/motif/private.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) -#endif WXWindow wxScreenDC::sm_overlayWindow = 0; int wxScreenDC::sm_overlayWindowX = 0; @@ -34,7 +41,7 @@ wxScreenDC::wxScreenDC() { m_display = wxGetDisplay(); Display* display = (Display*) m_display; - + if (sm_overlayWindow) { m_pixmap = sm_overlayWindow; @@ -43,7 +50,7 @@ wxScreenDC::wxScreenDC() } else m_pixmap = (WXPixmap) RootWindow(display, DefaultScreen(display)); - + XGCValues gcvalues; gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); @@ -53,13 +60,14 @@ wxScreenDC::wxScreenDC() m_gc = XCreateGC (display, RootWindow (display, DefaultScreen (display)), GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); - - m_backgroundPixel = (int) gcvalues.background; - m_ok = TRUE; + + m_backgroundPixel = gcvalues.background; + m_ok = true; } wxScreenDC::~wxScreenDC() { + EndDrawingOnTop(); } bool wxScreenDC::StartDrawingOnTop(wxWindow* window) @@ -67,28 +75,28 @@ 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; rect.width = width; rect.height = height; - + return StartDrawingOnTop(& rect); } bool wxScreenDC::StartDrawingOnTop(wxRect* rect) { if (sm_overlayWindow) - return FALSE; - + return false; + Display *dpy = (Display*) wxGetDisplay(); Pixmap screenPixmap = RootWindow(dpy, DefaultScreen(dpy)); - + int x = 0; int y = 0; int width, height; wxDisplaySize(&width, &height); - + if (rect) { x = rect->x; y = rect->y; @@ -96,23 +104,23 @@ bool wxScreenDC::StartDrawingOnTop(wxRect* rect) } sm_overlayWindowX = x; sm_overlayWindowY = y; - + XSetWindowAttributes attributes; attributes.override_redirect = True; unsigned long valueMask = CWOverrideRedirect; - + sm_overlayWindow = (WXWindow) XCreateWindow(dpy, screenPixmap, x, y, width, height, 0, wxDisplayDepth(), InputOutput, DefaultVisual(dpy, 0), valueMask, & attributes); - + if (sm_overlayWindow) { XMapWindow(dpy, (Window) sm_overlayWindow); - return TRUE; + return true; } else - return FALSE; + return false; } bool wxScreenDC::EndDrawingOnTop() @@ -121,8 +129,8 @@ bool wxScreenDC::EndDrawingOnTop() { XDestroyWindow((Display*) wxGetDisplay(), (Window) sm_overlayWindow); sm_overlayWindow = 0; - return TRUE; + return true; } else - return FALSE; + return false; }