From c11629f74fb135208fcd15b71186f0a3c5f7bdc6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 16 Jun 2025 23:52:13 +0200 Subject: Add some macOS utility functions for full screen. The built-in wxWidgets ones seem not to invoke the "offical" macOS full screen mode (as if you'd clicked the green circle) and also leave a gap at the bottom of the screen (at least on Sequoia). --- src/wx/wscript | 2 +- src/wx/wx_util_osx.h | 28 ++++++++++++++++++++++++++++ src/wx/wx_util_osx.m | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/wx/wx_util_osx.h create mode 100644 src/wx/wx_util_osx.m diff --git a/src/wx/wscript b/src/wx/wscript index 36fca77a3..9b0dba65c 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -361,7 +361,7 @@ def build(bld): obj.source += ' i18n_setup_windows.cc' if bld.env.TARGET_OSX: obj.framework = ['CoreAudio', 'OpenGL'] - obj.source += ' i18n_setup_osx.cc' + obj.source += ' i18n_setup_osx.cc wx_util_osx.m' obj.use = 'libdcpomatic2' obj.target = 'dcpomatic2-wx' diff --git a/src/wx/wx_util_osx.h b/src/wx/wx_util_osx.h new file mode 100644 index 000000000..d45df3b93 --- /dev/null +++ b/src/wx/wx_util_osx.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2025 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +extern "C" { + +void enter_full_screen_mode(NSView* view, int* width, int* height); +void exit_full_screen_mode(NSView* view); + +} + diff --git a/src/wx/wx_util_osx.m b/src/wx/wx_util_osx.m new file mode 100644 index 000000000..a447b51ba --- /dev/null +++ b/src/wx/wx_util_osx.m @@ -0,0 +1,39 @@ +/* + Copyright (C) 2025 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#include + + +void enter_full_screen_mode(NSView* view, int* width, int* height) +{ + NSScreen* screen = [[NSScreen mainScreen] retain]; + [view enterFullScreenMode:screen withOptions:nil]; + *width = (int) view.frame.size.width; + *height = (int) view.frame.size.height; +} + + +void exit_full_screen_mode(NSView* view) +{ + [view exitFullScreenModeWithOptions:nil]; +} + + -- cgit v1.2.3