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 139e56b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
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
OS.objc_msgSend(id, OS.sel_setClipsToBounds_, true);
display.isPainting.addObject(view);
NSGraphicsContext context = NSGraphicsContext.currentContext();
context.saveGraphicsState();
Expand Down

0 comments on commit 139e56b

Please sign in to comment.