Skip to content

Commit 2d1592f

Browse files
committed
ugly hacks added to fix linux compatibility
1 parent 6bc1e4a commit 2d1592f

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

JVTK/src/eu/mihosoft/vtk/VTKJPanel.java

+26-21
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import java.awt.image.*;
3535
import java.util.Timer;
3636
import java.util.TimerTask;
37+
import java.util.logging.Level;
38+
import java.util.logging.Logger;
3739
import javax.swing.JFrame;
3840
import javax.swing.JPanel;
3941
import javax.swing.JWindow;
@@ -504,11 +506,12 @@ public void setContentAlpha(float contentAlpha) {
504506
this.contentAlpha = contentAlpha;
505507
contentChanged();
506508
}
507-
508-
/****************************************************
509-
* !!! CAUTION: UGLY METHODS BELOW !!! *
510-
****************************************************/
511-
509+
//
510+
//****************************************************
511+
//* !!! CAUTION: UGLY METHODS BELOW !!! *
512+
//****************************************************
513+
//
514+
512515
/**
513516
* Initializes the internal window.
514517
*/
@@ -521,24 +524,26 @@ private void initWindow() {
521524
// this window does not have a title bar and is not visible (hopefully)
522525
window.setVisible(true);
523526

524-
// linux:
525-
// we must ensure that the window gets painted at least once with
526-
// width and height > 0
527-
window.setSize(1, 1);
528-
529-
// I am so unhappy with this :(
530-
for (int i = 0; i < 15; i++) {
531-
window.paint(window.getGraphics());
527+
// ati on linux sucks!
528+
if (SysUtil.isLinux()) {
529+
530+
// linux:
531+
// we must ensure that the window gets painted at least once with
532+
// width and height > 0
533+
window.setSize(1, 1);
534+
535+
// I am so unhappy with this :(
536+
for (int i = 0; i < 15; i++) {
537+
window.paint(window.getGraphics());
538+
try {
539+
Thread.sleep(2);
540+
} catch (InterruptedException ex) {
541+
// we don't care
542+
}
543+
}
532544
}
533545

534-
// now we can hide the window
535-
GraphicsUtil.invokeLater(new Runnable() {
536-
537-
@Override
538-
public void run() {
539-
window.setVisible(false);
540-
}
541-
});
546+
window.setVisible(false);
542547
}
543548

544549
/**

0 commit comments

Comments
 (0)