More preparation for the OS X window move/resize code: uiMainStep() is split into an internal function that takes a pre-sendEvent: interception specifically intended for internal loops.
This commit is contained in:
parent
8cbae7d2b7
commit
39fdf7457b
|
@ -169,10 +169,17 @@ void uiMainSteps(void)
|
||||||
stepsIsRunning = YES;
|
stepsIsRunning = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uiMainStep(int wait)
|
||||||
|
{
|
||||||
|
return mainStep(wait, ^(NSEvent *e) {
|
||||||
|
return NO;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// see also:
|
// see also:
|
||||||
// - http://www.cocoawithlove.com/2009/01/demystifying-nsapplication-by.html
|
// - http://www.cocoawithlove.com/2009/01/demystifying-nsapplication-by.html
|
||||||
// - https://github.com/gnustep/gui/blob/master/Source/NSApplication.m
|
// - https://github.com/gnustep/gui/blob/master/Source/NSApplication.m
|
||||||
int uiMainStep(int wait)
|
int mainStep(int wait, BOOL (^interceptEvent)(NSEvent *e))
|
||||||
{
|
{
|
||||||
NSDate *expire;
|
NSDate *expire;
|
||||||
NSEvent *e;
|
NSEvent *e;
|
||||||
|
@ -196,7 +203,8 @@ int uiMainStep(int wait)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
type = [e type];
|
type = [e type];
|
||||||
[realNSApp() sendEvent:e];
|
if (!interceptEvent(e))
|
||||||
|
[realNSApp() sendEvent:e];
|
||||||
[realNSApp() updateWindows];
|
[realNSApp() updateWindows];
|
||||||
|
|
||||||
// GNUstep does this
|
// GNUstep does this
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
extern void finalizeMenus(void);
|
extern void finalizeMenus(void);
|
||||||
extern void uninitMenus(void);
|
extern void uninitMenus(void);
|
||||||
|
|
||||||
// init.m
|
// main.m
|
||||||
@interface applicationClass : NSApplication
|
@interface applicationClass : NSApplication
|
||||||
@end
|
@end
|
||||||
// this is needed because NSApp is of type id, confusing clang
|
// this is needed because NSApp is of type id, confusing clang
|
||||||
|
@ -43,6 +43,7 @@ extern void uninitMenus(void);
|
||||||
@property (strong) menuManager *menuManager;
|
@property (strong) menuManager *menuManager;
|
||||||
@end
|
@end
|
||||||
#define appDelegate() ((appDelegate *) [realNSApp() delegate])
|
#define appDelegate() ((appDelegate *) [realNSApp() delegate])
|
||||||
|
extern int mainStep(int wait, BOOL (^interceptEvent)(NSEvent *));
|
||||||
|
|
||||||
// util.m
|
// util.m
|
||||||
extern void disableAutocorrect(NSTextView *);
|
extern void disableAutocorrect(NSTextView *);
|
||||||
|
|
Loading…
Reference in New Issue