[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New window event polling for CYGWIN
From: |
Fred Kiefer |
Subject: |
New window event polling for CYGWIN |
Date: |
Sat, 17 Jul 2004 01:39:11 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040114 |
I did experiment a bit with the following implementation of the
WIN32Server method, which instead of using a timer listens to a CYGWIN
specific file handle, until a window message needs handling. I don't kno
wif there is anything similar for MinGW, but for Cygwin this worked
nicely for me.Could anybody else test and comment on this method?
I would be glad to get rid of my original hack.
Fred
- (void) setupRunLoopInputSourcesForMode: (NSString*)mode
{
#ifdef __CYGWIN__
NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop];
int fdMessageQueue;
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
// Open a file descriptor for the windows message queue
fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY);
if (fdMessageQueue == -1)
{
NSLog(@"Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
exit(1);
}
[currentRunLoop addEvent: (void*)fdMessageQueue
type: ET_RDESC
watcher: (id<RunLoopEvents>)self
forMode: mode];
#else
// FIXME
NSTimer *timer;
timer = [NSTimer timerWithTimeInterval: 0.01
target: self
selector: @selector(callback:)
userInfo: nil
repeats: YES];
[[NSRunLoop currentRunLoop] addTimer: timer forMode: mode];
#endif
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- New window event polling for CYGWIN,
Fred Kiefer <=