Skip to content

Commit 5da0508

Browse files
committed
Fix for Flickering in Embedded Apps
This commit contributes to fixing the flicker issue in SashLayout whenever an embedded app is present inside it. The fix disallows the setredraw of the parents if they contains any embedded application as their descendants. contributes to #1122
1 parent d9d9bf0 commit 5da0508

File tree

1 file changed

+26
-0
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+26
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,13 @@ void createWidget () {
711711
if ((state & PARENT_BACKGROUND) != 0) {
712712
setBackground ();
713713
}
714+
if((style & SWT.EMBEDDED) != 0) {
715+
embeddedContols.add(this);
716+
}
714717
}
715718

719+
private static ArrayList<Control> embeddedContols = new ArrayList<>();
720+
716721
int defaultBackground () {
717722
return OS.GetSysColor (OS.COLOR_BTNFACE);
718723
}
@@ -2494,6 +2499,9 @@ void releaseParent () {
24942499
@Override
24952500
void releaseWidget () {
24962501
super.releaseWidget ();
2502+
if((style & SWT.EMBEDDED) != 0) {
2503+
embeddedContols.remove(this);
2504+
}
24972505
if (toolTipText != null) {
24982506
setToolTipText (getShell (), null);
24992507
}
@@ -3606,6 +3614,21 @@ boolean setRadioSelection (boolean value) {
36063614
return false;
36073615
}
36083616

3617+
private boolean hasEmbeddedChildren() {
3618+
for (Control current : embeddedContols) {
3619+
if (!current.isDisposed() && current.isVisible()) {
3620+
while (current != null) {
3621+
if (current == this) {
3622+
return true;
3623+
} else {
3624+
current = current.getParent();
3625+
}
3626+
}
3627+
}
3628+
}
3629+
return false;
3630+
}
3631+
36093632
/**
36103633
* If the argument is <code>false</code>, causes subsequent drawing
36113634
* operations in the receiver to be ignored. No drawing of any kind
@@ -3640,6 +3663,9 @@ public void setRedraw (boolean redraw) {
36403663
* drawing is turned off and restore it when drawing is
36413664
* turned back on.
36423665
*/
3666+
if(hasEmbeddedChildren()) {
3667+
return;
3668+
}
36433669
if (drawCount == 0) {
36443670
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
36453671
if ((bits & OS.WS_VISIBLE) == 0) state |= HIDDEN;

0 commit comments

Comments
 (0)