Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite274e72

Browse files
authored
Merge pull request#24098 from 0xMihir:4.x
Fix fullscreen behavior for macOS
2 parents4dd7554 +fb34f36 commite274e72

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

‎modules/highgui/src/window_cocoa.mm‎

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ CV_IMPL void cvDestroyWindow( const char* name)
195195
//cout << "cvDestroyWindow" << endl;
196196
CVWindow *window =cvGetWindow(name);
197197
if(window) {
198+
if ([windowstyleMask] &NSFullScreenWindowMask) {
199+
[windowtoggleFullScreen:nil];
200+
}
198201
[windowclose];
199202
[windowsremoveObjectForKey:[NSStringstringWithFormat:@"%s", name]];
200203
}
@@ -701,7 +704,11 @@ CvRect cvGetWindowRect_COCOA( const char* name )
701704
voidcvSetModeWindow_COCOA(constchar* name,double prop_value )
702705
{
703706
CVWindow *window =nil;
707+
708+
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
704709
NSDictionary *fullscreenOptions =nil;
710+
#endif
711+
705712
NSAutoreleasePool* localpool =nil;
706713

707714
CV_FUNCNAME("cvSetModeWindow_COCOA" );
@@ -725,6 +732,31 @@ void cvSetModeWindow_COCOA( const char* name, double prop_value )
725732

726733
localpool = [[NSAutoreleasePoolalloc]init];
727734

735+
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6
736+
if ( ([windowstyleMask] &NSFullScreenWindowMask) && prop_value==CV_WINDOW_NORMAL )
737+
{
738+
[windowtoggleFullScreen:nil];
739+
740+
window.status=CV_WINDOW_NORMAL;
741+
}
742+
elseif( !([windowstyleMask] &NSFullScreenWindowMask) && prop_value==CV_WINDOW_FULLSCREEN )
743+
{
744+
[windowsetCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
745+
746+
NSScreen* screen = [windowscreen];
747+
748+
NSRect frame = [screenframe];
749+
[windowsetFrame:framedisplay:YES];
750+
751+
[windowsetContentSize:frame.size];
752+
753+
[windowtoggleFullScreen:nil];
754+
755+
[windowsetFrameTopLeftPoint: frame.origin];
756+
757+
window.status=CV_WINDOW_FULLSCREEN;
758+
}
759+
#else
728760
fullscreenOptions = [NSDictionarydictionaryWithObject:[NSNumbernumberWithBool:YES]forKey:NSFullScreenModeSetting];
729761
if ( [[windowcontentView]isInFullScreenMode] && prop_value==CV_WINDOW_NORMAL )
730762
{
@@ -736,7 +768,7 @@ void cvSetModeWindow_COCOA( const char* name, double prop_value )
736768
[[windowcontentView]enterFullScreenMode:[NSScreenmainScreen]withOptions:fullscreenOptions];
737769
window.status=CV_WINDOW_FULLSCREEN;
738770
}
739-
771+
#endif
740772
[localpooldrain];
741773

742774
__END__;
@@ -810,7 +842,7 @@ void cvSetPropTopmost_COCOA( const char* name, const bool topmost )
810842
CV_ERROR( CV_StsNullPtr,"NULL window" );
811843
}
812844

813-
if ([[windowcontentView]isInFullScreenMode])
845+
if (([windowstyleMask] &NSFullScreenWindowMask))
814846
{
815847
EXIT;
816848
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp