From 22e9233bd60a85eeb92ab8f48f9b02e1bf8f1011 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Sun, 30 Oct 2005 12:54:09 +0000 Subject: [PATCH] Update to take advantage of new base library functionality. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@21924 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 +++- Source/win32/WIN32Server.m | 32 +++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1195a31..94b2e57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ 2005-10-30 Richard Frith-Macdonald - * Source/win32/Win33Server.m: synchronize defaults so settings are + * Source/win32/WIN33Server.m: synchronize defaults so settings are not lost. Tidy a lot of stuff to conform to coding standards. + Update event handling code to use ET_WINMSG rather than less versatile + deprecated API. 2005-10-23 Adam Fedor diff --git a/Source/win32/WIN32Server.m b/Source/win32/WIN32Server.m index a559dbc..560f611 100644 --- a/Source/win32/WIN32Server.m +++ b/Source/win32/WIN32Server.m @@ -110,6 +110,20 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, extra: (void*)extra forMode: (NSString*)mode { + if (type == ET_WINMSG) + { + MSG *m = (MSG*)extra; + + if (m->message == WM_QUIT) + { + // Exit the program + return; + } + else + { + DispatchMessage(m); + } + } if (mode != nil) [self callback: mode]; } @@ -212,6 +226,8 @@ printf("\n\n##############################################################\n"); - (void) setupRunLoopInputSourcesForMode: (NSString*)mode { + NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop]; + #ifdef __debugServer__ printf("\n\n##############################################################\n"); printf("##- (void) setupRunLoopInputSourcesForMode: (NSString*)mode #######\n"); @@ -219,7 +235,6 @@ printf("\n\n##############################################################\n"); #endif #ifdef __CYGWIN__ - NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop]; int fdMessageQueue; #define WIN_MSG_QUEUE_FNAME "/dev/windows" @@ -243,11 +258,18 @@ printf("\n\n##############################################################\n"); selector: @selector(callback:) userInfo: nil repeats: YES]; - [[NSRunLoop currentRunLoop] addTimer: timer forMode: mode]; + [currentRunLoop addTimer: timer forMode: mode]; #else - [[NSRunLoop currentRunLoop] addMsgTarget: self - withMethod: @selector(callback:) - forMode: mode]; + +/* OBSOLETE + [currentRunLoop addMsgTarget: self + withMethod: @selector(callback:) + forMode: mode]; +*/ + [currentRunLoop addEvent: (void*)0 + type: ET_WINMSG + watcher: (id)self + forMode: mode]; #endif #endif }