From 1bda3495ec84d3486a70c324b10ca8f13aa06cbd Mon Sep 17 00:00:00 2001 From: fredkiefer Date: Tue, 3 Nov 2015 08:33:31 +0000 Subject: [PATCH] * Source/GSToolTips.m (-_timedOut:): Break long tool tips into multiple lines. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39130 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/GSToolTips.m | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 18cb28d0d..e9a513b6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-11-03 Fred Kiefer + + * Source/GSToolTips.m (-_timedOut:): Break long tool tips into + multiple lines. + 2015-11-02 Fred Kiefer * Source/NSWindow.m (-constrainFrameRect:toScreen:) Handle screen diff --git a/Source/GSToolTips.m b/Source/GSToolTips.m index 965e2c23f..195b0781d 100644 --- a/Source/GSToolTips.m +++ b/Source/GSToolTips.m @@ -642,6 +642,15 @@ static BOOL restoreMouseMoved; [[NSAttributedString alloc] initWithString: toolTipString attributes: attributes]; textSize = [toolTipText size]; + if (textSize.width > 300) + { + NSRect rect; + rect = [toolTipText boundingRectWithSize: NSMakeSize(300, 1e7) + options: 0]; + textSize = rect.size; + // This extra pixel is needed, otherwise the last line gets cut off. + textSize.height += 1; + } /* Create window just off the current mouse position * Constrain it to be on screen, shrinking if necessary.