implement oc_window_is_minimized on macos

This commit is contained in:
Martin Fouilleul 2023-08-23 12:16:01 +02:00
parent 7b48c20c26
commit edaffcb649
2 changed files with 41 additions and 2 deletions

View File

@ -325,9 +325,7 @@ extern "C"
ORCA_API void oc_window_show(oc_window window); ORCA_API void oc_window_show(oc_window window);
ORCA_API bool oc_window_is_minimized(oc_window window); ORCA_API bool oc_window_is_minimized(oc_window window);
ORCA_API bool oc_window_is_maximized(oc_window window);
ORCA_API void oc_window_minimize(oc_window window); ORCA_API void oc_window_minimize(oc_window window);
ORCA_API void oc_window_maximize(oc_window window);
ORCA_API void oc_window_restore(oc_window window); ORCA_API void oc_window_restore(oc_window window);
ORCA_API bool oc_window_has_focus(oc_window window); ORCA_API bool oc_window_has_focus(oc_window window);

View File

@ -1471,6 +1471,22 @@ bool oc_window_is_focused(oc_window window)
} }
} }
bool oc_window_is_minimized(oc_window window)
{
@autoreleasepool
{
oc_window_data* windowData = oc_window_ptr_from_handle(window);
if(windowData)
{
return ([windowData->osx.nsWindow isMiniaturized]);
}
else
{
return (false);
}
}
}
void oc_window_hide(oc_window window) void oc_window_hide(oc_window window)
{ {
@autoreleasepool @autoreleasepool
@ -1496,6 +1512,31 @@ void oc_window_focus(oc_window window)
} }
} }
void oc_window_minimize(oc_window window)
{
@autoreleasepool
{
oc_window_data* windowData = oc_window_ptr_from_handle(window);
if(windowData)
{
[windowData->osx.nsWindow miniaturize:windowData->osx.nsWindow];
}
}
}
void oc_window_restore(oc_window window)
{
@autoreleasepool
{
oc_window_data* windowData = oc_window_ptr_from_handle(window);
if(windowData && [windowData->osx.nsWindow isMiniaturized])
{
[windowData->osx.nsWindow deminiaturize:windowData->osx.nsWindow];
}
}
}
void oc_window_send_to_back(oc_window window) void oc_window_send_to_back(oc_window window)
{ {
@autoreleasepool @autoreleasepool