Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing pre-commit failures
  • Loading branch information
iccir committed Aug 8, 2026
commit 33bef74b37a0d858d8b8c31ccce5a68eb4517792
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/backend_macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ def _handle_mouse_exited(self, x, y, modifiers):
modifiers=self._mpl_modifiers(modifiers))._process()

def _handle_mouse_down(self, x, y, button, modifiers, dblclick):
button=self._mpl_button(button)
button = self._mpl_button(button)
if button is not None:
MouseEvent("button_press_event", self, x, y, button, dblclick=dblclick,
modifiers=self._mpl_modifiers(modifiers))._process()

def _handle_mouse_up(self, x, y, button, modifiers):
button=self._mpl_button(button)
button = self._mpl_button(button)
if button is not None:
MouseEvent("button_release_event", self, x, y, button,
modifiers=self._mpl_modifiers(modifiers))._process()
Expand Down
8 changes: 4 additions & 4 deletions src/macos/MPLFigureCanvas.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ - (instancetype) initWithFrame:(NSRect)rect

[self setLayer:canvasLayer];
[self setWantsLayer:YES];

CALayer *rubberbandLayer = [CALayer layer];
[rubberbandLayer setDelegate:self];
[rubberbandLayer setNeedsDisplayOnBoundsChange:YES];

_canvasLayer = canvasLayer;
_rubberbandLayer = rubberbandLayer;

Expand Down Expand Up @@ -183,7 +183,7 @@ - (void) _displayRubberbandLayer
CGImageRef contents = MPLCreateImage(bounds.size, contentsScale, ^(CGContextRef context) {
CGRect strokeRect = CGRectInset(bounds, 0.5, 0.5);
CGFloat dashPattern[2] = { 3.0, 3.0 };

CGContextSetGrayStrokeColor(context, 1.0, 1.0);
CGContextSetLineDash(context, 0.0, dashPattern, 2);
CGContextStrokeRect(context, strokeRect);
Expand All @@ -204,7 +204,7 @@ - (void) _displayRubberbandLayer
- (NSString *) _mappedStringWithCharacters:(NSString *)characters
{
static NSDictionary *sKeyMap = nil;

if (!sKeyMap) sKeyMap = @{
@( NSLeftArrowFunctionKey ): @"left", @( NSRightArrowFunctionKey ): @"right",
@( NSUpArrowFunctionKey ): @"up", @( NSDownArrowFunctionKey ): @"down",
Expand Down
3 changes: 1 addition & 2 deletions src/macos/MPLUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void MPLCallMethod(PyObject *pyObject, const char *name, char const *format, ...
// PyUnicode_AsUTF8AndSize() should set error in this case
return nil;
}

// This should never happen, but we are about to cast from signed to unsigned
if (size < 0) {
PyErr_SetString(PyExc_RuntimeError, "Size is less than 0");
Expand Down Expand Up @@ -284,4 +284,3 @@ CGImageRef MPLCreateImage(CGSize size, CGFloat scale, void (^callback)(CGContext
CGBitmapInfo bitmapInfo = 0 | kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little;
return sCreateImage(size, scale, YES, kCGColorSpaceSRGB, 4, bitmapInfo, callback);
}

Loading