0032308: Configuration - make Xlib dependency optional
[occt.git] / src / Xw / Xw_Window.hxx
index bda1c4d..13cd559 100644 (file)
 #ifndef _Xw_Window_H__
 #define _Xw_Window_H__
 
-#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
-
 #include <Aspect_Window.hxx>
 
 #include <Aspect_VKey.hxx>
-#include <Aspect_DisplayConnection.hxx>
-#include <Aspect_FillMethod.hxx>
-#include <Aspect_GradientFillMethod.hxx>
 #include <Aspect_Handle.hxx>
-#include <Aspect_TypeOfResize.hxx>
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-#include <Quantity_NameOfColor.hxx>
 
+class Aspect_DisplayConnection;
 class Aspect_WindowDefinitionError;
 class Aspect_WindowError;
 class Aspect_WindowInputListener;
@@ -37,9 +29,12 @@ class Aspect_Background;
 class Quantity_Color;
 class Aspect_GradientBackground;
 
+typedef union _XEvent XEvent;
+
 //! This class defines XLib window intended for creation of OpenGL context.
 class Xw_Window : public Aspect_Window
 {
+  DEFINE_STANDARD_RTTIEXT(Xw_Window, Aspect_Window)
 public:
 
   //! Convert X11 virtual key (KeySym) into Aspect_VKey.
@@ -58,10 +53,10 @@ public:
 
   //! Creates a wrapper over existing Window handle
   Standard_EXPORT Xw_Window (const Handle(Aspect_DisplayConnection)& theXDisplay,
-                             const Window theXWin,
+                             const Aspect_Drawable theXWin,
                              const Aspect_FBConfig theFBConfig = NULL);
 
-  //! Destroys the Window and all resourses attached to it
+  //! Destroys the Window and all resources attached to it
   Standard_EXPORT ~Xw_Window();
 
   //! Opens the window <me>
@@ -74,7 +69,10 @@ public:
   Standard_EXPORT virtual Aspect_TypeOfResize DoResize() Standard_OVERRIDE;
 
   //! Apply the mapping change to the window <me>
-  Standard_EXPORT virtual Standard_Boolean DoMapping() const Standard_OVERRIDE;
+  virtual Standard_Boolean DoMapping() const Standard_OVERRIDE
+  {
+    return Standard_True; // IsMapped()
+  }
 
   //! Returns True if the window <me> is opened
   Standard_EXPORT virtual Standard_Boolean IsMapped() const Standard_OVERRIDE;
@@ -93,7 +91,7 @@ public:
                                      Standard_Integer& theHeight) const Standard_OVERRIDE;
 
   //! @return native Window handle
-  Standard_EXPORT Window XWindow() const;
+  Aspect_Drawable XWindow() const { return myXWindow; }
 
   //! @return connection to X Display
   Standard_EXPORT const Handle(Aspect_DisplayConnection)& DisplayConnection() const;
@@ -101,7 +99,7 @@ public:
   //! @return native Window handle
   virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE
   {
-    return (Aspect_Drawable )XWindow();
+    return myXWindow;
   }
 
   //! @return parent of native Window handle
@@ -136,7 +134,7 @@ public:
 protected:
 
   Handle(Aspect_DisplayConnection) myDisplay; //!< X Display connection
-  Window           myXWindow;  //!< XLib window handle
+  Aspect_Drawable  myXWindow;  //!< XLib window handle
   Aspect_FBConfig  myFBConfig; //!< GLXFBConfig
   Standard_Integer myXLeft;    //!< left   position in pixels
   Standard_Integer myYTop;     //!< top    position in pixels
@@ -144,13 +142,8 @@ protected:
   Standard_Integer myYBottom;  //!< bottom position in pixels
   Standard_Boolean myIsOwnWin; //!< flag to indicate own window handle (to be deallocated on destruction)
 
-public:
-
-  DEFINE_STANDARD_RTTIEXT(Xw_Window,Aspect_Window)
-
 };
 
 DEFINE_STANDARD_HANDLE(Xw_Window, Aspect_Window)
 
-#endif //  Win32 or Mac OS X
 #endif // _Xw_Window_H__