From fe7db610355b623305d08135869b3f4ff4487b6d Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 19 Sep 2016 19:51:26 +0200 Subject: options: slightly better option update mechanism Extend the flag-based notification mechanism that was used via M_OPT_TERM. Make the vo_opengl update mechanism use this (which, btw., also fixes compilation with OpenGL renderers forcibly disabled). While this adds a 3rd mechanism and just seems to further the chaos, I'd rather have a very simple mechanism now, than actually furthering the mess by mixing old and new update mechanisms. In particular, we'll be able to remove quite some property implementations, and replace them with much simpler update handling. The new update mechanism can also more easily refactored once we have a final mechanism that handles everything in an uniform way. --- options/m_option.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'options/m_option.h') diff --git a/options/m_option.h b/options/m_option.h index 6435584716..a47bbaa7d7 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -191,6 +191,9 @@ struct m_sub_options { const struct m_option *opts; size_t size; const void *defaults; + // Change flags passed to mp_option_change_callback() if any option that is + // directly or indirectly part of this group is changed. + int change_flags; }; #define CONF_TYPE_FLAG (&m_option_type_flag) @@ -372,12 +375,20 @@ struct m_option { // The option expects a file name (or a list of file names) #define M_OPT_FILE (1 << 11) -// Logging-related option - used to update log/terminal settings eagerly -#define M_OPT_TERM (1 << 12) - // Do not add as property. #define M_OPT_NOPROP (1 << 13) +// The following are also part of the M_OPT_* flags, and are used to update +// certain groups of options. +#define UPDATE_OPT_FIRST (1 << 14) +#define UPDATE_TERM (1 << 14) // terminal options +#define UPDATE_RENDERER (1 << 15) // mainly vo_opengl options +#define UPDATE_OPT_LAST (1 << 15) + +// All bits between _FIRST and _LAST (inclusive) +#define UPDATE_OPTS_MASK \ + (((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1)) + // These are kept for compatibility with older code. #define CONF_MIN M_OPT_MIN #define CONF_MAX M_OPT_MAX -- cgit v1.2.3