mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
make housekeeping timer more transparent and remove deprecated code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22593 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
68ecc62aba
commit
e1b9889677
9 changed files with 96 additions and 130 deletions
|
@ -35,7 +35,6 @@ win32_OBJC_FILES =\
|
|||
GSRunLoopWatcher.m \
|
||||
NSMessagePortWin32.m \
|
||||
NSMessagePortNameServerWin32.m \
|
||||
NSRunLoopWin32.m \
|
||||
NSStreamWin32.m \
|
||||
NSUserDefaultsWin32.m \
|
||||
|
||||
|
|
|
@ -131,19 +131,14 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
WatcherMapValueCallBacks, 0);
|
||||
winMsgMap = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
WatcherMapValueCallBacks, 0);
|
||||
|
||||
msgTarget = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is no msgTarget || there is a generic watcher (watching hwnd == 0),
|
||||
* If there is a generic watcher (watching hwnd == 0),
|
||||
* loop through all events, and send them to the correct
|
||||
* watcher (if there are any) and then process the rest right here.
|
||||
* else if there is a msgTarget,
|
||||
* then loop through watchers and process for their
|
||||
* hwnd's only. Then call msgTarget to clean up the rest of them.
|
||||
* Return a flag to say whether any messages were handled.
|
||||
*/
|
||||
- (BOOL) processAllWindowsMessages:(int)num_winMsgs within: (NSArray*)contexts
|
||||
|
@ -158,7 +153,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
generic = NSMapGet(winMsgMap,0);
|
||||
}
|
||||
|
||||
if (msgTarget == nil || (generic != nil && generic->_invalidated == NO))
|
||||
if (generic != nil && generic->_invalidated == NO)
|
||||
{
|
||||
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
||||
{
|
||||
|
@ -242,7 +237,6 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
NSEndMapTableEnumeration(&hEnum);
|
||||
}
|
||||
completed = YES;
|
||||
[msgTarget performSelector: msgSelector withObject: nil];
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
#include "Foundation/NSRunLoop.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "../GSRunLoopCtxt.h"
|
||||
|
||||
@implementation NSRunLoop (mingw32)
|
||||
- (void) addMsgTarget: (id)target
|
||||
withMethod: (SEL)selector
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
GSRunLoopCtxt *context;
|
||||
|
||||
GSOnceMLog(@"This method is deprecated, use -addEvent:type:watcher:forMode");
|
||||
context = NSMapGet(_contextMap, mode);
|
||||
if (context == nil)
|
||||
{
|
||||
context = [[GSRunLoopCtxt alloc] initWithMode: mode extra: _extra];
|
||||
NSMapInsert(_contextMap, context->mode, context);
|
||||
RELEASE(context);
|
||||
}
|
||||
context->msgTarget = target;
|
||||
context->msgSelector = selector;
|
||||
}
|
||||
- (void) removeMsgForMode: (NSString*)mode
|
||||
{
|
||||
GSRunLoopCtxt *context;
|
||||
|
||||
context = NSMapGet(_contextMap, mode);
|
||||
if (context == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
context->msgTarget = nil;
|
||||
}
|
||||
@end
|
|
@ -838,7 +838,7 @@ static void setNonblocking(SOCKET fd)
|
|||
return [super propertyForKey: key];
|
||||
}
|
||||
|
||||
- (void)_dispatch
|
||||
- (void) _dispatch
|
||||
{
|
||||
BOOL av = [self hasSpaceAvailable];
|
||||
NSStreamEvent myEvent = av ? NSStreamEventHasSpaceAvailable :
|
||||
|
@ -856,7 +856,7 @@ static void setNonblocking(SOCKET fd)
|
|||
}
|
||||
}
|
||||
|
||||
- (void)scheduleInRunLoop: (NSRunLoop *)aRunLoop forMode: (NSString *)mode
|
||||
- (void) scheduleInRunLoop: (NSRunLoop *)aRunLoop forMode: (NSString *)mode
|
||||
{
|
||||
NSAssert(!_runloop || _runloop == aRunLoop,
|
||||
@"Attempt to schedule in more than one runloop.");
|
||||
|
@ -873,7 +873,7 @@ static void setNonblocking(SOCKET fd)
|
|||
}
|
||||
}
|
||||
|
||||
- (void)removeFromRunLoop: (NSRunLoop *)aRunLoop forMode: (NSString *)mode
|
||||
- (void) removeFromRunLoop: (NSRunLoop *)aRunLoop forMode: (NSString *)mode
|
||||
{
|
||||
NSAssert(_runloop == aRunLoop,
|
||||
@"Attempt to remove unscheduled runloop");
|
||||
|
@ -884,7 +884,7 @@ static void setNonblocking(SOCKET fd)
|
|||
{
|
||||
[_runloop cancelPerformSelector: @selector(_dispatch)
|
||||
target: self
|
||||
argument: nil];
|
||||
argument: nil];
|
||||
}
|
||||
if ([_modes count] == 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue