adium 5686:41413b5775f9: improved emoticon menu's alignment in r...

commits at adium.im commits at adium.im
Sat Aug 31 20:22:17 UTC 2013


details:	http://hg.adium.im/adium/rev/41413b5775f9
revision:	5686:41413b5775f9
branch:		adium-1.6
author:		Benjamin Vehse
date:		Tue Aug 27 18:55:31 2013 +0200

improved emoticon menu's alignment in relation to emoticon button, fixes #16434

diffs (34 lines):

diff -r 4d355a3b6dad -r 41413b5775f9 Source/AIMessageViewEmoticonsController.m
--- a/Source/AIMessageViewEmoticonsController.m	Thu Aug 22 13:09:04 2013 +0200
+++ b/Source/AIMessageViewEmoticonsController.m	Tue Aug 27 18:55:31 2013 +0200
@@ -20,9 +20,12 @@
 #import <Adium/AIEmoticonPack.h>
 #import <Adium/AIEmoticon.h>
 #import <AIUtilities/AIImageDrawingAdditions.h>
+#import "AIMessageEntryTextView.h"
 
 #define PREFERENCES_GROUP_EMOTICONS	@"Emoticons"
 
+#define MENU_PADDING    15  // Padding between emoticons button and displayed emoticons menu
+
 
 #pragma mark AIMessageViewEmoticonsController
 
@@ -104,6 +107,17 @@
 		// Adjust opening position
 		aPoint.x -= [menu size].width;
 
+        // add padding to prevent button being covered by menu
+        NSPoint screenPoint = [aView.window convertBaseToScreen:aPoint];
+        if (screenPoint.y - MENU_PADDING - [menu size].height < 20) {
+            // position the menu above the button if it would be to near to the screen's bottom edge otherwise
+            // - this prevents the view automatically being repositioned by cocoa and therefore covering the button again
+            aPoint.y = aPoint.y - MENU_PADDING - [menu size].height;
+        }
+        else {
+            aPoint.y += MENU_PADDING/2;
+        }
+
 		[menu popUpMenuPositioningItem:[menu itemAtIndex:0]
 							atLocation:aPoint
 								inView:[aView superview]];




More information about the commits mailing list