Skip to content

Commit 662642c

Browse files
committed
FIX: Disable cursorRect updates from within macosx backend
We want to keep control of the cursor updates from within MPL, so don't allow the App to push a new cursor update when the window gets updated. This would happen when a TextView would get resized and update the frame.
1 parent f732864 commit 662642c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/_macosx.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,10 @@ static CGFloat _get_device_scale(CGContextRef cr)
588588
Window* window = self->window;
589589
[window setDelegate: view];
590590
[window makeFirstResponder: view];
591+
// Disable cursorRects so that the cursor doesn't get updated by events
592+
// in NSApp (like resizing TextViews), we want to handle the cursor
593+
// changes from within MPL with set_cursor() ourselves
594+
[window disableCursorRects];
591595
[[window contentView] addSubview: view];
592596
[view updateDevicePixelRatio: [window backingScaleFactor]];
593597

@@ -989,9 +993,6 @@ -(void)save_figure:(id)sender { gil_call_method(toolbar, "save_figure"); }
989993
[messagebox setFrame: rect];
990994
// We want to control the vertical position of
991995
// the rect by the content size to center it vertically
992-
// TODO: This seems to disable the cursor updates with newlines that
993-
// are included in the image hover text. It is only when trying
994-
// to set the frame height based on the contentRect's size.
995996
[messagebox.layoutManager ensureLayoutForTextContainer: messagebox.textContainer];
996997
NSRect contentRect = [messagebox.layoutManager usedRectForTextContainer: messagebox.textContainer];
997998
rect.origin.y = 0.5 * (self->height - contentRect.size.height);

0 commit comments

Comments
 (0)