Skip to content

Commit dccc6c6

Browse files
author
Thomas Singer
committed
Control: remove dependency on Browser and OleClientSite
This allows to compile SWT without the "bundles\org.eclipse.swt\Eclipse SWT Browser\" source path.
1 parent 925a294 commit dccc6c6

File tree

4 files changed

+26
-20
lines changed

4 files changed

+26
-20
lines changed

bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,4 +1267,10 @@ public void stop () {
12671267
checkWidget();
12681268
webBrowser.stop ();
12691269
}
1270+
1271+
//@Override not marked as overridden because the super method does not exist for GTK/Cocoa
1272+
protected boolean embedsWin32Control () {
1273+
// The Edge browser embeds webView2
1274+
return !isDisposed() && isVisible() && "edge".equals(getBrowserType());
1275+
}
12701276
}

bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,4 +1511,10 @@ private SIZE xFormPixelsToHimetric(SIZE aSize) {
15111511
size.cy = cy;
15121512
return size;
15131513
}
1514+
1515+
@Override
1516+
protected boolean embedsWin32Control () {
1517+
// OLE objects are always embedded by windows
1518+
return !isDisposed() && isVisible();
1519+
}
15141520
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,4 +1986,17 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
19861986
}
19871987
composite.redrawInPixels (null, true);
19881988
}
1989+
1990+
@Override
1991+
protected boolean embedsWin32Control () {
1992+
if (isDisposed() || !isVisible()) {
1993+
return false;
1994+
}
1995+
for (Control child : getChildren()) {
1996+
if (child.embedsWin32Control()) {
1997+
return true;
1998+
}
1999+
}
2000+
return false;
2001+
}
19892002
}

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import org.eclipse.swt.*;
2222
import org.eclipse.swt.accessibility.*;
23-
import org.eclipse.swt.browser.*;
2423
import org.eclipse.swt.events.*;
2524
import org.eclipse.swt.graphics.*;
2625
import org.eclipse.swt.internal.*;
@@ -3698,25 +3697,7 @@ public void setRedraw (boolean redraw) {
36983697
}
36993698
}
37003699

3701-
private boolean embedsWin32Control () {
3702-
if (this.isDisposed() || !this.isVisible()) {
3703-
return false;
3704-
}
3705-
if (this instanceof Browser browser) {
3706-
// The Edge browser embeds webView2
3707-
return "edge".equals(browser.getBrowserType());
3708-
}
3709-
3710-
if (this instanceof OleClientSite) {
3711-
// OLE objects are always embedded by windows
3712-
return true;
3713-
}
3714-
3715-
// This needs to be checked AFTER OleClientSite because OleClientSite itself is a Composite
3716-
if (this instanceof Composite comp) {
3717-
return Stream.of(comp.getChildren()).anyMatch(Control::embedsWin32Control);
3718-
}
3719-
3700+
protected boolean embedsWin32Control () {
37203701
return false;
37213702
}
37223703

0 commit comments

Comments
 (0)