Added new method Draw_Window::IsMapped() for checked window state.
Draw_Window using XLib now does not exit application on closing window.
The method Draw_Viewer::Select() (called by whatis command)
has been corrected so as not to enter the loop if no views are initialized.
//function : Select
//purpose :
//=======================================================================
+
void Draw_Viewer::Select (Standard_Integer& id, Standard_Integer& X, Standard_Integer& Y,
Standard_Integer& Button, Standard_Boolean wait)
{
if (Draw_Batch) return;
+ id = X = Y = Button = 0;
+ Standard_Boolean hasView = Standard_False;
+ for (int aViewIter = 0; aViewIter < MAXVIEW; ++aViewIter)
+ {
+ if (myViews[aViewIter] != NULL
+ && myViews[aViewIter]->IsMapped())
+ {
+ hasView = Standard_True;
+ break;
+ }
+ }
+ if (!hasView)
+ {
+ std::cerr << "No selection is possible with no open views\n";
+ return;
+ }
Flush();
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
if (!wait) {
if (id >=0 && id < MAXVIEW) {
if (myViews[id]) myViews[id]->Wait(wait);
// advise to the window manager to place it where I need
XSetWMNormalHints(Draw_WindowDisplay,win,&myHints);
+ Atom aDeleteWindowAtom = Draw_DisplayConnection->GetAtom (Aspect_XA_DELETE_WINDOW);
+ XSetWMProtocols (Draw_WindowDisplay, win, &aDeleteWindowAtom, 1);
+
if (Draw_VirtualWindows)
{
myUseBuffer = Standard_True;
return Standard_True;
}
+//=======================================================================
+//function : IsMapped
+//purpose :
+//=======================================================================
+bool Draw_Window::IsMapped() const
+{
+ if (Draw_VirtualWindows
+ || win == 0)
+ {
+ return false;
+ }
+
+ XFlush (Draw_WindowDisplay);
+ XWindowAttributes aWinAttr;
+ XGetWindowAttributes (Draw_WindowDisplay, win, &aWinAttr);
+ return aWinAttr.map_state == IsUnviewable
+ || aWinAttr.map_state == IsViewable;
+}
+
//=======================================================================
//function : DisplayWindow
//purpose :
XComposeStatus stat;
char chainekey[10];
-
- switch (xev.type) {
-
+ switch (xev.type)
+ {
+ case ClientMessage:
+ {
+ if (xev.xclient.data.l[0] == (int )Draw_DisplayConnection->GetAtom (Aspect_XA_DELETE_WINDOW))
+ {
+ // just hide the window
+ win.Hide();
+ }
+ return;
+ }
case Expose :
win.WExpose();
break;
switch (wMsg)
{
+ case WM_CLOSE:
+ {
+ localObjet->Hide();
+ return 0; // do nothing - window destruction should be performed by application
+ }
case WM_PAINT:
{
PAINTSTRUCT ps;
return TCollection_AsciiString (aTitleW);
}
+//=======================================================================
+//function : IsMapped
+//purpose :
+//=======================================================================
+bool Draw_Window::IsMapped() const
+{
+ if (Draw_VirtualWindows
+ || win == NULL)
+ {
+ return false;
+ }
+
+ LONG aWinStyle = GetWindowLongW (win, GWL_STYLE);
+ return (aWinStyle & WS_VISIBLE) != 0
+ && (aWinStyle & WS_MINIMIZE) == 0;
+}
/*--------------------------------------------------------*\
| DisplayWindow
void SetTitle (const TCollection_AsciiString& theTitle);
TCollection_AsciiString GetTitle() const;
+ //! Return true if window is displayed on the screen.
+ bool IsMapped() const;
void DisplayWindow();
void Hide();
void Destroy();
void SetTitle (const TCollection_AsciiString& theTitle);
TCollection_AsciiString GetTitle() const;
+ //! Return true if window is displayed on the screen.
+ bool IsMapped() const;
void DisplayWindow();
void Hide();
void Destroy();
__Draw_API TCollection_AsciiString GetTitle() const;
//Affichage
+ //! Return true if window is displayed on the screen.
+ bool IsMapped() const;
__Draw_API void DisplayWindow();
__Draw_API void Hide();
__Draw_API void Destroy();
return Standard_True; // unused
}
+//=======================================================================
+//function : IsMapped
+//purpose :
+//=======================================================================
+bool Draw_Window::IsMapped() const
+{
+ if (Draw_VirtualWindows
+ || myWindow == NULL)
+ {
+ return false;
+ }
+
+ return [myWindow isVisible];
+}
+
//=======================================================================
//function : DisplayWindow
//purpose :