Uploaded image for project: 'Jalview'
  1. Jalview
  2. JAL-3787

Animations are stuttering on Linux

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: awt-gui
    • Labels:
      None

      Description

      Progress bar (and likely other animations too) are stuttering unless a cursor is being moved over the window.
      The cause is that some windowing systems do not sync the window state to the screen when they feel like it's not necessary. Check out `Toolkit.sync()`

      Here is the code I wrote in the past to do animation (with all the unnecessary stuff stripped off):

      ~~~
      window.createBufferStrategy(2); // JFrame instance
      BufferStrategy bs = window.getBufferStrategy();

      while (true) {
        update(timeDelta); // update animation
        Graphics g = bs.getDrawGraphics();
        window.paintComponents(g); // paint animation
        g.dispose();
        bs.show();
        window.getToolkit().sync();
        // sleep
      }
      ~~~

        Attachments

          Activity

            People

            Assignee:
            soares Ben Soares
            Reporter:
            mmwarowny Mateusz Warowny
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: