diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 873c785a1ed..f2a4a8fd167 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -179,7 +179,7 @@ public static void beginSheetModalForWindow(NSObject id, NSWindow window, long h * Custom message that will be sent when setTheme is called for example from Platform UI code. */ public static final long sel_appAppearanceChanged = OS.sel_registerName("appAppearanceChanged"); - + /** * Experimental API for dark theme. *
@@ -194,7 +194,7 @@ public static void beginSheetModalForWindow(NSObject id, NSWindow window, long h * On GTK, behavior may be different as the boolean flag doesn't force dark * theme instead it specify that dark theme is preferred. *
- * + * * @param isDarkThemetrue
for dark theme
*/
public static void setTheme(boolean isDarkTheme) {
@@ -1896,6 +1896,8 @@ public static Selector getSelector (long value) {
public static final long sel_setShowsProgressPanel_ = Selector.sel_setShowsProgressPanel_.value;
public static final long sel_setShowsResizeIndicator_ = Selector.sel_setShowsResizeIndicator_.value;
public static final long sel_setShowsToolbarButton_ = Selector.sel_setShowsToolbarButton_.value;
+// See https://github.com/eclipse-platform/eclipse.platform.swt/issues/1012
+public static final long sel_setClipsToBounds_ = Selector.sel_setClipsToBounds_.value;
public static final long sel_setSize_ = Selector.sel_setSize_.value;
public static final long sel_setState_ = Selector.sel_setState_.value;
public static final long sel_setString_ = Selector.sel_setString_.value;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java
index 42425a680d0..1570a2b3cbc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java
@@ -1139,6 +1139,8 @@ public enum Selector {
, sel_setShowsProgressPanel_("setShowsProgressPanel:")
, sel_setShowsResizeIndicator_("setShowsResizeIndicator:")
, sel_setShowsToolbarButton_("setShowsToolbarButton:")
+ // See https://github.com/eclipse-platform/eclipse.platform.swt/issues/1012
+ , sel_setClipsToBounds_("setClipsToBounds:")
, sel_setSize_("setSize:")
, sel_setState_("setState:")
, sel_setString_("setString:")
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
index 0280dd411f2..f5afb92843f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
@@ -759,6 +759,8 @@ void drawRect (long id, long sel, NSRect rect) {
if (!isDrawing()) return;
Display display = this.display;
NSView view = new NSView(id);
+ // See https://github.com/eclipse-platform/eclipse.platform.swt/issues/1012
+ OS.objc_msgSend(id, OS.sel_setClipsToBounds_, true);
display.isPainting.addObject(view);
NSGraphicsContext context = NSGraphicsContext.currentContext();
context.saveGraphicsState();