Further enhancements to custom run loops on OS X for custom resize loops.
This commit is contained in:
parent
211b11b80f
commit
d3b33e39ce
|
@ -171,7 +171,20 @@ void uiMainSteps(void)
|
||||||
|
|
||||||
int uiMainStep(int wait)
|
int uiMainStep(int wait)
|
||||||
{
|
{
|
||||||
return mainStep(wait, ^(NSEvent *e) {
|
struct nextEventArgs nea;
|
||||||
|
|
||||||
|
nea.mask = NSAnyEventMask;
|
||||||
|
|
||||||
|
// ProPuke did this in his original PR requesting this
|
||||||
|
// I'm not sure if this will work, but I assume it will...
|
||||||
|
nea.duration = [NSDate distantPast];
|
||||||
|
if (wait) // but this is normal so it will work
|
||||||
|
nea.duration = [NSDate distantFuture];
|
||||||
|
|
||||||
|
nea.mode = NSDefaultRunLoopMode;
|
||||||
|
nea.dequeue = YES;
|
||||||
|
|
||||||
|
return mainStep(&nea, ^(NSEvent *e) {
|
||||||
return NO;
|
return NO;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -179,26 +192,20 @@ int uiMainStep(int wait)
|
||||||
// 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 mainStep(int wait, BOOL (^interceptEvent)(NSEvent *e))
|
int mainStep(struct nextEventArgs *nea, BOOL (^interceptEvent)(NSEvent *e))
|
||||||
{
|
{
|
||||||
NSDate *expire;
|
NSDate *expire;
|
||||||
NSEvent *e;
|
NSEvent *e;
|
||||||
NSEventType type;
|
NSEventType type;
|
||||||
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
// ProPuke did this in his original PR requesting this
|
|
||||||
// I'm not sure if this will work, but I assume it will...
|
|
||||||
expire = [NSDate distantPast];
|
|
||||||
if (wait) // but this is normal so it will work
|
|
||||||
expire = [NSDate distantFuture];
|
|
||||||
|
|
||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
e = [realNSApp() nextEventMatchingMask:NSAnyEventMask
|
e = [realNSApp() nextEventMatchingMask:nea->mask
|
||||||
untilDate:expire
|
untilDate:nea->duration
|
||||||
inMode:NSDefaultRunLoopMode
|
inMode:nea->mode
|
||||||
dequeue:YES];
|
dequeue:nea->dequeue];
|
||||||
if (e == nil)
|
if (e == nil)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,14 @@ 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 *));
|
struct nextEventArgs {
|
||||||
|
NSEventMask mask;
|
||||||
|
NSDate *duration;
|
||||||
|
// LONGTERM no NSRunLoopMode?
|
||||||
|
NSString *mode;
|
||||||
|
BOOL dequeue;
|
||||||
|
};
|
||||||
|
extern int mainStep(struct nextEventArgs *nea, BOOL (^interceptEvent)(NSEvent *));
|
||||||
|
|
||||||
// util.m
|
// util.m
|
||||||
extern void disableAutocorrect(NSTextView *);
|
extern void disableAutocorrect(NSTextView *);
|
||||||
|
|
Loading…
Reference in New Issue