Skip to content

Commit

Permalink
POC fix for Mac drawing bug
Browse files Browse the repository at this point in the history
- Add a new selector setClipsToBounds
- Set this selector to true in Widget#drawRect
- See #1012
  • Loading branch information
Phillipus committed Mar 4, 2024
1 parent 50d7ef7 commit afa0ac0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ public void setBoundsSize(NSSize newSize) {
OS.objc_msgSend(this.id, OS.sel_setBoundsSize_, newSize);
}

//See https://github.com/eclipse-platform/eclipse.platform.swt/issues/1012
public void setClipsToBounds(boolean clipsToBounds) {
OS.objc_msgSend(this.id, OS.sel_setClipsToBounds_, clipsToBounds);
}

public void setFocusRingType(long focusRingType) {
OS.objc_msgSend(this.id, OS.sel_setFocusRingType_, focusRingType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
view.setClipsToBounds(true);
display.isPainting.addObject(view);
NSGraphicsContext context = NSGraphicsContext.currentContext();
context.saveGraphicsState();
Expand Down

0 comments on commit afa0ac0

Please sign in to comment.