| @@ -74,6 +74,7 @@ · 73 unmodified lines |
| 74 | 74 | |
| 75 | 75 | #include "osdep/io.h" |
| 76 | 76 | #include "osdep/subprocess.h" |
| 77 | +#include "osdep/terminal.h" |
| 77 | 78 | |
| 78 | 79 | #include "core.h" |
| 79 | 80 | |
| @@ -2886,6 +2887,23 @@ static int mp_property_osd_ass(void *ctx, struct m_property *prop, · 2806 unmodified lines |
| 2886 | 2887 | return m_property_read_sub(props, action, arg); |
| 2887 | 2888 | } |
| 2888 | 2889 | |
| 2890 | +static int mp_property_term_size(void *ctx, struct m_property *prop, |
| 2891 | + int action, void *arg) |
| 2892 | +{ |
| 2893 | + int w = -1, h = -1; |
| 2894 | + terminal_get_size(&w, &h); |
| 2895 | + if (w == -1 || h == -1) |
| 2896 | + return M_PROPERTY_UNAVAILABLE; |
| 2897 | + |
| 2898 | + struct m_sub_property props[] = { |
| 2899 | + {"w", SUB_PROP_INT(w)}, |
| 2900 | + {"h", SUB_PROP_INT(h)}, |
| 2901 | + {0} |
| 2902 | + }; |
| 2903 | + |
| 2904 | + return m_property_read_sub(props, action, arg); |
| 2905 | +} |
| 2906 | + |
| 2889 | 2907 | static int mp_property_mouse_pos(void *ctx, struct m_property *prop, |
| 2890 | 2908 | int action, void *arg) |
| 2891 | 2909 | { |
| @@ -4092,6 +4110,7 @@ static const struct m_property mp_properties_base[] = { · 1200 unmodified lines |
| 4092 | 4110 | {"input-bindings", mp_property_bindings}, |
| 4093 | 4111 | |
| 4094 | 4112 | {"user-data", mp_property_udata}, |
| 4113 | + {"term-size", mp_property_term_size}, |
| 4095 | 4114 | |
| 4096 | 4115 | M_PROPERTY_ALIAS("video", "vid"), |
| 4097 | 4116 | M_PROPERTY_ALIAS("audio", "aid"), |