From a1011f566a2cb8a2c2ead4323e19c87ea34b84d8 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sun, 29 Jul 2007 10:24:42 +0000 Subject: [PATCH] Added support for 'wait' flag in sendMessage:data:wait:. git-svn-id: http://macvim.googlecode.com/svn/trunk@24 96c4425d-ca35-0410-94e5-3396d5c13a8f --- MMVimController.m | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MMVimController.m b/MMVimController.m index 54045efb19..85864b62c7 100644 --- a/MMVimController.m +++ b/MMVimController.m @@ -160,8 +160,19 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag) - (void)sendMessage:(int)msgid data:(NSData *)data wait:(BOOL)wait { #if MM_USE_DO - // TODO: Decrease reply/request timeouts if 'wait' is off. - [backendProxy processInput:msgid data:data]; + if (wait) { + [backendProxy processInput:msgid data:data]; + } else { + // Do not wait for the message to be sent, i.e. drop the message if it + // can't be delivered immediately. + NSConnection *connection = [backendProxy connectionForProxy]; + if (connection) { + NSTimeInterval req = [connection requestTimeout]; + [connection setRequestTimeout:0]; + [backendProxy processInput:msgid data:data]; + [connection setRequestTimeout:req]; + } + } #else [NSPortMessage sendMessage:msgid withSendPort:sendPort data:data wait:wait];