Salome HOME
spns #32755 : TopIIVolMesh: move back to master branch
[tools/sat_salome.git] / products / patches / gui-SVTK-VTKView.patch
1 diff -Naur gui-9.5.0/src/SVTK/SVTK.h gui-master/src/SVTK/SVTK.h
2 --- gui-9.5.0/src/SVTK/SVTK.h   2020-10-05 13:35:56.580949966 +0200
3 +++ gui-master/src/SVTK/SVTK.h  2020-10-05 13:34:10.374221860 +0200
4 @@ -25,6 +25,8 @@
5  
6  #include "VTKViewer.h"
7  
8 +#define VGL_WORKAROUND
9 +
10  #ifdef WIN32
11  #  if defined SVTK_EXPORTS
12  #    define SVTK_EXPORT __declspec(dllexport)
13 diff -Naur gui-9.5.0/src/SVTK/SVTK_InteractorStyle.cxx gui-master/src/SVTK/SVTK_InteractorStyle.cxx
14 --- gui-9.5.0/src/SVTK/SVTK_InteractorStyle.cxx 2020-10-05 13:35:56.581949973 +0200
15 +++ gui-master/src/SVTK/SVTK_InteractorStyle.cxx        2020-10-05 13:34:10.378221887 +0200
16 @@ -1551,6 +1551,9 @@
17    // check if bounding box was changed
18    if ( GetCurrentRenderer() )
19    {
20 +#ifdef VGL_WORKAROUND
21 +    GetCurrentRenderer()->Render();
22 +#endif
23      double aCurrBBCenter[3];
24      if ( ComputeBBCenter(GetCurrentRenderer(),aCurrBBCenter) )
25      {
26 diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewModel.cxx gui-master/src/SVTK/SVTK_ViewModel.cxx
27 --- gui-9.5.0/src/SVTK/SVTK_ViewModel.cxx       2020-10-05 13:35:56.582949980 +0200
28 +++ gui-master/src/SVTK/SVTK_ViewModel.cxx      2020-10-05 13:34:10.384221928 +0200
29 @@ -23,6 +23,7 @@
30  #include <QMenu>
31  #include <QColorDialog>
32  #include <QToolBar>
33 +#include <QTimer>
34  
35  #include <vtkCamera.h>
36  #include <vtkRenderer.h>
37 @@ -186,7 +187,7 @@
38            this,  SLOT(onActorAdded(VTKViewer_Actor*)));
39    connect(aViewWindow, SIGNAL( actorRemoved(VTKViewer_Actor*) ), 
40            this,  SLOT(onActorRemoved(VTKViewer_Actor*)));
41 -
42 +  
43    return aViewWindow;
44  }
45  
46 @@ -528,6 +529,9 @@
47    
48    connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), 
49            this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
50 +
51 +  connect(theViewManager, SIGNAL(viewCreated(SUIT_ViewWindow*)), 
52 +         this, SLOT(onViewCreated(SUIT_ViewWindow*)));
53  }
54  
55  /*!
56 @@ -865,3 +869,10 @@
57  {
58    emit actorRemoved((SVTK_ViewWindow*)sender(), theActor);
59  }
60 +
61 +void SVTK_Viewer::onViewCreated( SUIT_ViewWindow* view) {
62 +#ifdef VGL_WORKAROUND
63 +  if ( SVTK_ViewWindow* svw = dynamic_cast<SVTK_ViewWindow*>( view ) )
64 +    QTimer::singleShot(500, [svw] () { svw->Repaint(); } );
65 +#endif
66 +}
67 diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewModel.h gui-master/src/SVTK/SVTK_ViewModel.h
68 --- gui-9.5.0/src/SVTK/SVTK_ViewModel.h 2020-10-05 13:35:56.582949980 +0200
69 +++ gui-master/src/SVTK/SVTK_ViewModel.h        2020-10-05 13:34:10.384221928 +0200
70 @@ -220,6 +220,8 @@
71    void onActorAdded(VTKViewer_Actor*);
72    void onActorRemoved(VTKViewer_Actor*);
73  
74 +  void onViewCreated( SUIT_ViewWindow* );
75 +
76  private:
77    void updateToolBars();
78  
79 diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewWindow.cxx gui-master/src/SVTK/SVTK_ViewWindow.cxx
80 --- gui-9.5.0/src/SVTK/SVTK_ViewWindow.cxx      2020-10-05 13:35:56.584949994 +0200
81 +++ gui-master/src/SVTK/SVTK_ViewWindow.cxx     2020-10-05 13:34:10.385221935 +0200
82 @@ -34,6 +34,7 @@
83  
84  #include <QMenu>
85  #include <QToolBar>
86 +#include <QTimer>
87  #include <QEvent>
88  #include <QFileInfo>
89  #include <QSignalMapper>
90 @@ -789,8 +790,16 @@
91    GetInteractor()->update();
92  
93    SVTK_InteractorStyle* aStyle = (SVTK_InteractorStyle*)getInteractor()->GetInteractorStyle();
94 -  if ( aStyle )
95 +  if ( aStyle ) {
96 +#ifdef VGL_WORKAROUND
97 +    if ( aStyle->GetCurrentRenderer() == nullptr ) {
98 +      if( GetRenderer() ) {
99 +        aStyle->SetCurrentRenderer(GetRenderer()->GetDevice());
100 +      }
101 +    }  
102 +#endif
103      aStyle->OnTimer();
104 +  }
105  }
106  
107  /*!
108 @@ -2828,3 +2837,10 @@
109  
110    blockSignals( blocked );
111  }
112 +
113 +void SVTK_ViewWindow::resizeEvent( QResizeEvent* theEvent )
114 +{
115 +#ifdef VGL_WORKAROUND
116 +  Repaint();
117 +#endif
118 +}
119 diff -Naur gui-9.5.0/src/SVTK/SVTK_ViewWindow.h gui-master/src/SVTK/SVTK_ViewWindow.h
120 --- gui-9.5.0/src/SVTK/SVTK_ViewWindow.h        2020-10-05 13:35:56.584949994 +0200
121 +++ gui-master/src/SVTK/SVTK_ViewWindow.h       2020-10-05 13:34:10.385221935 +0200
122 @@ -416,6 +416,9 @@
123    enum AnaglyphFilter { RedCyan, YellowBlue, GreenMagenta };
124  
125  protected:
126 +  
127 +  virtual void resizeEvent( QResizeEvent* );
128 +  
129    virtual void Initialize(SVTK_View* theView,
130                            SVTK_ViewModelBase* theModel);
131