0023885: Inclusion of X11 header should be protected with macro
authordbv <dbv@opencascade.com>
Fri, 12 Apr 2013 09:44:46 +0000 (13:44 +0400)
committerdbv <dbv@opencascade.com>
Fri, 12 Apr 2013 09:44:46 +0000 (13:44 +0400)
X11 headers inclusions have been protected with macro
Remarks fix

src/AlienImage/AlienImage_X11XWDAlienData.cxx
src/AlienImage/AlienImage_X11XWDFileHeader.cxx
src/Aspect/Aspect_XWD.hxx
src/Draw/Draw_Window.cxx
src/Draw/Draw_WindowBase.hxx [deleted file]
src/Draw/FILES
src/QADraw/QADraw.cxx

index 3aea541..b2f57bd 100755 (executable)
@@ -29,7 +29,7 @@
 #define TEST   //GG_140699
 //             Check file extension, must be ".xwd".
 
-#ifndef WNT
+#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
 # include <X11/Xlib.h>
 #endif  // WNT
 #include <Aspect_GenericColorMap.hxx>
index 2b03bb2..49b5183 100755 (executable)
@@ -16,7 +16,7 @@
 // purpose or non-infringement. Please see the License for the specific terms
 // and conditions governing the rights and limitations under the License.
 
-#ifndef WNT
+#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
 # include <X11/Xlib.h>
 #endif  // WNT
 #include <AlienImage_X11XWDFileHeader.hxx>
index fb36ecc..b91e848 100755 (executable)
@@ -18,7 +18,7 @@
 #ifndef __Aspect_WNTXWD_HXX
 # define __Aspect_WNTXWD_HXX
 
-# ifndef WNT
+#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
 #  include <X11/XWDFile.h>
 # else
 
index cd55392..539bab4 100755 (executable)
@@ -134,10 +134,6 @@ defaultPrompt:
 # include <strings.h>
 #endif
 
-
-#include <Draw_WindowBase.hxx>
-#include <X11/XWDFile.h>
-
 #include <stdio.h>
 #include <tk.h>
 
@@ -174,10 +170,7 @@ static Standard_Boolean tty;        /* Non-zero means standard input is a
 
 static unsigned long thePixels[MAXCOLOR];
 
-
-Display*         Draw_WindowDisplay = NULL;
 Standard_Integer Draw_WindowScreen = 0;
-Colormap         Draw_WindowColorMap;
 Standard_Boolean Draw_BlackBackGround = Standard_True;
 
 
@@ -187,10 +180,21 @@ Draw_Window* Draw_Window::firstWindow = NULL;
 
 // X11 specific part
 #if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
+#include <X11/Xutil.h>
 #include <Aspect_DisplayConnection.hxx>
 
+Display* Draw_WindowDisplay = NULL;
+Colormap Draw_WindowColorMap;
 static Handle(Aspect_DisplayConnection) Draw_DisplayConnection;
 
+// Base_Window struct definition
+//===================================
+struct Base_Window
+{
+  GC gc;
+  XSetWindowAttributes xswa;
+};
+
 //=======================================================================
 //function : Draw_Window
 //purpose  :
@@ -597,6 +601,7 @@ void Draw_Window::Hide()
 //=======================================================================
 void Draw_Window::Destroy()
 {
+  XFreeGC (Draw_WindowDisplay, base.gc);
   XDestroyWindow(Draw_WindowDisplay, win);
   win = 0;
   if (myBuffer != 0)
diff --git a/src/Draw/Draw_WindowBase.hxx b/src/Draw/Draw_WindowBase.hxx
deleted file mode 100755 (executable)
index 12c81ee..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// Created on: 1995-03-17
-// Created by: Remi LEQUETTE
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#ifndef _Draw_WindowBase_HeaderFile
-#define _Draw_WindowBase_HeaderFile
-
-#ifndef WNT
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#endif
-
-// Definition de la class Base_Window 
-//===================================
-struct Base_Window
-{
-    GC gc;
-    XSetWindowAttributes xswa;
-};
-
-
-#endif
index 2e588e8..9f0dd1a 100755 (executable)
@@ -13,7 +13,6 @@ Draw_Viewer.hxx
 Draw_Viewer.hxx
 Draw_Window.cxx
 Draw_Window.hxx
-Draw_WindowBase.hxx
 Draw_PInterp.hxx
 Draw_CommandFunction.hxx
 DrawRessource.h
index 5cdfb95..1b88619 100755 (executable)
 // purpose or non-infringement. Please see the License for the specific terms
 // and conditions governing the rights and limitations under the License.
 
-
-
-#if defined(WNT)
-#include <windows.h>
-#endif
 #include <QADraw.hxx>
 #include <QADraw_DataMapOfAsciiStringOfAddress.hxx>
 #include <Draw_Interpretor.hxx>
 #include <stdio.h>
 #include <Aspect_DisplayConnection.hxx>
 #include <Graphic3d.hxx>
+#include <Aspect_Window.hxx>
 
-#if ! defined(WNT)
-#include <Xw_Window.hxx>
-//#include <Xm/Xm.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <Xw_Cextern.hxx>
-#include <unistd.h>
+#if defined(_WIN32) || defined(__WIN32__)
+#  include <windows.h>
+#  include <io.h>
 #else
-#include <WNT.h>
-#include <WNT_Window.hxx>
-#include <io.h>
+#  include <unistd.h>
 #endif
 
 #include <tcl.h>
@@ -448,88 +438,11 @@ static Standard_Integer QAAISGetMousePoint (Draw_Interpretor& di, Standard_Integ
   return 0;
 }
 
-static Standard_Integer QAAISGetColorCoord (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
-  if ( argc > 1 ) {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-  Handle(Xw_Window) QAAISWindow;
-
-  Handle (V3d_View) QAAIS_MainView = ViewerTest::CurrentView ();
-  if ( QAAIS_MainView.IsNull () ) {
-    di << "You must initialize AISViewer before this command." << "\n";
-    return 1;
-  }
-  QAAISWindow = Handle(Xw_Window)::DownCast (QAAIS_MainView->V3d_View::Window());
-
-  Standard_Integer QAAIS_WindowSize_X = 0;
-  Standard_Integer QAAIS_WindowSize_Y = 0;
-  QAAISWindow->Size(QAAIS_WindowSize_X, QAAIS_WindowSize_Y);
-  Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();
-  Handle(Graphic3d_GraphicDriver)  aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
-
-  Draw_Window QAAIS_CoordWindow ("coordinate", 421, 205, 200, 60);
-  QAAIS_CoordWindow.DisplayWindow ();
-  QAAIS_CoordWindow.SetColor (12);
-
-  Handle (Xw_Window) QAAIS_ColorWindow = new Xw_Window (aDisplayConnection, "color", 0.4074, 0.678, 0.1962, 0.06, Quantity_NOC_BLACK);
-  Handle (V3d_Viewer) QAAIS_ColorViewer = new V3d_Viewer (aGraphicDriver, Standard_ExtString ("COLOR"));
-  Handle (V3d_View) QAAIS_ColorView = QAAIS_ColorViewer -> CreateView ();
-  QAAIS_ColorWindow -> Map ();
-  QAAIS_ColorView -> SetWindow (QAAIS_ColorWindow);
-  QAAIS_ColorView -> SetBackgroundColor (Quantity_NOC_BLACK);
-  QAAIS_ColorView -> Redraw ();
-
-  Standard_Integer QAAIS_MousePoint_X = 0;
-  Standard_Integer QAAIS_MousePoint_Y = 0;
-  Standard_Character QAAIS_MousePointX[32];
-  Sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X);
-  Standard_Character QAAIS_MousePointY[32];
-  Sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y);
-  Standard_ShortReal QAAIS_ColorRED = 0;
-  Standard_ShortReal QAAIS_ColorGRN = 0;
-  Standard_ShortReal QAAIS_ColorBLU = 0;
-  Quantity_Color QAAIS_ShowingColor;
-  QAAIS_ShowingColor.SetValues (QAAIS_ColorRED, QAAIS_ColorGRN, QAAIS_ColorBLU, Quantity_TOC_RGB);
-  Standard_Integer argccc = 5;
-  const char *bufff[] = { "A", "B", "C", "D", "E" };
-  const char **argvvv = (const char **) bufff;
-  while (ViewerMainLoop (argccc, argvvv)) {
-    Handle(TColStd_HSequenceOfReal) aSeq;
-    Image_PixMap anImage;
-
-    ViewerTest::GetMousePosition (QAAIS_MousePoint_X, QAAIS_MousePoint_Y);
-    Handle (V3d_View) QAAIS_MainView = ViewerTest::CurrentView();
-    QAAIS_MainView->ToPixMap (anImage, QAAIS_WindowSize_X, QAAIS_WindowSize_Y);
-
-    aSeq = GetColorOfPixel (anImage, QAAIS_MousePoint_X, QAAIS_MousePoint_Y, 0);
-
-    QAAIS_ColorRED = aSeq->Value(1);
-    QAAIS_ColorGRN = aSeq->Value(2);
-    QAAIS_ColorBLU = aSeq->Value(3);
-    QAAIS_ShowingColor.SetValues (QAAIS_ColorRED, QAAIS_ColorGRN, QAAIS_ColorBLU, Quantity_TOC_RGB);
-    QAAIS_ColorView -> SetBackgroundColor (QAAIS_ShowingColor);
-    QAAIS_ColorView -> Redraw ();
-    QAAIS_CoordWindow.Clear();
-    Sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X);
-    Sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y);
-    QAAIS_CoordWindow.DrawString (30, 35, QAAIS_MousePointX);
-    QAAIS_CoordWindow.DrawString (125, 35, QAAIS_MousePointY);
-  }
-  QAAIS_CoordWindow.Destroy ();
-#endif //WNT
-    return 0;
-}
-
 //==============================================================================
 //  VIEWER GLOBALs
 //==============================================================================
 #ifndef WNT
 extern Draw_Viewer dout;
-extern Display*         Draw_WindowDisplay;
-extern Colormap         Draw_WindowColorMap;
 #else
 Standard_IMPORT Draw_Viewer dout;
 #endif
@@ -692,7 +605,6 @@ void QADraw::CommonCommands(Draw_Interpretor& theCommands)
   theCommands.Add("QARebuild","QARebuild command_name",__FILE__,QARebuild,group);
   theCommands.Add("QAGetPixelColor", "QAGetPixelColor coordinate_X coordinate_Y [color_R color_G color_B]", __FILE__,QAAISGetPixelColor, group);
   theCommands.Add("QAGetMousePoint", "QAGetMousePoint", __FILE__,QAAISGetMousePoint, group);
-  theCommands.Add("QAGetColorCoord", "QAGetColorCoord", __FILE__,QAAISGetColorCoord, group);
   theCommands.Add("vtri_orig",
                  "vtri_orig         : vtri_orig trihedron_name  -  draws axis origin lines",
                  __FILE__,VTrihedronOrigins,group);