mpv/osdep
wm4 c784820454 options: introduce bool option type, use it for --fullscreen
The option code is very old and was added to MPlayer in the early 2000s,
when C99 was still new. MPlayer did not use the "bool" type anywhere,l
and the logical option equivalent to bool, the "flag" option type, used
int, with the convention that only the values 0 and 1 are allowed.

mpv may have hammered many, many additional tentacles to the option
code, but some of the basics never changed, and m_option_type_flag still
uses int. This seems a bit weird, since mpv uses bool for booleans. So
finally introduce an m_option_type_bool. To avoid duplicating too much
code, change the flag code to bool, and "reimplement" m_option_type_flag
on top of m_option_type_bool.

As a "demonstration", change the --fullscreen option to this new type.
Ideally, all options would be changed too bool, and m_option_type_flag
would be removed. But that is a lot of monotonous thankless work, so I'm
not doing it, and making it a painful years long transition.

At the same time, I'm introducing a new concept for option declarations.
Instead of OPT_BOOL(), which define the full m_option struct contents,
there's OPTF_BOOL(), which only takes the option field name itself. The
name is provided via a normal struct field initializer. Other fields
(such as flags) can be provided via designated initializers.

The advantage of this is that we don't need tons of nested vararg
macros. We also don't need to deal with 0-sized varargs being a pain
(and in fact they are not a thing in standard C99 and probably C11).
There is no need to provide a mandatory flags argument either, which is
the reason why so many OPT_ macros are used with a "0" argument. (The
flag argument seems to confuse other developers; they either don't
immediately recognize what it is, and sometimes it's supposed to be the
option's default value.)

Not having to mess with the flag argument in such option macros is also
a reason for the removal of M_OPT_RANGE etc., for the better or worse.

The only place that special-cased the _flag option type was in
command.c; change it to use something effectively very similar that
automatically includes the new _bool option type. Everything else should
be transparent to the change. The fullscreen option change should be
transparent too, as C99 bool is basically an integer type that is
clamped to 0/1 (except in Swift, Swift sucks).
2020-03-14 02:23:38 +01:00
..
android android: posix_spawn(p) replacement 2017-09-22 09:24:19 +02:00
macos options: introduce bool option type, use it for --fullscreen 2020-03-14 02:23:38 +01:00
win32 win32: fix massive memory corruption (take 2) 2017-08-21 18:42:04 +02:00
atomic.h atomic: add atomic_exchange_explicit() fallback 2020-03-05 22:00:50 +01:00
compiler.h osdep: add portable C11-like alignof() macro 2018-05-24 19:56:35 +02:00
endian.h audio: drop swapped-endian audio formats 2014-09-23 23:09:25 +02:00
getpid.h lua+js: Implement utils.getpid() 2018-02-13 20:16:01 -08:00
glob-win.c Universal Windows Plaform (UWP) support 2017-06-29 10:36:16 +02:00
io.c io: remove Windows tmpfile() emulation 2019-09-19 20:37:05 +02:00
io.h player: Optionally validate st_mtime when restoring playback state 2019-11-20 15:11:33 +01:00
macOS_swift_bridge.h mac: replace old event tap for media key support with MediaPlayer 2019-12-15 20:07:31 +01:00
macosx_application.h cocoa-cb: add support for forcing the dedicated GPU for rendering 2020-01-26 12:12:22 +01:00
macosx_application.m mac, cocoa: fix UI updates on none main queue threads 2020-02-22 13:56:31 +01:00
macosx_application_objc.h mac: fix media key support for libmpv users 2020-02-22 13:56:31 +01:00
macosx_compat.h mac: add missing semicolon to macosx_compat.h 2019-01-26 20:44:36 +01:00
macosx_events.h mac: remove Apple Remote support 2019-12-15 20:07:31 +01:00
macosx_events.m mac: fix media key support for libmpv users 2020-02-22 13:56:31 +01:00
macosx_events_objc.h mac: fix media key support for libmpv users 2020-02-22 13:56:31 +01:00
macosx_menubar.h osx: move menu bar creation into its own file 2017-08-18 19:20:41 +02:00
macosx_menubar.m mac: activate logging when started from the bundle 2020-02-08 10:55:07 +01:00
macosx_menubar_objc.h osx: refactor menu bar creation 2017-08-18 19:20:41 +02:00
macosx_touchbar.h osx: change license of OSX and cocoa files to LGPL 2017-06-24 16:29:22 +02:00
macosx_touchbar.m osx: change license of OSX and cocoa files to LGPL 2017-06-24 16:29:22 +02:00
macosx_versions.h osx: change license of OSX and cocoa files to LGPL 2017-06-24 16:29:22 +02:00
main-fn-cocoa.c build: move main-fn files to osdep 2015-05-02 18:59:58 +02:00
main-fn-unix.c build: move main-fn files to osdep 2015-05-02 18:59:58 +02:00
main-fn-win.c win32: remove -municode from mpv binary 2019-09-19 20:37:05 +02:00
main-fn.h build: move main-fn files to osdep 2015-05-02 18:59:58 +02:00
mpv.exe.manifest win32: add Windows 10 compatibility GUID 2015-12-20 21:06:02 +11:00
mpv.rc mpv.rc: readd actual version info 2018-01-01 21:44:01 +00:00
path-macosx.m osx: fix bundle on macOS High Sierra (10.13) 2017-10-03 11:30:56 +02:00
path-unix.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
path-uwp.c Universal Windows Plaform (UWP) support 2017-06-29 10:36:16 +02:00
path-win.c win32: build with -DINITGUID 2016-09-28 21:38:52 +10:00
path.h Universal Windows Plaform (UWP) support 2017-06-29 10:36:16 +02:00
polldev.c osdep: add poll shim for macOS 2017-12-09 21:11:46 +02:00
polldev.h osdep: add poll shim for macOS 2017-12-09 21:11:46 +02:00
posix-spawn.h osdep: make use of HAVE_ANDROID 2018-08-20 17:16:22 +02:00
semaphore.h osdep: hack to fix build with low quality pthreads-w32 headers 2014-09-20 04:18:40 +02:00
semaphore_osx.c Fix use of ISC license 2017-04-15 16:20:00 +02:00
strnlen.h osdep: make use of HAVE_ANDROID 2018-08-20 17:16:22 +02:00
subprocess-dummy.c build: change how some OS specific source files are selected 2017-06-29 10:30:16 +02:00
subprocess-posix.c subprocess: implement proper detached processes on POSIX 2020-02-16 22:08:48 +01:00
subprocess-win.c misc: move mp_cancel from stream.c to thread_tools.c 2018-05-24 19:56:35 +02:00
subprocess.c scripting: add a way to run sub processes as "scripts" 2020-02-19 22:18:15 +01:00
subprocess.h subprocess: implement proper detached processes on POSIX 2020-02-16 22:08:48 +01:00
terminal-dummy.c build: change how some OS specific source files are selected 2017-06-29 10:30:16 +02:00
terminal-unix.c terminal-unix: stop trying to read when terminal disappears 2018-05-25 10:17:06 +02:00
terminal-win.c terminal: remove unused return value 2017-06-27 18:08:56 +02:00
terminal.h terminal: remove unused return value 2017-06-27 18:08:56 +02:00
threads.c Revert "osdep: NetBSD pthread_setname_np()" 2017-06-22 13:17:40 +02:00
threads.h threads: use utility+POSIX functions instead of weird wrappers 2015-05-11 23:44:36 +02:00
timer-darwin.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
timer-linux.c build: remove nanosleep() check 2017-12-02 23:29:40 +01:00
timer-win2.c Universal Windows Plaform (UWP) support 2017-06-29 10:36:16 +02:00
timer.c timer: remove an unused helper function 2018-05-24 19:56:35 +02:00
timer.h demux, stream: readd cache-speed in some other form 2018-12-06 10:30:41 +01:00
w32_keyboard.c w32_common: handle media keys 2017-08-05 02:38:44 +10:00
w32_keyboard.h w32_common: handle media keys 2017-08-05 02:38:44 +10:00
win32-console-wrapper.c win32-console-wrapper: silence missing prototype warnings 2019-05-10 21:06:58 +10:00
windows_utils.c vo_opengl: angle: rewrite with custom swap chain 2017-02-07 22:45:07 +11:00
windows_utils.h win32: add COM-specific SAFE_RELEASE to windows_utils.h 2017-01-30 00:22:30 +11:00