File tree Expand file tree Collapse file tree 6 files changed +77
-0
lines changed
Eclipse SWT Browser/common/org/eclipse/swt/browser
Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32
cocoa/org/eclipse/swt/widgets
gtk/org/eclipse/swt/widgets
win32/org/eclipse/swt/widgets Expand file tree Collapse file tree 6 files changed +77
-0
lines changed Original file line number Diff line number Diff line change @@ -729,6 +729,15 @@ public int getStyle () {
729729 return super .getStyle () | (userStyle & SWT .BORDER );
730730}
731731
732+ /**
733+ * @since 3.129
734+ * @noreference This method is not intended to be referenced by clients.
735+ */
736+ @ Override
737+ protected boolean win32_embedsControl () {
738+ // The Edge browser embeds webView2
739+ return (getStyle () & SWT .EDGE ) != 0 ;
740+ }
732741/**
733742 * Returns a string with HTML that represents the content of the current page.
734743 *
Original file line number Diff line number Diff line change @@ -916,6 +916,16 @@ private boolean isOffice2007(boolean program) {
916916 if (programID .equals ("PowerPoint.Show.12" )) return true ; //$NON-NLS-1$
917917 return false ;
918918}
919+
920+ /**
921+ * @since 3.129
922+ * @noreference This method is not intended to be referenced by clients.
923+ */
924+ @ Override
925+ protected boolean win32_embedsControl () {
926+ // OLE objects are always embedded by windows
927+ return true ;
928+ }
919929private int OnClose () {
920930 return COM .S_OK ;
921931}
Original file line number Diff line number Diff line change @@ -4148,6 +4148,16 @@ public void setRedraw (boolean redraw) {
41484148 }
41494149}
41504150
4151+ /**
4152+ * @return <code>true</code> if this component embeds a win32 control.
4153+ * @since 3.129
4154+ * @noreference This method is not intended to be referenced by clients.
4155+ */
4156+ protected boolean win32_embedsControl () {
4157+ // This method only makes sense in windows
4158+ return false ;
4159+ }
4160+
41514161/**
41524162 * Sets the shape of the control to the region specified
41534163 * by the argument. When the argument is null, the
Original file line number Diff line number Diff line change @@ -5968,6 +5968,16 @@ public void setRedraw (boolean redraw) {
59685968 }
59695969}
59705970
5971+ /**
5972+ * @return <code>true</code> if this component embeds a win32 control.
5973+ * @since 3.129
5974+ * @noreference This method is not intended to be referenced by clients.
5975+ */
5976+ protected boolean win32_embedsControl () {
5977+ // This method only makes sense in windows
5978+ return false ;
5979+ }
5980+
59715981@ Override
59725982boolean setTabItemFocus (boolean next ) {
59735983 if (!isShowing ()) return false ;
Original file line number Diff line number Diff line change 1414package org .eclipse .swt .widgets ;
1515
1616
17+ import java .util .stream .*;
18+
1719import org .eclipse .swt .*;
1820import org .eclipse .swt .graphics .*;
1921import org .eclipse .swt .internal .*;
@@ -1183,6 +1185,17 @@ void setResizeChildren (boolean resize) {
11831185 }
11841186}
11851187
1188+ /**
1189+ * @return <code>true</code> if this component or any of its children embeds a win32 control.
1190+ * @since 3.129
1191+ * @noreference This method is not intended to be referenced by clients.
1192+ */
1193+ @ Override
1194+ protected boolean win32_embedsControl () {
1195+ return super .win32_embedsControl () ||
1196+ Stream .of (getChildren ()).anyMatch (Control ::win32_embedsControl );
1197+ }
1198+
11861199@ Override
11871200boolean setTabGroupFocus () {
11881201 if (isTabItem ()) return setTabItemFocus ();
Original file line number Diff line number Diff line change @@ -3631,6 +3631,21 @@ boolean setRadioSelection (boolean value) {
36313631 */
36323632public void setRedraw (boolean redraw ) {
36333633 checkWidget ();
3634+
3635+ /*
3636+ * Some embedded applications like webview2 (Edge), Excel, etc have a renderer
3637+ * that will draw the whole application white when setting redraw to false and
3638+ * will repaint it completely when setting it to true. This causes flickering,
3639+ * which is why turning redraw off is not allowed in case this control has an
3640+ * embedded application as a child.
3641+ *
3642+ * https://github.com/eclipse-platform/eclipse.platform.swt/issues/1122
3643+ */
3644+ boolean isShown = isVisible () && !isDisposed ();
3645+ if (!redraw && isShown && win32_embedsControl ()) {
3646+ return ;
3647+ }
3648+
36343649 /*
36353650 * Feature in Windows. When WM_SETREDRAW is used to turn
36363651 * off drawing in a widget, it clears the WS_VISIBLE bits
@@ -3667,6 +3682,16 @@ public void setRedraw (boolean redraw) {
36673682 }
36683683}
36693684
3685+ /**
3686+ * @return <code>true</code> if this component embeds a win32 control.
3687+ * @since 3.129
3688+ * @noreference This method is not intended to be referenced by clients.
3689+ */
3690+ protected boolean win32_embedsControl () {
3691+ // Default implementation. It should be rewritten by sub-classes that embed windows controls.
3692+ return false ;
3693+ }
3694+
36703695/**
36713696 * Sets the shape of the control to the region specified
36723697 * by the argument. When the argument is null, the
You can’t perform that action at this time.
0 commit comments