Skip to content

Commit a02a24b

Browse files
committed
Restrict transparency blur to >= Leopard
As identified by @jpetrie in issue #72, the Tiger SDK doesn't support the CGSInternal headers previously pulled in from iTerm2. This commit wraps all of the blur code in CPP guards that check MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5.
1 parent 7513a5f commit a02a24b

12 files changed

Lines changed: 37 additions & 7 deletions

src/MacVim/MMBackend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ extern NSTimeInterval MMBalloonEvalInternalDelay;
137137

138138
- (void)setAntialias:(BOOL)antialias;
139139

140-
#ifdef FEAT_TRANSPARENCY
140+
#ifdef BLUR_TRANSPARENCY
141141
- (void)setBlurRadius:(int)radius;
142142
#endif
143143

src/MacVim/MMBackend.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ - (void)setAntialias:(BOOL)antialias
11801180
[self queueMessage:msgid data:nil];
11811181
}
11821182

1183-
#ifdef FEAT_TRANSPARENCY
1183+
#ifdef BLUR_TRANSPARENCY
11841184

11851185
- (void)setBlurRadius:(int)radius
11861186
{

src/MacVim/MMVimController.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,12 @@ - (void)handleMessage:(int)msgid data:(NSData *)data
876876
if (filenames)
877877
[[NSDocumentController sharedDocumentController]
878878
noteNewRecentFilePaths:filenames];
879+
#ifdef BLUR_TRANSPARENCY
879880
} else if (SetBlurRadiusMsgID == msgid) {
880881
const void *bytes = [data bytes];
881882
int radius = *((int*)bytes);
882883
[windowController setBlurRadius:radius];
884+
#endif
883885

884886
// IMPORTANT: When adding a new message, make sure to update
885887
// isUnsafeMessage() if necessary!

src/MacVim/MMWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
- (void)setContentMinSize:(NSSize)size;
2929
- (void)setContentMaxSize:(NSSize)size;
3030
- (void)setContentSize:(NSSize)size;
31+
#ifdef BLUR_TRANSPARENCY
3132
- (void)setBlurRadius:(int)radius;
33+
#endif
3234

3335
- (IBAction)toggleFullScreen:(id)sender;
3436
- (IBAction)realToggleFullScreen:(id)sender;

src/MacVim/MMWindow.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828

2929
#import "MMWindow.h"
3030
#import "Miscellaneous.h"
31-
#import "CGSInternal/CGSWindow.h"
3231

3332

33+
#ifdef BLUR_TRANSPARENCY
34+
35+
#import "CGSInternal/CGSWindow.h"
3436

3537
typedef CGError CGSSetWindowBackgroundBlurRadiusFunction(CGSConnectionID cid, CGSWindowID wid, NSUInteger blur);
3638

@@ -60,6 +62,8 @@
6062
return function;
6163
}
6264

65+
#endif // BLUR_TRANSPARENCY
66+
6367

6468

6569
@implementation MMWindow
@@ -155,6 +159,8 @@ - (void)setContentSize:(NSSize)size
155159
[super setContentSize:size];
156160
}
157161

162+
#ifdef BLUR_TRANSPARENCY
163+
158164
- (void)setBlurRadius:(int)radius
159165
{
160166
if (radius >= 0) {
@@ -169,6 +175,8 @@ - (void)setBlurRadius:(int)radius
169175
}
170176
}
171177

178+
#endif // BLUR_TRANSPARENCY
179+
172180
- (void)performClose:(id)sender
173181
{
174182
id wc = [self windowController];

src/MacVim/MMWindowController.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
NSPoint defaultTopLeft;
4747
NSToolbar *toolbar;
4848
BOOL resizingDueToMove;
49+
#ifdef BLUR_TRANSPARENCY
4950
int blurRadius;
51+
#endif
5052
}
5153

5254
- (id)initWithVimController:(MMVimController *)controller;
@@ -82,7 +84,10 @@
8284
- (void)adjustLinespace:(int)linespace;
8385
- (void)liveResizeWillStart;
8486
- (void)liveResizeDidEnd;
87+
88+
#ifdef BLUR_TRANSPARENCY
8589
- (void)setBlurRadius:(int)radius;
90+
#endif
8691

8792
- (void)enterFullScreen:(int)fuoptions backgroundColor:(NSColor *)back;
8893
- (void)leaveFullScreen;

src/MacVim/MMWindowController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ - (BOOL)presentWindow:(id)unused
330330
if (fullScreenEnabled && !fullScreenWindow)
331331
[decoratedWindow setAlphaValue:0];
332332

333+
#ifdef BLUR_TRANSPARENCY
333334
[decoratedWindow setBlurRadius:blurRadius];
335+
#endif
334336

335337
// Flag that the window is now placed on screen. From now on it is OK for
336338
// code to depend on the screen state. (Such as constraining views etc.)
@@ -721,13 +723,15 @@ - (void)liveResizeDidEnd
721723
}
722724
}
723725

726+
#ifdef BLUR_TRANSPARENCY
724727
- (void)setBlurRadius:(int)radius
725728
{
726729
blurRadius = radius;
727730
if (windowPresented) {
728731
[decoratedWindow setBlurRadius:radius];
729732
}
730733
}
734+
#endif
731735

732736
- (void)enterFullScreen:(int)fuoptions backgroundColor:(NSColor *)back
733737
{

src/MacVim/gui_macvim.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,12 +2360,12 @@ static int vimModMaskToEventModifierFlags(int mods)
23602360

23612361
#endif // FEAT_BEVAL
23622362

2363-
#ifdef FEAT_TRANSPARENCY
2363+
#ifdef BLUR_TRANSPARENCY
23642364

23652365
void
23662366
gui_macvim_set_blur(int radius)
23672367
{
23682368
[[MMBackend sharedInstance] setBlurRadius:radius];
23692369
}
23702370

2371-
#endif // FEAT_TRANSPARENCY
2371+
#endif // BLUR_TRANSPARENCY

src/option.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ static struct vimoption
647647
#endif
648648
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
649649
{"blurradius", "blur", P_NUM|P_VIM,
650-
#ifdef FEAT_TRANSPARENCY
650+
#ifdef BLUR_TRANSPARENCY
651651
(char_u *)&p_blur, PV_NONE,
652652
#else
653653
(char_u *)NULL, PV_NONE,
@@ -8713,7 +8713,9 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
87138713
else if (gui.in_use)
87148714
gui_mch_new_colors();
87158715
}
8716+
#endif
87168717

8718+
#ifdef BLUR_TRANSPARENCY
87178719
else if (pp == &p_blur)
87188720
{
87198721
if (p_blur < 0)

src/option.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,8 @@ EXTERN char_u *p_tsr; /* 'thesaurus' */
811811
#endif
812812
#ifdef FEAT_TRANSPARENCY
813813
EXTERN long p_transp; /* 'transparency' */
814+
#endif
815+
#ifdef BLUR_TRANSPARENCY
814816
EXTERN long p_blur; /* 'blurradius' */
815817
#endif
816818
EXTERN int p_ttimeout; /* 'ttimeout' */

0 commit comments

Comments
 (0)