#ifndef _Xw_Window_H__
#define _Xw_Window_H__
-#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#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_DefineHandle.hxx>
+#include <Standard_Type.hxx>
#include <Quantity_NameOfColor.hxx>
-#include <Quantity_Parameter.hxx>
-#include <Quantity_Ratio.hxx>
class Aspect_WindowDefinitionError;
class Aspect_WindowError;
+class Aspect_WindowInputListener;
class Aspect_Background;
class Quantity_Color;
class Aspect_GradientBackground;
//! This class defines XLib window intended for creation of OpenGL context.
class Xw_Window : public Aspect_Window
{
+public:
+
+ //! Convert X11 virtual key (KeySym) into Aspect_VKey.
+ Standard_EXPORT static Aspect_VKey VirtualKeyFromNative (unsigned long theKey);
public:
//! Creates a wrapper over existing Window handle
Standard_EXPORT Xw_Window (const Handle(Aspect_DisplayConnection)& theXDisplay,
- const Window theXWin);
-
- //! Destroies the Window and all resourses attached to it
- Standard_EXPORT virtual void Destroy();
+ const Window theXWin,
+ const Aspect_FBConfig theFBConfig = NULL);
- ~Xw_Window()
- {
- Destroy();
- }
+ //! Destroys the Window and all resourses attached to it
+ Standard_EXPORT ~Xw_Window();
//! Opens the window <me>
- Standard_EXPORT virtual void Map() const;
+ Standard_EXPORT virtual void Map() const Standard_OVERRIDE;
//! Closes the window <me>
- Standard_EXPORT virtual void Unmap() const;
+ Standard_EXPORT virtual void Unmap() const Standard_OVERRIDE;
//! Applies the resizing to the window <me>
- Standard_EXPORT virtual Aspect_TypeOfResize DoResize() const;
+ Standard_EXPORT virtual Aspect_TypeOfResize DoResize() Standard_OVERRIDE;
//! Apply the mapping change to the window <me>
- Standard_EXPORT virtual Standard_Boolean DoMapping() const;
+ Standard_EXPORT virtual Standard_Boolean DoMapping() const Standard_OVERRIDE;
//! Returns True if the window <me> is opened
- Standard_EXPORT virtual Standard_Boolean IsMapped() const;
+ Standard_EXPORT virtual Standard_Boolean IsMapped() const Standard_OVERRIDE;
//! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions
- Standard_EXPORT virtual Quantity_Ratio Ratio() const;
+ Standard_EXPORT virtual Standard_Real Ratio() const Standard_OVERRIDE;
//! Returns The Window POSITION in PIXEL
Standard_EXPORT virtual void Position (Standard_Integer& X1,
Standard_Integer& Y1,
Standard_Integer& X2,
- Standard_Integer& Y2) const;
+ Standard_Integer& Y2) const Standard_OVERRIDE;
//! Returns The Window SIZE in PIXEL
Standard_EXPORT virtual void Size (Standard_Integer& theWidth,
- Standard_Integer& theHeight) const;
+ Standard_Integer& theHeight) const Standard_OVERRIDE;
//! @return native Window handle
Standard_EXPORT Window XWindow() const;
//! @return connection to X Display
Standard_EXPORT const Handle(Aspect_DisplayConnection)& DisplayConnection() const;
+ //! @return native Window handle
+ virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE
+ {
+ return (Aspect_Drawable )XWindow();
+ }
+
+ //! @return parent of native Window handle
+ virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE
+ {
+ return 0;
+ }
+
+ //! @return native Window FB config (GLXFBConfig on Xlib)
+ virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE
+ {
+ return myFBConfig;
+ }
+
+ //! Sets window title.
+ Standard_EXPORT virtual void SetTitle (const TCollection_AsciiString& theTitle) Standard_OVERRIDE;
+
+ //! Invalidate entire window content through generation of Expose event.
+ //! This method does not aggregate multiple calls into single event - dedicated event will be sent on each call.
+ //! When NULL display connection is specified, the connection specified on window creation will be used.
+ //! Sending exposure messages from non-window thread would require dedicated display connection opened specifically
+ //! for this working thread to avoid race conditions, since Xlib display connection is not thread-safe by default.
+ Standard_EXPORT virtual void InvalidateContent (const Handle(Aspect_DisplayConnection)& theDisp) Standard_OVERRIDE;
+
+ //! Process a single window message.
+ //! @param theListener [in][out] listener to redirect message
+ //! @param theMsg [in][out] message to process
+ //! @return TRUE if message has been processed
+ Standard_EXPORT virtual bool ProcessMessage (Aspect_WindowInputListener& theListener,
+ XEvent& theMsg);
+
protected:
Handle(Aspect_DisplayConnection) myDisplay; //!< X Display connection
Window myXWindow; //!< XLib window handle
+ Aspect_FBConfig myFBConfig; //!< GLXFBConfig
Standard_Integer myXLeft; //!< left position in pixels
Standard_Integer myYTop; //!< top position in pixels
Standard_Integer myXRight; //!< right position in pixels
public:
- DEFINE_STANDARD_RTTI(Xw_Window)
+ DEFINE_STANDARD_RTTIEXT(Xw_Window,Aspect_Window)
};