summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-06-16 23:52:13 +0200
committerCarl Hetherington <cth@carlh.net>2025-12-12 22:08:01 +0100
commitc11629f74fb135208fcd15b71186f0a3c5f7bdc6 (patch)
tree65d1878de89ee77701c8255dcbfb50ea7c3b7916
parent3de41ff2657d558ba0b7121ff47b895fc0fedfdb (diff)
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).
-rw-r--r--src/wx/wscript2
-rw-r--r--src/wx/wx_util_osx.h28
-rw-r--r--src/wx/wx_util_osx.m39
3 files changed, 68 insertions, 1 deletions
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 <cth@carlh.net>
+
+ 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 <http://www.gnu.org/licenses/>.
+
+*/
+
+
+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 <cth@carlh.net>
+
+ 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 <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include <AppKit/AppKit.h>
+
+
+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];
+}
+
+