Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: Handle properly stopping the NSApp when a tooltip panel might st… #8671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2017
Merged
Changes from all commits
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
20 changes: 8 additions & 12 deletions src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

/* Proper way to check for the OS X version we are compiling for, from
http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
#define COMPILING_FOR_10_5
#endif
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
#define COMPILING_FOR_10_6
#endif
Expand All @@ -26,13 +23,6 @@
#define COMPILING_FOR_10_10
#endif

/* Use Atsui for Mac OS X 10.4, CoreText for Mac OS X 10.5 */
#ifndef COMPILING_FOR_10_5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean we no longer support 10.4? Looks like 10.4 came out in 2005 and was last updated in 2007 and is unsupported by apple as of 2009 (all according to wikipedia https://en.wikipedia.org/wiki/Mac_OS_X_Tiger) so I think this is OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had actually done a lot of cleanup and warning fixes to my codebase and accidentally included this. This just removes an unused ngc variable (I think it may have been used before @mdboom's conversion to agg) and the carbon include (Cocoa is already included irregardless of the OSX version earlier).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I am planning on submitting another related patch to avoid all the deprecation warnings when compiling in 10.12

static int ngc = 0; /* The number of graphics contexts in use */

#include <Carbon/Carbon.h>

#endif

/* CGFloat was defined in Mac OS X 10.5 */
#ifndef CGFLOAT_DEFINED
Expand All @@ -44,6 +34,11 @@
#define STOP_EVENT_LOOP 2
#define WINDOW_CLOSING 3


/* Keep track of number of windows present
Needed to know when to stop the NSApp */
static long FigureWindowCount = 0;

/* -------------------------- Helper function ---------------------------- */

static void
Expand Down Expand Up @@ -672,6 +667,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
return NULL;
}
self->window = window;
++FigureWindowCount;
return (PyObject*)self;
}

Expand Down Expand Up @@ -2022,8 +2018,8 @@ - (BOOL)closeButtonPressed
- (void)close
{
[super close];
NSArray *windowsArray = [NSApp windows];
if([windowsArray count]==0) [NSApp stop: self];
--FigureWindowCount;
if (!FigureWindowCount) [NSApp stop: self];
/* This is needed for show(), which should exit from [NSApp run]
* after all windows are closed.
*/
Expand Down