Skip to content

Commit 3d883cf

Browse files
committed
Set fixed value to tooltip-delay
1 parent 4312bd8 commit 3d883cf

File tree

5 files changed

+8
-33
lines changed

5 files changed

+8
-33
lines changed

src/MacVim/MMBackend.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
#import "vim.h"
1414

1515

16-
#ifdef FEAT_BEVAL
17-
// Seconds to delay balloon evaluation after mouse event (subtracted from
18-
// p_bdlay).
19-
extern NSTimeInterval MMBalloonEvalInternalDelay;
20-
#endif
21-
22-
2316
@interface MMBackend : NSObject <MMBackendProtocol, MMVimServerProtocol,
2417
MMVimClientProtocol> {
2518
NSMutableArray *outputQueue;

src/MacVim/MMBackend.m

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646

4747
static unsigned MMServerMax = 1000;
4848

49-
#ifdef FEAT_BEVAL
50-
// Seconds to delay balloon evaluation after mouse event (subtracted from
51-
// p_bdlay so that this effectively becomes the smallest possible delay).
52-
NSTimeInterval MMBalloonEvalInternalDelay = 0.1;
53-
#endif
54-
5549
// TODO: Move to separate file.
5650
static int eventModifierFlagsToVimModMask(int modifierFlags);
5751
static int eventModifierFlagsToVimMouseModMask(int modifierFlags);
@@ -1919,7 +1913,7 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data
19191913
object:nil];
19201914
[self performSelector:@selector(bevalCallback:)
19211915
withObject:nil
1922-
afterDelay:MMBalloonEvalInternalDelay];
1916+
afterDelay:p_bdlay/1000.0];
19231917
}
19241918
#endif
19251919
} else if (MouseDownMsgID == msgid) {
@@ -1978,7 +1972,7 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data
19781972
object:nil];
19791973
[self performSelector:@selector(bevalCallback:)
19801974
withObject:nil
1981-
afterDelay:MMBalloonEvalInternalDelay];
1975+
afterDelay:p_bdlay/1000.0];
19821976
}
19831977
#endif
19841978
} else if (AddInputMsgID == msgid) {

src/MacVim/MMVimController.m

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ - (void)scheduleClose;
114114
- (void)handleBrowseForFile:(NSDictionary *)attr;
115115
- (void)handleShowDialog:(NSDictionary *)attr;
116116
- (void)handleDeleteSign:(NSDictionary *)attr;
117-
- (void)setToolTipDelay:(NSTimeInterval)seconds;
117+
- (void)setToolTipDelay;
118118
@end
119119

120120

@@ -174,6 +174,8 @@ - (id)initWithBackend:(id)backend pid:(int)processIdentifier
174174

175175
[mainMenu addItem:appMenuItem];
176176

177+
[self setToolTipDelay];
178+
177179
isInitialized = YES;
178180

179181
// After MMVimController's initialization is completed,
@@ -965,11 +967,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data
965967
[textView setToolTipAtMousePoint:toolTip];
966968
else
967969
[textView setToolTipAtMousePoint:nil];
968-
} else if (SetTooltipDelayMsgID == msgid) {
969-
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
970-
NSNumber *delay = dict ? [dict objectForKey:@"delay"] : nil;
971-
if (delay)
972-
[self setToolTipDelay:[delay floatValue]];
973970
} else if (AddToMRUMsgID == msgid) {
974971
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
975972
NSArray *filenames = dict ? [dict objectForKey:@"filenames"] : nil;
@@ -1697,18 +1694,15 @@ - (void)handleDeleteSign:(NSDictionary *)attr
16971694
[view deleteSign:[attr objectForKey:@"imgName"]];
16981695
}
16991696

1700-
- (void)setToolTipDelay:(NSTimeInterval)seconds
1697+
- (void)setToolTipDelay
17011698
{
17021699
// HACK! NSToolTipManager is an AppKit private class.
17031700
static Class TTM = nil;
17041701
if (!TTM)
17051702
TTM = NSClassFromString(@"NSToolTipManager");
17061703

1707-
if (seconds < 0)
1708-
seconds = 0;
1709-
17101704
if (TTM) {
1711-
[[TTM sharedToolTipManager] setInitialToolTipDelay:seconds];
1705+
[[TTM sharedToolTipManager] setInitialToolTipDelay:1e-6];
17121706
} else {
17131707
ASLogNotice(@"Failed to get NSToolTipManager");
17141708
}

src/MacVim/MacVim.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ extern const char * const MMVimMsgIDStrings[];
259259
MSG(SetWindowPositionMsgID) \
260260
MSG(DeleteSignMsgID) \
261261
MSG(SetTooltipMsgID) \
262-
MSG(SetTooltipDelayMsgID) \
263262
MSG(GestureMsgID) \
264263
MSG(AddToMRUMsgID) \
265264
MSG(BackingPropertiesChangedMsgID) \

src/MacVim/gui_macvim.m

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,12 +2470,7 @@
24702470
void
24712471
gui_mch_enable_beval_area(BalloonEval *beval UNUSED)
24722472
{
2473-
// Set the balloon delay when enabling balloon eval.
2474-
float delay = p_bdlay/1000.0f - MMBalloonEvalInternalDelay;
2475-
if (delay < 0) delay = 0;
2476-
[[MMBackend sharedInstance] queueMessage:SetTooltipDelayMsgID properties:
2477-
[NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:delay]
2478-
forKey:@"delay"]];
2473+
// NOP
24792474
}
24802475

24812476
void

0 commit comments

Comments
 (0)