Skip to content

Commit

Permalink
Force repaint in NativeGraphicsSource to fix broken animation
Browse files Browse the repository at this point in the history
When the FigureCanvas is created with SWT.DOUBLE_BUFFERED, animations
are not painted correctly. This is because an instance of
NativeGraphicsSource is used internally, which doesn't paint
synchronously.

Because the animation is done inside the UI thread, this paint operation
is only processed after the animation is done.

Resolves eclipse-gef#376
  • Loading branch information
ptziegler committed May 17, 2024
1 parent 8928041 commit c67674f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2024 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -56,6 +56,9 @@ public Graphics getGraphics(Rectangle r) {

// canvas.update();

// canvas.update() paints too much and only works on Windows. Use
// readAndDispatch() to only paint the redraw() event.
canvas.getDisplay().readAndDispatch();
return null;
}

Expand Down

0 comments on commit c67674f

Please sign in to comment.