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;
|
||||
}
|
||||
|
||||
int uiMainStep(int wait)
|
||||
{
|
||||
return mainStep(wait, ^(NSEvent *e) {
|
||||
return NO;
|
||||
});
|
||||
}
|
||||
|
||||
// see also:
|
||||
// - http://www.cocoawithlove.com/2009/01/demystifying-nsapplication-by.html
|
||||
// - https://github.com/gnustep/gui/blob/master/Source/NSApplication.m
|
||||
int uiMainStep(int wait)
|
||||
int mainStep(int wait, BOOL (^interceptEvent)(NSEvent *e))
|
||||
{
|
||||
NSDate *expire;
|
||||
NSEvent *e;
|
||||
|
@ -196,7 +203,8 @@ int uiMainStep(int wait)
|
|||
return 1;
|
||||
|
||||
type = [e type];
|
||||
[realNSApp() sendEvent:e];
|
||||
if (!interceptEvent(e))
|
||||
[realNSApp() sendEvent:e];
|
||||
[realNSApp() updateWindows];
|
||||
|
||||
// GNUstep does this
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
extern void finalizeMenus(void);
|
||||
extern void uninitMenus(void);
|
||||
|
||||
// init.m
|
||||
// main.m
|
||||
@interface applicationClass : NSApplication
|
||||
@end
|
||||
// this is needed because NSApp is of type id, confusing clang
|
||||
|
@ -43,6 +43,7 @@ extern void uninitMenus(void);
|
|||
@property (strong) menuManager *menuManager;
|
||||
@end
|
||||
#define appDelegate() ((appDelegate *) [realNSApp() delegate])
|
||||
extern int mainStep(int wait, BOOL (^interceptEvent)(NSEvent *));
|
||||
|
||||
// util.m
|
||||
extern void disableAutocorrect(NSTextView *);
|
||||
|
|
Loading…
Reference in New Issue