mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Update fullscreen background color immediately
It is no longer necessary to exit and re-enter fullscreen to see changes to the "background" setting in 'fopt'.
This commit is contained in:
@@ -111,6 +111,7 @@
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions background:(int)bg;
|
||||
- (void)leaveFullscreen;
|
||||
- (void)setFullscreenBackgroundColor:(int)color;
|
||||
|
||||
- (void)setAntialias:(BOOL)antialias;
|
||||
|
||||
|
||||
@@ -1019,6 +1019,15 @@ static NSString *MMSymlinkWarningString =
|
||||
[self queueMessage:LeaveFullscreenMsgID data:nil];
|
||||
}
|
||||
|
||||
- (void)setFullscreenBackgroundColor:(int)color
|
||||
{
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
color = MM_COLOR(color);
|
||||
[data appendBytes:&color length:sizeof(int)];
|
||||
|
||||
[self queueMessage:SetFullscreenColorMsgID data:data];
|
||||
}
|
||||
|
||||
- (void)setAntialias:(BOOL)antialias
|
||||
{
|
||||
int msgid = antialias ? EnableAntialiasMsgID : DisableAntialiasMsgID;
|
||||
|
||||
@@ -923,6 +923,11 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
}
|
||||
} else if (CloseWindowMsgID == msgid) {
|
||||
[self scheduleClose];
|
||||
} else if (SetFullscreenColorMsgID == msgid) {
|
||||
const int *bg = (const int*)[data bytes];
|
||||
NSColor *color = [NSColor colorWithRgbInt:bg];
|
||||
|
||||
[windowController setFullscreenBackgroundColor:color];
|
||||
// IMPORTANT: When adding a new message, make sure to update
|
||||
// isUnsafeMessage() if necessary!
|
||||
} else {
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions backgroundColor:(NSColor *)back;
|
||||
- (void)leaveFullscreen;
|
||||
- (void)setFullscreenBackgroundColor:(NSColor *)back;
|
||||
|
||||
- (void)setBuffersModified:(BOOL)mod;
|
||||
|
||||
- (IBAction)addNewTab:(id)sender;
|
||||
|
||||
@@ -571,6 +571,12 @@
|
||||
shouldResizeVimView = YES;
|
||||
}
|
||||
|
||||
- (void)setFullscreenBackgroundColor:(NSColor *)back
|
||||
{
|
||||
if (fullscreenEnabled)
|
||||
[fullscreenWindow setBackgroundColor:back];
|
||||
}
|
||||
|
||||
- (void)setBuffersModified:(BOOL)mod
|
||||
{
|
||||
// NOTE: We only set the document edited flag on the decorated window since
|
||||
|
||||
@@ -174,6 +174,7 @@ enum {
|
||||
OpenWithArgumentsMsgID,
|
||||
CloseWindowMsgID,
|
||||
InterruptMsgID,
|
||||
SetFullscreenColorMsgID,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ char *MessageStrings[] =
|
||||
"OpenWithArgumentsMsgID",
|
||||
"CloseWindowMsgID",
|
||||
"InterruptMsgID",
|
||||
"SetFullscreenColorMsgID",
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1599,6 +1599,20 @@ gui_mch_leave_fullscreen()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gui_mch_fuopt_update()
|
||||
{
|
||||
guicolor_T fg, bg;
|
||||
if (fuoptions_flags & FUOPT_BGCOLOR_HLGROUP) {
|
||||
syn_id2colors(fuoptions_bgcolor, &fg, &bg);
|
||||
} else {
|
||||
bg = fuoptions_bgcolor;
|
||||
}
|
||||
|
||||
[[MMBackend sharedInstance] setFullscreenBackgroundColor:bg];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gui_macvim_update_modified_flag()
|
||||
{
|
||||
|
||||
@@ -10875,6 +10875,10 @@ check_fuoptions(p_fuoptions, flags, bgcolor)
|
||||
|
||||
*flags = new_fuoptions_flags;
|
||||
*bgcolor = new_fuoptions_bgcolor;
|
||||
|
||||
/* Let the GUI know, in case the background color has changed. */
|
||||
gui_mch_fuopt_update();
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -192,6 +192,7 @@ int serverSendReply(char_u *serverid, char_u *str);
|
||||
|
||||
void gui_mch_enter_fullscreen(int fuoptions_flags, guicolor_T bg);
|
||||
void gui_mch_leave_fullscreen(void);
|
||||
void gui_mch_fuopt_update(void);
|
||||
|
||||
void gui_macvim_update_modified_flag();
|
||||
void gui_macvim_add_to_find_pboard(char_u *pat);
|
||||
|
||||
Reference in New Issue
Block a user